Mercurial > emacs
annotate lisp/textmodes/conf-mode.el @ 64987:77e9c9085af1
*** empty log message ***
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Mon, 15 Aug 2005 13:54:33 +0000 |
parents | 3a43d3e9bb74 |
children | 5e6a52548deb |
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 |
64969
3a43d3e9bb74
Fix copyright notice, list author.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
3 ;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. |
3a43d3e9bb74
Fix copyright notice, list author.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
4 |
3a43d3e9bb74
Fix copyright notice, list author.
Richard M. Stallman <rms@gnu.org>
parents:
64751
diff
changeset
|
5 ;; Author: Daniel Pfeiffer <occitan@esperanto.org> |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
6 ;; Keywords: conf ini windows java |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
7 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
9 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
13 ;; any later version. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
14 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
15 ;; 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
|
16 ;; 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
|
17 ;; 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
|
18 ;; GNU General Public License for more details. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
19 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64084 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
24 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
25 ;;; Commentary: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
26 ;; |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
27 ;; 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
|
28 ;; 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
|
29 ;; `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
|
30 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
31 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
32 ;;; Code: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
33 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
34 (require 'newcomment) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
35 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
36 ;; Variables: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
37 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
38 (defgroup conf nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
39 "Configuration files." |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
40 :group 'data |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
58694
diff
changeset
|
41 :version "22.1") |
58691
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
42 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
43 (defcustom conf-assignment-column 24 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
44 "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
|
45 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
|
46 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
|
47 :type 'integer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
48 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
49 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
50 (defcustom conf-javaprop-assignment-column 32 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
51 "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
|
52 :type 'integer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
53 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
54 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
55 (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
|
56 "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
|
57 :type 'integer |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
58 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
59 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
60 (defcustom conf-assignment-space t |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
61 "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
|
62 :type 'boolean |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
63 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
64 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
65 (defcustom conf-colon-assignment-space nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
66 "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
|
67 :type 'boolean |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
68 :group 'conf) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
69 |
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 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
72 (let ((map (make-sparse-keymap))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
73 (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
|
74 (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
|
75 (define-key map "\C-c\C-j" 'conf-javaprop-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-s" 'conf-space-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
77 (define-key map "\C-c " 'conf-space-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
78 (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
|
79 (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
|
80 (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
|
81 (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
|
82 (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
|
83 (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
|
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\C-a" 'conf-align-assignments) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
86 map) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
87 "Local keymap for conf-mode buffers.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
88 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
89 (defvar conf-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
90 (let ((table (make-syntax-table))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
91 (modify-syntax-entry ?= "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
92 (modify-syntax-entry ?_ "_" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
93 (modify-syntax-entry ?- "_" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
94 (modify-syntax-entry ?. "_" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
95 (modify-syntax-entry ?\' "\"" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
96 (modify-syntax-entry ?\; "<" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
97 (modify-syntax-entry ?\n ">" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
98 (modify-syntax-entry ?\r ">" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
99 table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
100 "Syntax table in use in Windows style conf-mode buffers.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
101 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
102 (defvar conf-unix-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
103 (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
|
104 (modify-syntax-entry ?\# "<" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
105 ;; override |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
106 (modify-syntax-entry ?\; "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
107 table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
108 "Syntax table in use in Unix style conf-mode buffers.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
109 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
110 (defvar conf-javaprop-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
111 (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
|
112 (modify-syntax-entry ?/ ". 124" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
113 (modify-syntax-entry ?* ". 23b" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
114 table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
115 "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
|
116 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
117 (defvar conf-ppd-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
118 (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
|
119 (modify-syntax-entry ?* ". 1" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
120 (modify-syntax-entry ?% ". 2" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
121 ;; override |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
122 (modify-syntax-entry ?\' "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
123 (modify-syntax-entry ?\; "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
124 table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
125 "Syntax table in use in PPD conf-mode buffers.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
126 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
127 (defvar conf-xdefaults-mode-syntax-table |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
128 (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
|
129 (modify-syntax-entry ?! "<" table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
130 ;; override |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
131 (modify-syntax-entry ?\; "." table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
132 table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
133 "Syntax table in use in Xdefaults style conf-mode buffers.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
134 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
135 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
136 (defvar conf-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
137 `(;; [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
|
138 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
139 ;; var=val or var[index]=val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
140 ("^[ \t]*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?[ \t]*=" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
141 (1 'font-lock-variable-name-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
142 (2 'font-lock-constant-face nil t)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
143 ;; section { ... } (do this last because some assign ...{...) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
144 ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
145 "Keywords to hilight in Conf mode") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
146 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
147 (defvar conf-javaprop-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
148 '(;; var=val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
149 ("^[ \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
|
150 (1 'font-lock-variable-name-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
151 (2 'font-lock-constant-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
152 (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
|
153 (4 'font-lock-constant-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
154 (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
|
155 (6 'font-lock-constant-face nil t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
156 (7 'font-lock-variable-name-face nil t))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
157 "Keywords to hilight in Conf Java Properties mode") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
158 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
159 (defvar conf-space-keywords-alist |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
160 '(("\\`/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
|
161 ("\\`/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
|
162 ("/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
|
163 ("/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
|
164 ("/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
|
165 ("/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
|
166 ("/resmgr\\.conf" . "class\\|add\\|allow\\|deny") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
167 ("/dictionary\\.lst\\'" . "DICT\\|HYPH\\|THES") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
168 ("/tuxracer/options" . "set")) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
169 "File name based settings for `conf-space-keywords'.") |
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-space-keywords nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
172 "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
|
173 This allows constructs such as |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
174 keyword var value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
175 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
|
176 `conf-space-keywords-alist'.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
177 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
178 (defvar conf-space-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
179 `(;; [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
|
180 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
181 ;; 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
|
182 ("^[ \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
|
183 ;; var val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
184 (eval if conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
185 (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
|
186 '(1 'font-lock-keyword-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
187 '(2 'font-lock-variable-name-face)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
188 '("^[ \t]*\\([^\000- ]+\\)" 1 'font-lock-variable-name-face))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
189 "Keywords to hilight in Conf Space mode") |
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-colon-font-lock-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
192 `(;; [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
|
193 ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
194 ;; var: val |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
195 ("^[ \t]*\\(.+?\\)[ \t]*:" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
196 (1 'font-lock-variable-name-face)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
197 ;; section { ... } (do this last because some assign ...{...) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
198 ("^[ \t]*\\([^:\n]+\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
199 "Keywords to hilight in Conf Colon mode") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
200 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
201 (defvar conf-assignment-sign ?= |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
202 "What sign is used for assignments.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
203 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
204 (defvar conf-assignment-regexp ".+?\\([ \t]*=[ \t]*\\)" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
205 "Regexp to recognize assignments. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
206 It is anchored after the first sexp on a line. There must a |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
207 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
|
208 whitespace.") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
209 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
210 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
211 ;; 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
|
212 ;; `align', I'd be glad to hear. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
213 (defun conf-align-assignments (&optional arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
214 (interactive "P") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
215 (setq arg (if arg |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
216 (prefix-numeric-value arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
217 conf-assignment-column)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
218 (save-excursion |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
219 (goto-char (point-min)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
220 (while (not (eobp)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
221 (let ((cs (comment-beginning))) ; go before comment if within |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
222 (if cs (goto-char cs))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
223 (while (forward-comment 9)) ; max-int? |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
224 (when (and (not (eobp)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
225 (looking-at conf-assignment-regexp)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
226 (goto-char (match-beginning 1)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
227 (delete-region (point) (match-end 1)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
228 (if conf-assignment-sign |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
229 (if (>= arg 0) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
230 (progn |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
231 (indent-to-column arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
232 (or (not conf-assignment-space) (memq (char-before (point)) '(? ?\t)) (insert ? )) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
233 (insert conf-assignment-sign (if (and conf-assignment-space (not (eolp))) ?\ ""))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
234 (insert (if conf-assignment-space ?\ "") conf-assignment-sign) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
235 (unless (eolp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
236 (indent-to-column (- arg)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
237 (or (not conf-assignment-space) (memq (char-before (point)) '(? ?\t)) (insert ? )))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
238 (unless (eolp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
239 (if (>= (current-column) (abs arg)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
240 (insert ? ) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
241 (indent-to-column (abs arg)))))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
242 (forward-line)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
243 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
244 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
245 (defun conf-quote-normal (arg) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
246 "Set the syntax of ' and \" to punctuation. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 unbalanced, but hey...)" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
254 (interactive "P") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
255 (let ((table (copy-syntax-table (syntax-table)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
256 (if (or (not arg) (= (prefix-numeric-value arg) 1)) (modify-syntax-entry ?\' "." table)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
257 (if (or (not arg) (= (prefix-numeric-value arg) 2)) (modify-syntax-entry ?\" "." table)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
258 (set-syntax-table table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
259 (and (boundp 'font-lock-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
260 font-lock-mode |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
261 (font-lock-fontify-buffer)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
262 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
263 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
264 (defun conf-outline-level () |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
265 (let ((depth 0) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
266 (pt (match-end 0))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
267 (condition-case nil |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
268 (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
|
269 depth (1+ depth))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
270 (scan-error depth)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
271 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
272 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
273 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
274 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
275 (defun conf-mode (&optional comment syntax-table name) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
276 "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
|
277 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
|
278 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
|
279 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
|
280 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
|
281 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
|
282 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
283 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
|
284 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
|
285 come out wrong, try `conf-quote-normal'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
286 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
287 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
|
288 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
|
289 constructs cannot currently be recognized. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
290 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 without breaking the general ones, are welcome. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
295 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
296 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
|
297 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
|
298 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
|
299 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
|
300 `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
|
301 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
|
302 `conf-ppd-mode' and `conf-xdefaults-mode'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
303 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
304 \\{conf-mode-map}" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
305 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
306 (interactive) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
307 (if (not comment) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
308 (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
|
309 (save-excursion |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
310 (goto-char (point-min)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
311 (while (not (eobp)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
312 (skip-chars-forward " \t\f") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
313 (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
|
314 ((eq (char-after) ?\;) (setq win (1+ win))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
315 ((eq (char-after) ?\[)) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
316 ((eolp)) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
317 ((eq (char-after) ?})) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
318 ;; recognize at most double spaces within names |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
319 ((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
320 (if (eq (char-before (match-end 0)) ?=) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
321 (setq equal (1+ equal)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
322 (setq colon (1+ colon)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
323 ((looking-at "/[/*]") (setq jp (1+ jp))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
324 ((looking-at ".*{")) ; nop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
325 ((setq space (1+ space)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
326 (forward-line))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
327 (if (> jp (max unix win 3)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
328 (conf-javaprop-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
329 (if (> colon (max equal space)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
330 (conf-colon-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
331 (if (> space (max equal colon)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
332 (conf-space-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
333 (if (or (> win unix) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
334 (and (= win unix) (eq system-type 'windows-nt))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
335 (conf-windows-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
336 (conf-unix-mode)))))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
337 (kill-all-local-variables) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
338 (use-local-map conf-mode-map) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
339 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
340 (setq major-mode 'conf-mode |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
341 mode-name name) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
342 (set (make-local-variable 'comment-start) comment) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
343 (set (make-local-variable 'comment-start-skip) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
344 (concat (regexp-quote comment-start) "+\\s *")) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
345 (set (make-local-variable 'comment-use-syntax) t) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
346 (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
|
347 (set (make-local-variable 'outline-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
348 "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
349 (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
|
350 "[\n}]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
351 (set (make-local-variable 'outline-level) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
352 'conf-outline-level) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
353 (set-syntax-table syntax-table) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
354 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
355 '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
356 ;; [section] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
357 (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
358 ;; section { ... } |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
359 (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
|
360 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
361 (run-mode-hooks 'conf-mode-hook))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
362 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
363 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
364 (defun conf-unix-mode () |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
365 "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
|
366 Comments start with `#'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
367 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
368 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
369 # Conf mode font-locks this right on Unix and with C-c C-u |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
370 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
371 \[Desktop Entry] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
372 Encoding=UTF-8 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
373 Name=The GIMP |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
374 Name[ca]=El GIMP |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
375 Name[cs]=GIMP" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
376 (interactive) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
377 (conf-mode "#" conf-unix-mode-syntax-table "Conf[Unix]")) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
378 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
379 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
380 (defun conf-windows-mode () |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
381 "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
|
382 Comments start with `;'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
383 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
384 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
385 ; Conf mode font-locks this right on Windows and with C-c C-w |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
386 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
387 \[ExtShellFolderViews] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
388 Default={5984FFE0-28D4-11CF-AE66-08002B2E1262} |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
389 {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
|
390 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
391 \[{5984FFE0-28D4-11CF-AE66-08002B2E1262}] |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
392 PersistMoniker=file://Folder.htt" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
393 (interactive) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
394 (conf-mode ";" conf-mode-syntax-table "Conf[WinIni]")) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
395 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
396 ;; 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
|
397 ;; 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
|
398 ;; 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
|
399 ;; if you need it. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
400 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
401 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
402 (defun conf-javaprop-mode () |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
403 "Conf Mode starter for Java properties files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
404 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
|
405 between `/*' and `*/'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
406 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
407 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
408 # Conf mode font-locks this right with C-c C-j (Java properties) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
409 // another kind of comment |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
410 /* yet another */ |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
411 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
412 name:value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
413 name=value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
414 name value |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
415 x.1 = |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
416 x.2.y.1.z.1 = |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
417 x.2.y.1.z.2.zz =" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
418 (interactive) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
419 (conf-mode "#" conf-javaprop-mode-syntax-table "Conf[JavaProp]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
420 (set (make-local-variable 'conf-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
421 conf-javaprop-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
422 (set (make-local-variable 'conf-assignment-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
423 ".+?\\([ \t]*[=: \t][ \t]*\\|$\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
424 (set (make-local-variable 'conf-font-lock-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
425 conf-javaprop-font-lock-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
426 (setq comment-start-skip "\\(?:#+\\|/[/*]+\\)\\s *") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
427 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
428 '(("Parameters" "^[ \t]*\\(.+?\\)[=: \t]" 1)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
429 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
430 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
431 (defun conf-space-mode (&optional keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
432 "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
|
433 \"Assignments\" are with ` '. Keywords before the parameters are |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
434 recognized according to `conf-space-keywords'. Interactively |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
435 with a prefix ARG of `0' no keywords will be recognized. With |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
436 any other prefix arg you will be prompted for a regexp to match |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
437 the keywords. Programmatically you can pass such a regexp as |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
438 KEYWORDS, or any non-nil non-string for no keywords. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
439 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
440 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
441 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
442 # Conf mode font-locks this right with C-c C-s (space separated) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
443 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
444 image/jpeg jpeg jpg jpe |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
445 image/png png |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
446 image/tiff tiff tif |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
447 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
448 # 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
|
449 class desktop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
450 # Standard multimedia devices |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
451 add /dev/audio desktop |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
452 add /dev/mixer desktop" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
453 (interactive |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
454 (list (if current-prefix-arg |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
455 (if (> (prefix-numeric-value current-prefix-arg) 0) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
456 (read-string "Regexp to match keywords: ") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
457 t)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
458 (conf-unix-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
459 (setq mode-name "Conf[Space]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
460 (set (make-local-variable 'conf-assignment-sign) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
461 nil) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
462 (set (make-local-variable 'conf-font-lock-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
463 conf-space-font-lock-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
464 ;; This doesn't seem right, but the next two depend on conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
465 ;; being set, while after-change-major-mode-hook might set up imenu, needing |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
466 ;; the following result: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
467 (hack-local-variables-prop-line) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
468 (hack-local-variables) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
469 (if keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
470 (set (make-local-variable 'conf-space-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
471 (if (stringp keywords) keywords)) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
472 (or conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
473 (not buffer-file-name) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
474 (set (make-local-variable 'conf-space-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
475 (assoc-default buffer-file-name conf-space-keywords-alist |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
476 'string-match)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
477 (set (make-local-variable 'conf-assignment-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
478 (if conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
479 (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
480 ".+?\\([ \t]+\\|$\\)")) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
481 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
482 `(,@(cdr imenu-generic-expression) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
483 ("Parameters" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
484 ,(if conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
485 (concat "^[ \t]*\\(?:" conf-space-keywords |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
486 "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
487 "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
488 1)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
489 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
490 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
491 (defun conf-colon-mode (&optional comment syntax-table name) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
492 "Conf Mode starter for Colon files. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
493 \"Assignments\" are with `:'. |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
494 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
495 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
496 # Conf mode font-locks this right with C-c C-c (colon) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
497 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
498 <Multi_key> <exclam> <exclam> : \"\\241\" exclamdown |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
499 <Multi_key> <c> <slash> : \"\\242\" cent" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
500 (interactive) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
501 (if comment |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
502 (conf-mode comment syntax-table name) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
503 (conf-unix-mode) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
504 (setq mode-name "Conf[Colon]")) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
505 (set (make-local-variable 'conf-assignment-space) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
506 conf-colon-assignment-space) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
507 (set (make-local-variable 'conf-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
508 conf-colon-assignment-column) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
509 (set (make-local-variable 'conf-assignment-sign) |
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 (set (make-local-variable 'conf-assignment-regexp) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
512 ".+?\\([ \t]*:[ \t]*\\)") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
513 (set (make-local-variable 'conf-font-lock-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
514 conf-colon-font-lock-keywords) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
515 (setq imenu-generic-expression |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
516 `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
517 ,@(cdr imenu-generic-expression)))) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
518 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
519 ;;;###autoload |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
520 (defun conf-ppd-mode () |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
521 "Conf Mode starter for Adobe/CUPS PPD files. |
58692
4867e00488dc
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58691
diff
changeset
|
522 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
|
523 For details see `conf-mode'. Example: |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
524 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
525 *% Conf mode font-locks this right with C-c C-p (PPD) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
526 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
527 *DefaultTransfer: Null |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
528 *Transfer Null.Inverse: \"{ 1 exch sub }\"" |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
529 (interactive) |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
530 (conf-colon-mode "*%" conf-ppd-mode-syntax-table "Conf[PPD]") |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
531 ;; no sections, they match within PostScript code |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
532 (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
|
533 |
e5f1fb888f0b
(conf-ppd-mode-syntax-table): New var.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
58128
diff
changeset
|
534 ;;;###autoload |
58115
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
535 (defun conf-xdefaults-mode () |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
536 "Conf Mode starter for Xdefaults files. |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
537 Comments start with `!' and \"assignments\" are with `:'. |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
538 For details see `conf-mode'. Example: |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
539 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
540 ! Conf mode font-locks this right with C-c C-x (.Xdefaults) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
541 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
542 *background: gray99 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
543 *foreground: black" |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
544 (interactive) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
545 (conf-colon-mode "!" conf-xdefaults-mode-syntax-table "Conf[Xdefaults]")) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
546 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
547 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
548 ;; font lock support |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
549 (if (boundp 'font-lock-defaults-alist) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
550 (add-to-list |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
551 'font-lock-defaults-alist |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
552 (cons 'conf-mode |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
553 (list 'conf-font-lock-keywords nil t nil nil)))) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
554 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
555 |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
556 (provide 'conf-mode) |
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
557 |
58116
a026512a201c
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
58115
diff
changeset
|
558 ;; arch-tag: 0a3805b2-0371-4d3a-8498-8897116b2356 |
58115
740fbca5078f
*** empty log message ***
Daniel Pfeiffer <occitan@esperanto.org>
parents:
diff
changeset
|
559 ;;; conf-mode.el ends here |