annotate lisp/generic.el @ 60934:439d4fa30f21

(set-locale-environment): For Mac OS X's Terminal.app, use utf-8. (set-display-table-and-terminal-coding-system): Add coding-system arg. (set-locale-environment): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 25 Mar 2005 15:41:42 +0000
parents 7160fe3a7ef1
children e2b959792f0f 4da4a09e8b1b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37058
diff changeset
1 ;;; generic.el --- defining simple major modes with comment and font-lock
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;
60595
b392b963c10b (define-generic-mode): Let generic-mode-list be a list of strings;
Lute Kamstra <lute@gnu.org>
parents: 58587
diff changeset
3 ;; Copyright (C) 1997, 1999, 2004, 2005 Free Software Foundation, Inc.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;;
21182
9049fbf96317 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 21077
diff changeset
5 ;; Author: Peter Breton <pbreton@cs.umb.edu>
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Created: Fri Sep 27 1996
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: generic, comment, font-lock
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; Purpose:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; Meta-mode to create simple major modes
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; with basic comment and font-lock support
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; Commentary:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; INTRODUCTION:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; Generic-mode is a meta-mode which can be used to define small modes
21014
e3e68c9d2e35 Several doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 21013
diff changeset
36 ;; which provide basic comment and font-lock support. These modes are
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
37 ;; intended for the many configuration files and such which are too
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
38 ;; small for a "real" mode, but still have a regular syntax, comment
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
39 ;; characters and the like.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; Each generic mode can define the following:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;;
21014
e3e68c9d2e35 Several doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 21013
diff changeset
43 ;; * List of comment-characters. The entries in this list should be
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; either a character, a one or two character string or a cons pair.
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
45 ;; If the entry is a character or a string, it is added to the
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
46 ;; mode's syntax table with `comment-start' syntax. If the entry is
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
47 ;; a cons pair, the elements of the pair are considered to be
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
48 ;; `comment-start' and `comment-end' respectively. (The latter
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
49 ;; should be nil if you want comments to end at end of line.)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
50 ;; LIMITATIONS: Emacs does not support comment strings of more than
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; two characters in length.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;;
21014
e3e68c9d2e35 Several doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 21013
diff changeset
53 ;; * List of keywords to font-lock. Each keyword should be a string.
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
54 ;; If you have additional keywords which should be highlighted in a
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
55 ;; face different from `font-lock-keyword-face', you can use the
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
56 ;; convenience function `generic-make-keywords-list' (which see),
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
57 ;; and add the result to the following list:
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
58 ;;
21014
e3e68c9d2e35 Several doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 21013
diff changeset
59 ;; * Additional expressions to font-lock. This should be a list of
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
60 ;; expressions, each of which should be of the same form as those in
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
61 ;; `font-lock-keywords'.
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
62 ;;
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; * List of regular expressions to be placed in auto-mode-alist.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; * List of functions to call to do some additional setup
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; This should pretty much cover basic functionality; if you need much
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; more than this, or you find yourself writing extensive customizations,
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; perhaps you should be writing a major mode instead!
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; LOCAL VARIABLES:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; To put a file into generic mode using local variables, use a line
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; like this in a Local Variables block:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; mode: default-generic
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; Do NOT use "mode: generic"!
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;; See also "AUTOMATICALLY ENTERING GENERIC MODE" below.
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
80 ;;
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; DEFINING NEW GENERIC MODES:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;;
21182
9049fbf96317 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 21077
diff changeset
83 ;; Use the `define-generic-mode' function to define new modes.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; For example:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;; (define-generic-mode 'foo-generic-mode
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
87 ;; (list ?%)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
88 ;; (list "keyword")
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
89 ;; nil
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
90 ;; (list "\\.FOO\\'")
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
91 ;; (list 'foo-setup-function))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;;
21182
9049fbf96317 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 21077
diff changeset
93 ;; defines a new generic-mode `foo-generic-mode', which has '%' as a
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
94 ;; comment character, and "keyword" as a keyword. When files which
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
95 ;; end in '.FOO' are loaded, Emacs will go into foo-generic-mode and
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
96 ;; call foo-setup-function. You can also use the function
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
97 ;; `foo-generic-mode' (which is interactive) to put a buffer into
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
98 ;; foo-generic-mode.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ;; AUTOMATICALLY ENTERING GENERIC MODE:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;;
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
102 ;; Generic-mode provides a hook which automatically puts a file into
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
103 ;; default-generic-mode if the first few lines of a file in
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
104 ;; fundamental mode start with a hash comment character. To disable
21182
9049fbf96317 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 21077
diff changeset
105 ;; this functionality, set the variable `generic-use-find-file-hook'
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
106 ;; to nil BEFORE loading generic-mode. See the variables
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
107 ;; `generic-lines-to-scan' and `generic-find-file-regexp' for
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
108 ;; customization options.
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
109 ;;
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; GOTCHAS:
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;;
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
112 ;; Be careful that your font-lock definitions are correct. Getting
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
113 ;; them wrong can cause Emacs to continually attempt to fontify! This
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
114 ;; problem is not specific to generic-mode.
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
115 ;;
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
21057
9b9c929675eb Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 21045
diff changeset
117 ;; Credit for suggestions, brainstorming, help with debugging:
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ;; ACorreir@pervasive-sw.com (Alfred Correira)
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
119 ;; Extensive cleanup by:
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
120 ;; Stefan Monnier (monnier+gnu/emacs@flint.cs.yale.edu)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
121 ;;
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
122 ;;; Code:
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
125 ;; Internal Variables
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127
60870
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
128 (defvar generic-font-lock-keywords nil
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
129 "Keywords for `font-lock-defaults' in a generic mode.")
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
130 (make-variable-buffer-local 'generic-font-lock-keywords)
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
131 (defvaralias 'generic-font-lock-defaults 'generic-font-lock-keywords)
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
132 (make-obsolete-variable 'generic-font-lock-defaults 'generic-font-lock-keywords "22.1")
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
134 ;;;###autoload
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
135 (defvar generic-mode-list nil
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
136 "A list of mode names for `generic-mode'.
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
137 Do not add entries to this list directly; use `define-generic-mode'
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 instead (which see).")
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
141 ;; Customization Variables
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
142 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
143
21879
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
144 (defgroup generic nil
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
145 "Define simple major modes with comment and font-lock support."
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
146 :prefix "generic-"
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
147 :group 'extensions)
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
148
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
149 (defcustom generic-use-find-file-hook t
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
150 "*If non-nil, add a hook to enter `default-generic-mode' automatically.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
151 This is done if the first few lines of a file in fundamental mode
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
152 start with a hash comment character."
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
153 :group 'generic
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
154 :type 'boolean)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
156 (defcustom generic-lines-to-scan 3
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
157 "*Number of lines that `generic-mode-find-file-hook' looks at.
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
158 Relevant when deciding whether to enter Default-Generic mode automatically.
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
159 This variable should be set to a small positive number."
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
160 :group 'generic
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
161 :type 'integer)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
163 (defcustom generic-find-file-regexp "^#"
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
164 "*Regular expression used by `generic-mode-find-file-hook'.
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
165 Files in fundamental mode whose first few lines contain a match
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
166 for this regexp, should be put into Default-Generic mode instead.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
167 The number of lines tested for the matches is specified by the
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
168 value of the variable `generic-lines-to-scan', which see."
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
169 :group 'generic
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
170 :type 'regexp)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171
36124
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
172 (defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'"
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
173 "*Regular expression used by `generic-mode-find-file-hook'.
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
174 Files whose names match this regular expression should not be put
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
175 into Default-Generic mode, even if they have lines which match
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
176 the regexp in `generic-find-file-regexp'. If the value is nil,
36124
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
177 `generic-mode-find-file-hook' does not check the file names."
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
178 :group 'generic
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
179 :type '(choice (const :tag "Don't check file names" nil) regexp))
36124
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
180
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 ;; Functions
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184
22347
f53740d7d40d *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21928
diff changeset
185 ;;;###autoload
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
186 (defmacro define-generic-mode (mode comment-list keyword-list
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
187 font-lock-list auto-mode-list
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
188 function-list &optional docstring)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
189 "Create a new generic mode MODE.
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
190
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
191 MODE is the name of the command for the generic mode; it need not
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
192 be quoted. The optional DOCSTRING is the documentation for the
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
193 mode command. If you do not supply it, a default documentation
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
194 string will be used instead.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
196 COMMENT-LIST is a list, whose entries are either a single
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
197 character, a one or two character string or a cons pair. If the
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
198 entry is a character or a string, it is added to the mode's
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
199 syntax table with `comment-start' syntax. If the entry is a cons
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
200 pair, the elements of the pair are considered to be
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
201 `comment-start' and `comment-end' respectively. (The latter
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
202 should be nil if you want comments to end at end of line.) Note
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
203 that Emacs has limitations regarding comment characters.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
205 KEYWORD-LIST is a list of keywords to highlight with
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
206 `font-lock-keyword-face'. Each keyword should be a string.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
208 FONT-LOCK-LIST is a list of additional expressions to highlight.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
209 Each entry in the list should have the same form as an entry in
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
210 `font-lock-keywords'.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
212 AUTO-MODE-LIST is a list of regular expressions to add to
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
213 `auto-mode-alist'. These regexps are added to `auto-mode-alist'
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
214 as soon as `define-generic-mode' is called.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
216 FUNCTION-LIST is a list of functions to call to do some
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
217 additional setup.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218
21014
e3e68c9d2e35 Several doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 21013
diff changeset
219 See the file generic-x.el for some examples of `define-generic-mode'."
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
220 (let* ((name-unquoted (if (eq (car-safe mode) 'quote) ; Backward compatibility.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
221 (eval mode)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
222 mode))
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
223 (name-string (symbol-name name-unquoted))
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
224 (pretty-name (capitalize (replace-regexp-in-string
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
225 "-mode\\'" "" name-string))))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
227 `(progn
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
228 ;; Add a new entry.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
229 (add-to-list 'generic-mode-list ,name-string)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
230
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
231 ;; Add it to auto-mode-alist
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
232 (dolist (re ,auto-mode-list)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
233 (add-to-list 'auto-mode-alist (cons re ',name-unquoted)))
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
234
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
235 (defun ,name-unquoted ()
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
236 ,(or docstring
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
237 (concat pretty-name " mode.\n"
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
238 "This a generic mode defined with `define-generic-mode'."))
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
239 (interactive)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
240 (generic-mode-internal ',name-unquoted ,comment-list ,keyword-list
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
241 ,font-lock-list ,function-list)))))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
243 ;;;###autoload
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
244 (defun generic-mode-internal (mode comments keywords font-lock-list funs)
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
245 "Go into the generic mode MODE."
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
246 (let* ((modename (symbol-name mode))
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
247 (generic-mode-hooks (intern (concat modename "-hook")))
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
248 (pretty-name (capitalize (replace-regexp-in-string
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
249 "-mode\\'" "" modename))))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 (kill-all-local-variables)
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
253 (setq major-mode mode
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
254 mode-name pretty-name)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
256 (generic-mode-set-comments comments)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
60870
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
258 ;; Font-lock functionality.
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
259 ;; Font-lock-defaults is always set even if there are no keywords
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 ;; or font-lock expressions, so comments can be highlighted.
60870
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
261 (setq generic-font-lock-keywords
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
262 (append
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
263 (when keywords
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
264 (list (generic-make-keywords-list keywords font-lock-keyword-face)))
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
265 font-lock-list))
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
266 (setq font-lock-defaults '(generic-font-lock-keywords nil))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 ;; Call a list of functions
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
269 (mapcar 'funcall funs)
23392
d86ad410d285 (generic-mode-with-type): Added hooks for generic-modes.
Karl Heuer <kwzh@gnu.org>
parents: 22402
diff changeset
270
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
271 (run-hooks generic-mode-hooks)))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 ;;;###autoload
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
274 (defun generic-mode (mode)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
275 "Enter generic mode MODE.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
276
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
277 Generic modes provide basic comment and font-lock functionality
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
278 for \"generic\" files. (Files which are too small to warrant their
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
279 own mode, but have comment characters, keywords, and the like.)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 To define a generic-mode, use the function `define-generic-mode'.
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
282 Some generic modes are defined in `generic-x.el'."
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (interactive
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
284 (list (completing-read "Generic mode: " generic-mode-list nil t)))
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
285 (funcall (intern mode)))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 ;;; Comment Functionality
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (defun generic-mode-set-comments (comment-list)
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 "Set up comment functionality for generic mode."
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
290 (let ((st (make-syntax-table))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
291 (chars nil)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
292 (comstyles))
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
293 (make-local-variable 'comment-start)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
294 (make-local-variable 'comment-start-skip)
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
295 (make-local-variable 'comment-end)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
297 ;; Go through all the comments
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
298 (dolist (start comment-list)
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
299 (let (end (comstyle ""))
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
300 ;; Normalize
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
301 (when (consp start)
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
302 (setq end (cdr start))
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
303 (setq start (car start)))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
304 (when (char-valid-p start) (setq start (char-to-string start)))
58473
9aacf8e5ae58 (generic-mode-set-comments): Accept an empty comment-end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57113
diff changeset
305 (cond
9aacf8e5ae58 (generic-mode-set-comments): Accept an empty comment-end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57113
diff changeset
306 ((char-valid-p end) (setq end (char-to-string end)))
9aacf8e5ae58 (generic-mode-set-comments): Accept an empty comment-end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57113
diff changeset
307 ((zerop (length end)) (setq end "\n")))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
309 ;; Setup the vars for `comment-region'
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
310 (if comment-start
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
311 ;; We have already setup a comment-style, so use style b
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
312 (progn
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
313 (setq comstyle "b")
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
314 (setq comment-start-skip
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
315 (concat comment-start-skip "\\|" (regexp-quote start) "+\\s-*")))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
316 ;; First comment-style
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
317 (setq comment-start start)
37058
a2e5f00c1254 (generic-mode-set-comments): Use "" rather than nil for comment-end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36124
diff changeset
318 (setq comment-end (if (string-equal end "\n") "" end))
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
319 (setq comment-start-skip (concat (regexp-quote start) "+\\s-*")))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
321 ;; Reuse comstyles if necessary
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
322 (setq comstyle
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
323 (or (cdr (assoc start comstyles))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
324 (cdr (assoc end comstyles))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
325 comstyle))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
326 (push (cons start comstyle) comstyles)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
327 (push (cons end comstyle) comstyles)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
329 ;; Setup the syntax table
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
330 (if (= (length start) 1)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
331 (modify-syntax-entry (string-to-char start)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
332 (concat "< " comstyle) st)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
333 (let ((c0 (elt start 0)) (c1 (elt start 1)))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
334 ;; Store the relevant info but don't update yet
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
335 (push (cons c0 (concat (cdr (assoc c0 chars)) "1")) chars)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
336 (push (cons c1 (concat (cdr (assoc c1 chars))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
337 (concat "2" comstyle))) chars)))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
338 (if (= (length end) 1)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
339 (modify-syntax-entry (string-to-char end)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
340 (concat ">" comstyle) st)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
341 (let ((c0 (elt end 0)) (c1 (elt end 1)))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
342 ;; Store the relevant info but don't update yet
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
343 (push (cons c0 (concat (cdr (assoc c0 chars))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
344 (concat "3" comstyle))) chars)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
345 (push (cons c1 (concat (cdr (assoc c1 chars)) "4")) chars)))))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
347 ;; Process the chars that were part of a 2-char comment marker
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
348 (dolist (cs (nreverse chars))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
349 (modify-syntax-entry (car cs)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
350 (concat (char-to-string (char-syntax (car cs)))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
351 " " (cdr cs))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
352 st))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
353 (set-syntax-table st)))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (defun generic-bracket-support ()
60870
92071f8a7671 (generic-font-lock-defaults): Make it obsolete.
Lute Kamstra <lute@gnu.org>
parents: 60849
diff changeset
356 "Imenu support for [KEYWORD] constructs found in INF, INI and Samba files."
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
357 (setq imenu-generic-expression
20459
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 18254
diff changeset
358 '((nil "^\\[\\(.*\\)\\]" 1))
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 18254
diff changeset
359 imenu-case-fold-search t))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 ;; This generic mode is always defined
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
362 (define-generic-mode default-generic-mode (list ?#) nil nil nil nil)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 ;; A more general solution would allow us to enter generic-mode for
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 ;; *any* comment character, but would require us to synthesize a new
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 ;; generic-mode on the fly. I think this gives us most of what we
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 ;; want.
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (defun generic-mode-find-file-hook ()
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
369 "Hook function to enter Default-Generic mode automatically.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
370
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
371 Done if the first few lines of a file in Fundamental mode start
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
372 with a match for the regexp in `generic-find-file-regexp', unless
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
373 the file's name matches the regexp which is the value of the
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
374 variable `generic-ignore-files-regexp'.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
375
36124
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
376 This hook will be installed if the variable
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
377 `generic-use-find-file-hook' is non-nil. The variable
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
378 `generic-lines-to-scan' determines the number of lines to look at."
36124
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
379 (when (and (eq major-mode 'fundamental-mode)
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
380 (or (null generic-ignore-files-regexp)
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
381 (not (string-match
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
382 generic-ignore-files-regexp
5eb6597319ec (generic-find-file-regexp): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 34814
diff changeset
383 (file-name-sans-versions buffer-file-name)))))
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
384 (save-excursion
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
385 (goto-char (point-min))
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
386 (when (re-search-forward generic-find-file-regexp
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
387 (save-excursion
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
388 (forward-line generic-lines-to-scan)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
389 (point)) t)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (goto-char (point-min))
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
391 (default-generic-mode)))))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (defun generic-mode-ini-file-find-file-hook ()
60773
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
394 "Hook function to enter Default-Generic mode automatically for INI files.
1771db839aa6 Fix commentary section. Don't require cl for compilation.
Lute Kamstra <lute@gnu.org>
parents: 60595
diff changeset
395 Done if the first few lines of a file in Fundamental mode look like an
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
396 INI file. This hook is NOT installed by default."
21077
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
397 (and (eq major-mode 'fundamental-mode)
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
398 (save-excursion
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
399 (goto-char (point-min))
4b5c8a2ce0b2 (generic-mode-ini-file-find-file-hook): Use and-s instead of if-s.
Richard M. Stallman <rms@gnu.org>
parents: 21057
diff changeset
400 (and (looking-at "^\\s-*\\[.*\\]")
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
401 (ini-generic-mode)))))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (and generic-use-find-file-hook
60902
7160fe3a7ef1 find-file-hooks -> find-file-hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60870
diff changeset
404 (add-hook 'find-file-hook 'generic-mode-find-file-hook))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405
60849
cb4033032773 (generic-make-keywords-list): Add autoload cookie.
Lute Kamstra <lute@gnu.org>
parents: 60773
diff changeset
406 ;;;###autoload
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (defun generic-make-keywords-list (keywords-list face &optional prefix suffix)
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
408 "Return a regular expression matching the specified KEYWORDS-LIST.
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 The regexp is highlighted with FACE."
32120
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
410 (unless (listp keywords-list)
c443d63bec69 * generic.el:
Peter Breton <pbreton@attbi.com>
parents: 24022
diff changeset
411 (error "Keywords argument must be a list of strings"))
57113
5bd3a1e1dfe5 Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-549
Miles Bader <miles@gnu.org>
parents: 55555
diff changeset
412 (list (concat prefix "\\_<"
21879
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
413 ;; Use an optimized regexp.
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
414 (regexp-opt keywords-list t)
57113
5bd3a1e1dfe5 Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-549
Miles Bader <miles@gnu.org>
parents: 55555
diff changeset
415 "\\_>" suffix)
21879
14316c9ecdac (generic): Added defgroup declaration.
Richard M. Stallman <rms@gnu.org>
parents: 21182
diff changeset
416 1
21928
42fa0da05721 (generic-make-keywords-list): Delete spurious paren.
Richard M. Stallman <rms@gnu.org>
parents: 21879
diff changeset
417 face))
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418
21013
adb28ace7f33 Provide generic, not generic-mode.
Richard M. Stallman <rms@gnu.org>
parents: 20459
diff changeset
419 (provide 'generic)
18254
5364d9d625b4 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420
58473
9aacf8e5ae58 (generic-mode-set-comments): Accept an empty comment-end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57113
diff changeset
421 ;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
24022
218b7edb9baf Re-write `(make-variable-buffer-local (defvar ...'
Dave Love <fx@gnu.org>
parents: 23392
diff changeset
422 ;;; generic.el ends here