1 ;;; winmgr-mode.el --- generic window manager mode
4 ;; Maintainer: David Konerding (rafael@cse.ucsc.edu)
5 ;; Modifications by: Stefan Strobel <strobel@lia.univ-savoie.fr>
6 ;; Barry A. Warsaw <bwarsaw@python.org>
10 ;; Copyright (C) 199? Someone Claim It
12 ;; This file is part of XEmacs.
14 ;; XEmacs is free software; you can redistribute it and/or modify it
15 ;; under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2 of the License, or
17 ;; (at your option) any later version.
19 ;; XEmacs is distributed in the hope that it will be useful, but
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;; General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with XEmacs; if not, write to the Free Software
26 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29 ;;; Synched up with: Not in FSF.
33 ;; This package is a major mode for editing window configuration files and
34 ;; also defines font-lock keywords for such files.
36 ;; winmgr-mode mode will automatically get turned on if you visit a
37 ;; a file whose name looks like that of a configuration file
38 ;; (IE, .fvwmrc, .mwmrc, .tvtwmrc, etc)
40 ;; The current font-lock keywords are:
42 ;; any word of upper or lower case letters at the start of a line
43 ;; followed by whitespace gets colored using
44 ;; font-lock-function-name-face.
46 ;; any word of upper or lower case letters at the start of a line
47 ;; followed by a "(" (IE, an m4 macro) gets colored using
48 ;; font-lock-comment-face
50 ;; Put this in your .emacs :
52 ;;(setq auto-mode-alist
53 ;; (append '(("\\.[A-Za-z]*wm$" . winmgr-mode)
54 ;; ("\\.[A-Za-z]*wmrc" . winmgr-mode)
57 ;;(autoload 'winmgr-mode "winmgr-mode"
58 ;; "Mode for editing window manager config files")
60 ;;(add-hook 'winmgr-mode-hook
63 ;; (setq font-lock-keywords winmgr-font-lock-keywords)
64 ;; (font-lock-fontify-buffer)))
71 "Generic window manager mode."
72 :tag "Window Managers"
76 (defcustom winmgr-basic-offset 4
77 "*Number of spaces per indentation level."
81 (defcustom winmgr-mode-hook nil
82 "Hook to be run when `winmgr-mode' is entered."
87 (defface font-lock-m4-face
92 "Font-lock face for M4 macros."
95 (defvar winmgr-font-lock-keywords
96 '(("^[A-Za-z]+[ \n\t]" . font-lock-function-name-face)
97 ;;("^#.*" . font-lock-comment-face)
98 ("^[A-Za-z]+(.*)" . font-lock-m4-face))
99 "Default font-lock keywords.")
103 (defvar winmgr-mode-abbrev-table nil
104 "Abbrev table used in `winmgr-mode' buffers.")
105 (define-abbrev-table 'winmgr-mode-abbrev-table ())
108 (defvar winmgr-mode-syntax-table nil
109 "Syntax table used in `winmgr-mode' buffers.")
110 (if winmgr-mode-syntax-table
112 (setq winmgr-mode-syntax-table (make-syntax-table))
113 (modify-syntax-entry ?\# "<" winmgr-mode-syntax-table)
114 (modify-syntax-entry ?\n ">" winmgr-mode-syntax-table))
117 (defvar winmgr-mode-map ()
118 "Keymap used in `winmgr-mode' buffers.")
121 (setq winmgr-mode-map (make-sparse-keymap))
122 ;; So far there aren't any winmgr-mode specific functions
127 (defun winmgr-mode ()
128 "Major mode for editing winmgr config files."
130 (kill-all-local-variables)
131 (set-syntax-table winmgr-mode-syntax-table)
132 (setq major-mode 'winmgr-mode
134 local-abbrev-table winmgr-mode-abbrev-table)
135 (use-local-map winmgr-mode-map)
137 (make-local-variable 'parse-sexp-ignore-comments)
138 (make-local-variable 'comment-start)
139 (make-local-variable 'comment-end)
140 (make-local-variable 'indent-line-function)
141 ;; now set their values
142 (setq parse-sexp-ignore-comments t
145 indent-line-function 'winmgr-indent-line-function)
146 (run-hooks 'winmgr-mode-hook))
149 ;; indentation commands
151 (defun winmgr-indent-line-function ()
152 "Indent line based on depth in parentheses.
153 See the variable `winmgr-basic-offset.'"
154 ;; find the beginning of this construct
160 (setq depth (1+ depth)))
164 (delete-horizontal-space)
165 (insert-char ?\040 (* depth winmgr-basic-offset))))
168 ;; XEmacs addition, Unix-specific
169 ;;;###autoload(add-to-list 'auto-mode-alist '("\\.[^/]*wm2?\\(?:rc\\)?\\'" . winmgr-mode))
171 (provide 'winmgr-mode)
173 ;;; winmgr-mode.el ends here