annotate lisp/emacs-lisp/easy-mmode.el @ 24674:d0dee612f8e3

[andrewi] (dumpglyphs): On Windows NT, do output in Unicode even for ASCII, if enabled, to avoid memory allocation overhead for implicit Unicode conversion. Also, recognize that ASCII and Latin-1 have a trivial conversion to Unicode, so x_2byte_buffer lready contains the Unicode characters in that case. (construct_drag_n_drop): Remove old code that was trashing the drop location. [jasonr] (w32_write_glyphs, w32_clear_end_of_line, w32_clear_frame, clear_cursor, x_display_bar_cursor, x_display_box_cursor, x_set_window_size): Use phys_cursor_on field in frame. (do_line_dance): Updated WRT xterm.c. Use macros where possible. (dumprectangle): Take into account the width of a left-side scroll bar.
author Andrew Innes <andrewi@gnu.org>
date Sun, 02 May 1999 10:34:21 +0000
parents 80bfa3fcb7fb
children 26cd0ba03116
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18388
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; easy-mmode.el --- easy definition of minor modes.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Georges Brun-Cottan <Georges.Brun-Cottan@inria.fr>
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; any later version.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; Minor modes are useful and common. This package makes defining a
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; minor mode easy, by focusing on the writing of the minor mode
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; functionalities themselves. Moreover, this package enforces a
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; conventional naming of user interface primitives, making things
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; natural for the minor-mode end-users.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; For each mode, easy-mmode defines the following:
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; <mode> : The minor mode predicate. A buffer-local variable.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; <mode>-map : The keymap possibly associated to <mode>.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; <mode>-hook,<mode>-on-hook,<mode>-off-hook and <mode>-mode:
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; see `easy-mmode-define-minor-mode' documentation
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; eval
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; (pp (macroexpand '(easy-mmode-define-minor-mode <your-mode> <doc>)))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; to check the result before using it.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; The order in which minor modes are installed is important. Keymap
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; lookup proceeds down minor-mode-map-alist, and the order there
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; tends to be the reverse of the order in which the modes were
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; installed. Perhaps there should be a feature to let you specify
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; orderings.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;;; Code:
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 (defun easy-mmode-define-keymap (keymap-alist &optional menu-name)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 "Return a keymap builded from KEYMAP-ALIST.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 KEYMAP-ALIST must be a list of (KEYBINDING . BINDING) where
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 KEYBINDING and BINDINGS are suited as for define-key.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 optional MENU-NAME is passed to `make-sparse-keymap'."
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 (let ((keymap (make-sparse-keymap menu-name)))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 (mapcar
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (function (lambda (bind)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (define-key keymap
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 (car bind) (cdr bind))))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 keymap-alist)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 keymap))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (defmacro easy-mmode-define-toggle (mode &optional doc)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 "Define a one arg toggle mode MODE function and associated hooks.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 MODE-mode is the so defined function that toggle the mode.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 optional DOC is its associated documentation.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 Hooks are checked for run, each time MODE-mode is called.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 They run under the followings conditions:
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 MODE-hook: if the mode is toggled.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 MODE-on-hook: if the mode is on.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 MODE-off-hook: if the mode is off.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 When the mode is effectively toggled, two hooks may run.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 If so MODE-hook is guaranteed to be the first.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 \(defmacro easy-mmode-define-toggle (MODE &optional DOC)"
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (let* ((mode-name
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (if (string-match "-mode\\'" (symbol-name mode))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (symbol-name mode)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (concat (symbol-name mode) "-mode")))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (hook (intern (concat mode-name "-hook")))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (hook-on (intern (concat mode-name "-on-hook")))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (hook-off (intern (concat mode-name "-off-hook")))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (toggle (intern mode-name))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (mode toggle)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (toggle-doc (or doc
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (format "With no argument, toggle %s mode.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 With arg turn mode on.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 With zero or negative arg turn mode off"
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 mode-name))))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 `(progn
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (defvar ,hook nil
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 ,(format "Hook called when %s mode is toggled" mode-name))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (defvar ,hook-on nil
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ,(format "Hook called when %s mode is turned on" mode-name))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (defvar ,hook-off nil
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ,(format "Hook called when %s mode is turned off" mode-name))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (defun ,toggle (&optional arg)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ,toggle-doc
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (interactive "P")
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (let ((old-mode ,mode))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (setq ,mode
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (if arg
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (or (listp arg);; C-u alone
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (> (prefix-numeric-value arg) 0))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (not ,mode)))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (and ,hook
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (not (equal old-mode ,mode))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (run-hooks ',hook))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (and ,hook-on
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ,mode
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (run-hooks ',hook-on))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (and ,hook-off
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (not ,mode)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (run-hooks ',hook-off)))))))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;;;###autoload
20852
51fc8872fa32 (easy-mmode-define-minor-mode): Fix
Richard M. Stallman <rms@gnu.org>
parents: 18388
diff changeset
122 (defmacro easy-mmode-define-minor-mode (mode doc &optional init-value lighter keymap)
18388
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 "Define a new minor mode MODE.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 This function defines the associated control variable, keymap,
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 toggle command, and hooks (see `easy-mmode-define-toggle').
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 DOC is the documentation for the mode toggle command.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 Optional LIGHTER is displayed in the mode-bar when the mode is on.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 Optional KEYMAP is the default (defvar) keymap bound to the mode keymap.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 If it is a list, it is passed to `easy-mmode-define-keymap'
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 in order to build a valid keymap.
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 \(defmacro easy-mmode-define-minor-mode
20852
51fc8872fa32 (easy-mmode-define-minor-mode): Fix
Richard M. Stallman <rms@gnu.org>
parents: 18388
diff changeset
134 (MODE DOC &optional INIT-VALUE LIGHTER KEYMAP)...\)"
18388
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (let* ((mode-name (symbol-name mode))
22301
80bfa3fcb7fb (easy-mmode-define-minor-mode): Add missing format arg.
Karl Heuer <kwzh@gnu.org>
parents: 20852
diff changeset
136 (mode-doc (format "Non-nil if %s mode is enabled." mode-name))
18388
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (keymap-name (concat mode-name "-map"))
20852
51fc8872fa32 (easy-mmode-define-minor-mode): Fix
Richard M. Stallman <rms@gnu.org>
parents: 18388
diff changeset
138 (keymap-doc (format "Keymap for %s mode." mode-name)))
18388
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 `(progn
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 ;; define the switch
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (defvar ,mode ,init-value ,mode-doc)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (make-variable-buffer-local ',mode)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 ;; define the minor-mode keymap
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (defvar ,(intern keymap-name)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (cond ((and ,keymap (keymapp ,keymap))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 ,keymap)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ((listp ,keymap)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (easy-mmode-define-keymap ,keymap))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (t (error "Invalid keymap %S" ,keymap)))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 ,keymap-doc)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ;; define the toggle and the hooks
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 ,(macroexpand `(easy-mmode-define-toggle ,mode ,doc)) ; toggle and hooks
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ;; update the mode-bar
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (or (assq ',mode minor-mode-alist)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (setq minor-mode-alist
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (cons (list ',mode ,lighter) minor-mode-alist)))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ;; update the minor-mode-map
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (or (assq ',mode minor-mode-map-alist)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (setq minor-mode-map-alist
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (cons (cons ',mode ,(intern keymap-name)) minor-mode-map-alist)))) ))
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (provide 'easy-mmode)
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
7e14277c51f3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;;; easy-mmode.el ends here