Mercurial > emacs
annotate lisp/textmodes/conf-mode.el @ 103508:b3c1a923f213
* xdisp.c (Qbefore_string, Qafter_string): Add externs.
(load_overlay_strings): Remove externs.
(fast_find_position): Function deleted.
(mouse_face_from_buffer_pos): New function, based on
fast_find_position. Correctly handle before-strings,
display-strings, and after-strings (Bug#1220).
(note_mouse_highlight): Use mouse_face_from_buffer_pos.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 22 Jun 2009 01:53:11 +0000 |
parents | a9dc0e7c3f2b |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
1 ;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
2 |
100908 | 3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 |
4 ;; Free Software Foundation, Inc. | |
64969
3a43d3e9bb74
Fix copyright notice, list author.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
5 |
3a43d3e9bb74
Fix copyright notice, list author.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
6 ;; Author: Daniel Pfeiffer <occitan@esperanto.org> |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
7 ;; Keywords: conf ini windows java |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
8 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
10 |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93535
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93535
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93535
diff
changeset
|
14 ;; (at your option) any later version. |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
15 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
19 ;; GNU General Public License for more details. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
20 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94670
f4a69fedbd46
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93535
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
23 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
24 ;;; Commentary: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
25 ;; |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
26 ;; This mode is designed to edit many similar varieties of Conf/Ini files and |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
27 ;; Java properties. It started out from Aurélien Tisné's ini-mode. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
28 ;; `conf-space-keywords' were inspired by Robert Fitzgerald's any-ini-mode. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
29 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
30 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
31 ;;; Code: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
32 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
33 (require 'newcomment) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
34 |
65261
5e6a52548deb
(outline-heading-end-regexp): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64969
diff
changeset
|
35 (defvar outline-heading-end-regexp) |
5e6a52548deb
(outline-heading-end-regexp): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64969
diff
changeset
|
36 |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
37 ;; Variables: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
38 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
39 (defgroup conf nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
40 "Configuration files." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
41 :group 'data |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
58694
diff
changeset
|
42 :version "22.1") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
43 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
44 (defcustom conf-assignment-column 24 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
45 "Align assignments to this column by default with \\[conf-align-assignments]. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
46 If this number is negative, the `=' comes before the whitespace. Use 0 to |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
47 not align (only setting space according to `conf-assignment-space')." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
48 :type 'integer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
49 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
50 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
51 (defcustom conf-javaprop-assignment-column 32 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
52 "Value for `conf-assignment-column' in Java properties buffers." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
53 :type 'integer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
54 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
55 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
56 (defcustom conf-colon-assignment-column (- (abs conf-assignment-column)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
57 "Value for `conf-assignment-column' in Java properties buffers." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
58 :type 'integer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
59 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
60 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
61 (defcustom conf-assignment-space t |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
62 "Put at least one space around assignments when aligning." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
63 :type 'boolean |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
64 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
65 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
66 (defcustom conf-colon-assignment-space nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
67 "Value for `conf-assignment-space' in colon style Conf mode buffers." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
68 :type 'boolean |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
69 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
70 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
71 (defvar conf-mode-map |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
72 (let ((map (make-sparse-keymap)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
73 (menu-map (make-sparse-keymap))) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
74 (define-key map "\C-c\C-u" 'conf-unix-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
75 (define-key map "\C-c\C-w" 'conf-windows-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
76 (define-key map "\C-c\C-j" 'conf-javaprop-mode) |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
77 (define-key map "\C-c\C-s" 'conf-space-keywords) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
78 (define-key map "\C-c " 'conf-space-keywords) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
79 (define-key map "\C-c\C-c" 'conf-colon-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
80 (define-key map "\C-c:" 'conf-colon-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
81 (define-key map "\C-c\C-x" 'conf-xdefaults-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
82 (define-key map "\C-c\C-p" 'conf-ppd-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
83 (define-key map "\C-c\C-q" 'conf-quote-normal) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
84 (define-key map "\C-c\"" 'conf-quote-normal) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
85 (define-key map "\C-c'" 'conf-quote-normal) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
86 (define-key map "\C-c\C-a" 'conf-align-assignments) |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
87 (define-key map [menu-bar sh-script] (cons "Conf" menu-map)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
88 (define-key menu-map [conf-windows-mode] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
89 '(menu-item "Windows mode" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
90 conf-windows-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
91 :help "Conf Mode starter for Windows style Conf files" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
92 :button (:radio . (eq major-mode 'conf-windows-mode)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
93 (define-key menu-map [conf-javaprop-mode] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
94 '(menu-item "Java properties mode" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
95 conf-javaprop-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
96 :help "Conf Mode starter for Java properties files" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
97 :button (:radio . (eq major-mode 'conf-javaprop-mode)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
98 (define-key menu-map [conf-space-keywords] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
99 '(menu-item "Space keywords mode..." |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
100 conf-space-keywords |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
101 :help "Enter Conf Space mode using regexp KEYWORDS to match the keywords" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
102 :button (:radio . (eq major-mode 'conf-space-keywords)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
103 (define-key menu-map [conf-ppd-mode] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
104 '(menu-item "PPD mode" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
105 conf-ppd-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
106 :help "Conf Mode starter for Adobe/CUPS PPD files" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
107 :button (:radio . (eq major-mode 'conf-ppd-mode)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
108 (define-key menu-map [conf-colon-mode] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
109 '(menu-item "Colon mode" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
110 conf-colon-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
111 :help "Conf Mode starter for Colon files" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
112 :button (:radio . (eq major-mode 'conf-colon-mode)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
113 (define-key menu-map [conf-unix-mode] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
114 '(menu-item "Unix mode" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
115 conf-unix-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
116 :help "Conf Mode starter for Unix style Conf files" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
117 :button (:radio . (eq major-mode 'conf-unix-mode)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
118 (define-key menu-map [conf-xdefaults-mode] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
119 '(menu-item "Xdefaults mode" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
120 conf-xdefaults-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
121 :help "Conf Mode starter for Xdefaults files" |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
122 :button (:radio . (eq major-mode 'conf-xdefaults-mode)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
123 (define-key menu-map [c-s0] '("--")) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
124 (define-key menu-map [conf-quote-normal] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
125 '(menu-item "Set quote syntax normal" conf-quote-normal |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
126 :help "Set the syntax of \' and \" to punctuation")) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
127 (define-key menu-map [conf-align-assignments] |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
128 '(menu-item "Align assignments" conf-align-assignments |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
129 :help "Align assignments")) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
130 map) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
131 "Local keymap for `conf-mode' buffers.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
132 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
133 (defvar conf-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
134 (let ((table (make-syntax-table))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
135 (modify-syntax-entry ?= "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
136 (modify-syntax-entry ?_ "_" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
137 (modify-syntax-entry ?- "_" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
138 (modify-syntax-entry ?. "_" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
139 (modify-syntax-entry ?\' "\"" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
140 (modify-syntax-entry ?\; "<" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
141 (modify-syntax-entry ?\n ">" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
142 (modify-syntax-entry ?\r ">" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
143 table) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
144 "Syntax table in use in Windows style `conf-mode' buffers.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
145 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
146 (defvar conf-unix-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
147 (let ((table (make-syntax-table conf-mode-syntax-table))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
148 (modify-syntax-entry ?\# "<" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
149 ;; override |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
150 (modify-syntax-entry ?\; "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
151 table) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
152 "Syntax table in use in Unix style `conf-mode' buffers.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
153 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
154 (defvar conf-javaprop-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
155 (let ((table (make-syntax-table conf-unix-mode-syntax-table))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
156 (modify-syntax-entry ?/ ". 124" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
157 (modify-syntax-entry ?* ". 23b" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
158 table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
159 "Syntax table in use in Java prperties buffers.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
160 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
161 (defvar conf-ppd-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
162 (let ((table (make-syntax-table conf-mode-syntax-table))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
163 (modify-syntax-entry ?* ". 1" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
164 (modify-syntax-entry ?% ". 2" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
165 ;; override |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
166 (modify-syntax-entry ?\' "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
167 (modify-syntax-entry ?\; "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
168 table) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
169 "Syntax table in use in PPD `conf-mode' buffers.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
170 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
171 (defvar conf-xdefaults-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
172 (let ((table (make-syntax-table conf-mode-syntax-table))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
173 (modify-syntax-entry ?! "<" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
174 ;; override |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
175 (modify-syntax-entry ?\; "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
176 table) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
177 "Syntax table in use in Xdefaults style `conf-mode' buffers.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
178 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
179 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
180 (defvar conf-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
181 `(;; [section] (do this first because it may look like a parameter) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
182 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
183 ;; var=val or var[index]=val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
184 ("^[ \t]*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?[ \t]*=" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
185 (1 'font-lock-variable-name-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
186 (2 'font-lock-constant-face nil t)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
187 ;; section { ... } (do this last because some assign ...{...) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
188 ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend)) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
189 "Keywords to hilight in Conf mode.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
190 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
191 (defvar conf-javaprop-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
192 '(;; var=val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
193 ("^[ \t]*\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(?:\\.\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(?:\\.\\(.+?\\)\\(?:\\.\\([0-9]+\\)\\(\\..+?\\)?\\)?\\)?\\)?\\)?\\)?\\([:= \t]\\|$\\)" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
194 (1 'font-lock-variable-name-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
195 (2 'font-lock-constant-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
196 (3 'font-lock-variable-name-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
197 (4 'font-lock-constant-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
198 (5 'font-lock-variable-name-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
199 (6 'font-lock-constant-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
200 (7 'font-lock-variable-name-face nil t))) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
201 "Keywords to hilight in Conf Java Properties mode.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
202 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
203 (defvar conf-space-keywords-alist |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
204 '(("\\`/etc/gpm/" . "key\\|name\\|foreground\\|background\\|border\\|head") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
205 ("\\`/etc/magic\\'" . "[^ \t]+[ \t]+\\(?:[bl]?e?\\(?:short\\|long\\)\\|byte\\|string\\)[^ \t]*") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
206 ("/mod\\(?:ules\\|probe\\)\\.conf" . "alias\\|in\\(?:clude\\|stall\\)\\|options\\|remove") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
207 ("/manpath\\.config" . "MAN\\(?:DATORY_MANPATH\\|PATH_MAP\\|DB_MAP\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
208 ("/sensors\\.conf" . "chip\\|bus\\|label\\|compute\\|set\\|ignore") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
209 ("/sane\\(\\.d\\)?/" . "option\\|device\\|port\\|usb\\|sc\\(?:si\\|anner\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
210 ("/resmgr\\.conf" . "class\\|add\\|allow\\|deny") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
211 ("/dictionary\\.lst\\'" . "DICT\\|HYPH\\|THES") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
212 ("/tuxracer/options" . "set")) |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
213 "File-name-based settings for the variable `conf-space-keywords'.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
214 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
215 (defvar conf-space-keywords nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
216 "Regexps for functions that may come before a space assignment. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
217 This allows constructs such as |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
218 keyword var value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
219 This variable is best set in the file local variables, or through |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
220 `conf-space-keywords-alist'.") |
79219
b892c8b20287
(conf-space-keywords): Mark this regexps as safe if a string.
Glenn Morris <rgm@gnu.org>
parents:
78225
diff
changeset
|
221 (put 'conf-space-keywords 'safe-local-variable 'stringp) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
222 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
223 (defvar conf-space-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
224 `(;; [section] (do this first because it may look like a parameter) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
225 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
226 ;; section { ... } (do this first because it looks like a parameter) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
227 ("^[ \t]*\\(.+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
228 ;; var val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
229 (eval if conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
230 (list (concat "^[ \t]*\\(" conf-space-keywords "\\)[ \t]+\\([^\000- ]+\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
231 '(1 'font-lock-keyword-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
232 '(2 'font-lock-variable-name-face)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
233 '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face))) |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
234 "Keywords to highlight in Conf Space mode.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
235 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
236 (defvar conf-colon-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
237 `(;; [section] (do this first because it may look like a parameter) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
238 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
239 ;; var: val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
240 ("^[ \t]*\\(.+?\\)[ \t]*:" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
241 (1 'font-lock-variable-name-face)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
242 ;; section { ... } (do this last because some assign ...{...) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
243 ("^[ \t]*\\([^:\n]+\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend)) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
244 "Keywords to hilight in Conf Colon mode.") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
245 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
246 (defvar conf-assignment-sign ?= |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
247 "Sign used for assignments (char or string).") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
248 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
249 (defvar conf-assignment-regexp ".+?\\([ \t]*=[ \t]*\\)" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
250 "Regexp to recognize assignments. |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
251 It is anchored after the first sexp on a line. There must be a |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
252 grouping for the assignment sign, including leading and trailing |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
253 whitespace.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
254 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
255 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
256 ;; If anybody can figure out how to get the same effect by configuring |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
257 ;; `align', I'd be glad to hear. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
258 (defun conf-align-assignments (&optional arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
259 (interactive "P") |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
260 "Align the assignments in the buffer or active region. |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
261 In Transient Mark mode, if the mark is active, operate on the |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
262 contents of the region. Otherwise, operate on the whole buffer." |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
263 (setq arg (if arg |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
264 (prefix-numeric-value arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
265 conf-assignment-column)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
266 (save-excursion |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
267 (save-restriction |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
268 (when (use-region-p) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
269 (narrow-to-region (region-beginning) (region-end))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
270 (goto-char (point-min)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
271 (while (not (eobp)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
272 (let ((cs (comment-beginning))) ; go before comment if within |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
273 (if cs (goto-char cs))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
274 (while (forward-comment 9)) ; max-int? |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
275 (when (and (not (eobp)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
276 (looking-at conf-assignment-regexp)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
277 (goto-char (match-beginning 1)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
278 (delete-region (point) (match-end 1)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
279 (if conf-assignment-sign |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
280 (if (>= arg 0) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
281 (progn |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
282 (indent-to-column arg) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
283 (or (not conf-assignment-space) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
284 (memq (char-before (point)) '(?\s ?\t)) (insert ?\s)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
285 (insert conf-assignment-sign |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
286 (if (and conf-assignment-space (not (eolp))) ?\s ""))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
287 (insert (if conf-assignment-space ?\s "") conf-assignment-sign) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
288 (unless (eolp) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
289 (indent-to-column (- arg)) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
290 (or (not conf-assignment-space) |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
291 (memq (char-before (point)) '(?\s ?\t)) (insert ?\s)))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
292 (unless (eolp) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
293 (if (>= (current-column) (abs arg)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
294 (insert ?\s) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
295 (indent-to-column (abs arg)))))) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
296 (forward-line))))) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
297 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
298 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
299 (defun conf-quote-normal (arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
300 "Set the syntax of ' and \" to punctuation. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
301 With prefix arg, only do it for ' if 1, or only for \" if 2. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
302 This only affects the current buffer. Some conf files use quotes |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
303 to delimit strings, while others allow quotes as simple parts of |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
304 the assigned value. In those files font locking will be wrong, |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
305 and you can correct it with this command. (Some files even do |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
306 both, i.e. quotes delimit strings, except when they are |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
307 unbalanced, but hey...)" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
308 (interactive "P") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
309 (let ((table (copy-syntax-table (syntax-table)))) |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
310 (when (or (not arg) (= (prefix-numeric-value arg) 1)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
311 (modify-syntax-entry ?\' "." table)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
312 (when (or (not arg) (= (prefix-numeric-value arg) 2)) |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
313 (modify-syntax-entry ?\" "." table)) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
314 (set-syntax-table table) |
93535
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
315 (when font-lock-mode |
a128a4284881
* emacs-lisp/debug.el (debugger-mode-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79719
diff
changeset
|
316 (font-lock-fontify-buffer)))) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
317 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
318 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
319 (defun conf-outline-level () |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
320 (let ((depth 0) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
321 (pt (match-end 0))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
322 (condition-case nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
323 (while (setq pt (scan-lists pt -1 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
324 depth (1+ depth))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
325 (scan-error depth)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
326 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
327 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
328 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
329 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
330 (defun conf-mode () |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
331 "Mode for Unix and Windows Conf files and Java properties. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
332 Most conf files know only three kinds of constructs: parameter |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
333 assignments optionally grouped into sections and comments. Yet |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
334 there is a great range of variation in the exact syntax of conf |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
335 files. See below for various wrapper commands that set up the |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
336 details for some of the most widespread variants. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
337 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
338 This mode sets up font locking, outline, imenu and it provides |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
339 alignment support through `conf-align-assignments'. If strings |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
340 come out wrong, try `conf-quote-normal'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
341 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
342 Some files allow continuation lines, either with a backslash at |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
343 the end of line, or by indenting the next line (further). These |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
344 constructs cannot currently be recognized. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
345 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
346 Because of this great variety of nuances, which are often not |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
347 even clearly specified, please don't expect it to get every file |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
348 quite right. Patches that clearly identify some special case, |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
349 without breaking the general ones, are welcome. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
350 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
351 If instead you start this mode with the generic `conf-mode' |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
352 command, it will parse the buffer. It will generally well |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
353 identify the first four cases listed below. If the buffer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
354 doesn't have enough contents to decide, this is identical to |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
355 `conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
356 See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode', |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
357 `conf-ppd-mode' and `conf-xdefaults-mode'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
358 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
359 \\{conf-mode-map}" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
360 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
361 (interactive) |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
362 ;; `conf-mode' plays two roles: it's the parent of several sub-modes |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
363 ;; but it's also the function that chooses between those submodes. |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
364 ;; To tell the difference between those two cases where the function |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
365 ;; might be called, we check `delay-mode-hooks'. |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
366 ;; (adopted from tex-mode.el) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
367 (if (not delay-mode-hooks) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
368 ;; try to guess sub-mode of conf-mode based on buffer content |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
369 (let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
370 (save-excursion |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
371 (goto-char (point-min)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
372 (while (not (eobp)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
373 (skip-chars-forward " \t\f") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
374 (cond ((eq (char-after) ?\#) (setq unix (1+ unix))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
375 ((eq (char-after) ?\;) (setq win (1+ win))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
376 ((eq (char-after) ?\[)) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
377 ((eolp)) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
378 ((eq (char-after) ?})) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
379 ;; recognize at most double spaces within names |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
380 ((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
381 (if (eq (char-before (match-end 0)) ?=) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
382 (setq equal (1+ equal)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
383 (setq colon (1+ colon)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
384 ((looking-at "/[/*]") (setq jp (1+ jp))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
385 ((looking-at ".*{")) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
386 ((setq space (1+ space)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
387 (forward-line))) |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
388 (cond |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
389 ((> jp (max unix win 3)) (conf-javaprop-mode)) |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
390 ((> colon (max equal space)) (conf-colon-mode)) |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
391 ((> space (max equal colon)) (conf-space-mode)) |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
392 ((or (> win unix) (and (= win unix) (eq system-type 'windows-nt))) |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
393 (conf-windows-mode)) |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
394 (t (conf-unix-mode)))) |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
395 |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
396 (kill-all-local-variables) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
397 (use-local-map conf-mode-map) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
398 (setq major-mode 'conf-mode |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
399 mode-name "Conf[?]") |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
400 (set (make-local-variable 'font-lock-defaults) |
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
401 '(conf-font-lock-keywords nil t nil nil)) |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
402 ;; Let newcomment.el decide this for itself. |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
403 ;; (set (make-local-variable 'comment-use-syntax) t) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
404 (set (make-local-variable 'parse-sexp-ignore-comments) t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
405 (set (make-local-variable 'outline-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
406 "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
407 (set (make-local-variable 'outline-heading-end-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
408 "[\n}]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
409 (set (make-local-variable 'outline-level) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
410 'conf-outline-level) |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
411 (set-syntax-table conf-mode-syntax-table) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
412 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
413 '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
414 ;; [section] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
415 (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
416 ;; section { ... } |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
417 (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
418 (run-mode-hooks 'conf-mode-hook))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
419 |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
420 (defun conf-mode-initialize (comment &optional font-lock) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
421 "Intitializations for sub-modes of conf-mode. |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
422 COMMENT initializes `comment-start' and `comment-start-skip'. |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
423 The optional arg FONT-LOCK is the value for FONT-LOCK-KEYWORDS." |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
424 (set (make-local-variable 'comment-start) comment) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
425 (set (make-local-variable 'comment-start-skip) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
426 (concat (regexp-quote comment-start) "+\\s *")) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
427 (if font-lock |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
428 (set (make-local-variable 'font-lock-defaults) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
429 `(,font-lock nil t nil nil)))) |
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
430 |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
431 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
432 (define-derived-mode conf-unix-mode conf-mode "Conf[Unix]" |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
433 "Conf Mode starter for Unix style Conf files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
434 Comments start with `#'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
435 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
436 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
437 # Conf mode font-locks this right on Unix and with \\[conf-unix-mode] |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
438 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
439 \[Desktop Entry] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
440 Encoding=UTF-8 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
441 Name=The GIMP |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
442 Name[ca]=El GIMP |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
443 Name[cs]=GIMP" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
444 (conf-mode-initialize "#")) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
445 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
446 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
447 (define-derived-mode conf-windows-mode conf-mode "Conf[WinIni]" |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
448 "Conf Mode starter for Windows style Conf files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
449 Comments start with `;'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
450 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
451 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
452 ; Conf mode font-locks this right on Windows and with \\[conf-windows-mode] |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
453 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
454 \[ExtShellFolderViews] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
455 Default={5984FFE0-28D4-11CF-AE66-08002B2E1262} |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
456 {5984FFE0-28D4-11CF-AE66-08002B2E1262}={5984FFE0-28D4-11CF-AE66-08002B2E1262} |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
457 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
458 \[{5984FFE0-28D4-11CF-AE66-08002B2E1262}] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
459 PersistMoniker=file://Folder.htt" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
460 (conf-mode-initialize ";")) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
461 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
462 ;; Here are a few more or less widespread styles. There are others, so |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
463 ;; obscure, they are not covered. E.g. RFC 2614 allows both Unix and Windows |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
464 ;; comments. Or the donkey has (* Pascal comments *) -- roll your own starter |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
465 ;; if you need it. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
466 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
467 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
468 (define-derived-mode conf-javaprop-mode conf-mode "Conf[JavaProp]" |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
469 "Conf Mode starter for Java properties files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
470 Comments start with `#' but are also recognized with `//' or |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
471 between `/*' and `*/'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
472 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
473 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
474 # Conf mode font-locks this right with \\[conf-javaprop-mode] (Java properties) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
475 // another kind of comment |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
476 /* yet another */ |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
477 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
478 name:value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
479 name=value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
480 name value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
481 x.1 = |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
482 x.2.y.1.z.1 = |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
483 x.2.y.1.z.2.zz =" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
484 (conf-mode-initialize "#" 'conf-javaprop-font-lock-keywords) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
485 (set (make-local-variable 'conf-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
486 conf-javaprop-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
487 (set (make-local-variable 'conf-assignment-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
488 ".+?\\([ \t]*[=: \t][ \t]*\\|$\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
489 (setq comment-start-skip "\\(?:#+\\|/[/*]+\\)\\s *") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
490 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
491 '(("Parameters" "^[ \t]*\\(.+?\\)[=: \t]" 1)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
492 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
493 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
494 (define-derived-mode conf-space-mode conf-unix-mode "Conf[Space]" |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
495 "Conf Mode starter for space separated conf files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
496 \"Assignments\" are with ` '. Keywords before the parameters are |
72972
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
497 recognized according to the variable `conf-space-keywords-alist'. |
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
498 Alternatively, you can specify a value for the file local variable |
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
499 `conf-space-keywords'. |
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
500 Use the function `conf-space-keywords' if you want to specify keywords |
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
501 in an interactive fashion instead. |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
502 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
503 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
504 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
505 # Conf mode font-locks this right with \\[conf-space-mode] (space separated) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
506 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
507 image/jpeg jpeg jpg jpe |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
508 image/png png |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
509 image/tiff tiff tif |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
510 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
511 # Or with keywords (from a recognized file name): |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
512 class desktop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
513 # Standard multimedia devices |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
514 add /dev/audio desktop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
515 add /dev/mixer desktop" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
516 (conf-mode-initialize "#" 'conf-space-font-lock-keywords) |
72764
88fd4983fe78
(conf-space-mode): Use hack-local-variables-hook instead of calling
Richard M. Stallman <rms@gnu.org>
parents:
68648
diff
changeset
|
517 (make-local-variable 'conf-assignment-sign) |
88fd4983fe78
(conf-space-mode): Use hack-local-variables-hook instead of calling
Richard M. Stallman <rms@gnu.org>
parents:
68648
diff
changeset
|
518 (setq conf-assignment-sign nil) |
72769
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
519 (make-local-variable 'conf-space-keywords) |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
520 (cond (buffer-file-name |
72972
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
521 ;; We set conf-space-keywords directly, but a value which is |
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
522 ;; in the local variables list or interactively specified |
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
523 ;; (see the function conf-space-keywords) takes precedence. |
72764
88fd4983fe78
(conf-space-mode): Use hack-local-variables-hook instead of calling
Richard M. Stallman <rms@gnu.org>
parents:
68648
diff
changeset
|
524 (setq conf-space-keywords |
88fd4983fe78
(conf-space-mode): Use hack-local-variables-hook instead of calling
Richard M. Stallman <rms@gnu.org>
parents:
68648
diff
changeset
|
525 (assoc-default buffer-file-name conf-space-keywords-alist |
88fd4983fe78
(conf-space-mode): Use hack-local-variables-hook instead of calling
Richard M. Stallman <rms@gnu.org>
parents:
68648
diff
changeset
|
526 'string-match)))) |
72769
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
527 (conf-space-mode-internal) |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
528 ;; In case the local variables list specifies conf-space-keywords, |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
529 ;; recompute other things from that afterward. |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
530 (add-hook 'hack-local-variables-hook 'conf-space-mode-internal nil t)) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
531 |
72972
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
532 ;;;###autoload |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
533 (defun conf-space-keywords (keywords) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
534 "Enter Conf Space mode using regexp KEYWORDS to match the keywords. |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
535 See `conf-space-mode'." |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
536 (interactive "sConf Space keyword regexp: ") |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
537 (delay-mode-hooks |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
538 (conf-space-mode)) |
72972
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
539 (if (string-equal keywords "") |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
540 (setq keywords nil)) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
541 (setq conf-space-keywords keywords) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
542 (conf-space-mode-internal) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
543 (run-mode-hooks)) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
544 |
72769
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
545 (defun conf-space-mode-internal () |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
546 (make-local-variable 'conf-assignment-regexp) |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
547 (setq conf-assignment-regexp |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
548 (if conf-space-keywords |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
549 (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
550 ".+?\\([ \t]+\\|$\\)")) |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
551 ;; If Font Lock is already enabled, reenable it with new |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
552 ;; conf-assignment-regexp. |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
553 (when (and font-lock-mode |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
554 (boundp 'font-lock-keywords)) ;see `normal-mode' |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
555 (font-lock-add-keywords nil nil) |
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
556 (font-lock-mode 1)) |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
557 ;; Copy so that we don't destroy shared structure. |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
558 (setq imenu-generic-expression (copy-sequence imenu-generic-expression)) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
559 ;; Get rid of any existing Parameters element. |
72769
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
560 (setq imenu-generic-expression |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
561 (delq (assoc "Parameters" imenu-generic-expression) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
562 imenu-generic-expression)) |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
563 ;; Add a new one based on conf-space-keywords. |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
564 (setq imenu-generic-expression |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
565 (cons `("Parameters" |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
566 ,(if conf-space-keywords |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
567 (concat "^[ \t]*\\(?:" conf-space-keywords |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
568 "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)") |
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
569 "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)") |
72972
5ae87c1395e1
(conf-space-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
72940
diff
changeset
|
570 1) |
72940
c2b72b555fc4
(conf-mode-map): Use conf-space-keywords cmd.
Richard M. Stallman <rms@gnu.org>
parents:
72769
diff
changeset
|
571 imenu-generic-expression))) |
72769
00b6d782491f
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
Richard M. Stallman <rms@gnu.org>
parents:
72764
diff
changeset
|
572 |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
573 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
574 (define-derived-mode conf-colon-mode conf-unix-mode "Conf[Colon]" |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
575 "Conf Mode starter for Colon files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
576 \"Assignments\" are with `:'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
577 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
578 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
579 # Conf mode font-locks this right with \\[conf-colon-mode] (colon) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
580 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
581 <Multi_key> <exclam> <exclam> : \"\\241\" exclamdown |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
582 <Multi_key> <c> <slash> : \"\\242\" cent" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
583 (conf-mode-initialize "#" 'conf-colon-font-lock-keywords) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
584 (set (make-local-variable 'conf-assignment-space) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
585 conf-colon-assignment-space) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
586 (set (make-local-variable 'conf-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
587 conf-colon-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
588 (set (make-local-variable 'conf-assignment-sign) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
589 ?:) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
590 (set (make-local-variable 'conf-assignment-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
591 ".+?\\([ \t]*:[ \t]*\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
592 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
593 `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
594 ,@(cdr imenu-generic-expression)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
595 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
596 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
597 (define-derived-mode conf-ppd-mode conf-colon-mode "Conf[PPD]" |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
598 "Conf Mode starter for Adobe/CUPS PPD files. |
58692
4867e00488dc
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58691
diff
changeset
|
599 Comments start with `*%' and \"assignments\" are with `:'. |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
600 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
601 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
602 *% Conf mode font-locks this right with \\[conf-ppd-mode] (PPD) |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
603 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
604 *DefaultTransfer: Null |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
605 *Transfer Null.Inverse: \"{ 1 exch sub }\"" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
606 (conf-mode-initialize "*%") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
607 ;; no sections, they match within PostScript code |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
608 (setq imenu-generic-expression (list (car imenu-generic-expression)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
609 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
610 ;;;###autoload |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
611 (define-derived-mode conf-xdefaults-mode conf-colon-mode "Conf[Xdefaults]" |
58115
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
612 "Conf Mode starter for Xdefaults files. |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
613 Comments start with `!' and \"assignments\" are with `:'. |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
614 For details see `conf-mode'. Example: |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
615 |
66188
fe198c9ace5c
Don't use font-lock-defaults-alist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65261
diff
changeset
|
616 ! Conf mode font-locks this right with \\[conf-xdefaults-mode] (.Xdefaults) |
58115
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
617 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
618 *background: gray99 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
619 *foreground: black" |
66524
33e9ace34df4
(conf-mode-initialize): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66188
diff
changeset
|
620 (conf-mode-initialize "!")) |
58115
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
621 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
622 (provide 'conf-mode) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
623 |
58116
a026512a201c
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
58115
diff
changeset
|
624 ;; arch-tag: 0a3805b2-0371-4d3a-8498-8897116b2356 |
58115
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
625 ;;; conf-mode.el ends here |