aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-05-02 22:29:46 -0400
committerStefan Monnier2010-05-02 22:29:46 -0400
commit56eb09046e00ac7ee6d3d3d752cb1ee664b7e062 (patch)
tree6ff481ffba16576053b3cb2a8ad24a4f66bdec4a
parent063371f2b0dc2519db3abcbe54955167bde8ca9e (diff)
downloademacs-56eb09046e00ac7ee6d3d3d752cb1ee664b7e062.tar.gz
emacs-56eb09046e00ac7ee6d3d3d752cb1ee664b7e062.zip
Use define-minor-mode where applicable.
* mh-show.el (mh-showing-mode): Move function to mh-e.el. * mh-e.el (mh-showing-mode): * url-dired.el (url-dired-minor-mode): * org-table.el (orgtbl-mode): * view.el (view-mode): * type-break.el (type-break-query-mode) (type-break-mode-line-message-mode): * textmodes/reftex.el (reftex-mode): * term/vt100.el (vt100-wide-mode): * tar-mode.el (tar-subfile-mode): * savehist.el (savehist-mode): * ibuf-ext.el (ibuffer-auto-mode): * composite.el (auto-composition-mode): * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode): Use define-minor-mode. (vhdl-mode): Use static mode-line format. (vhdl-mode-line-update): Delete. (vhdl-create-mode-menu, vhdl-activate-customizations) (vhdl-hs-minor-mode): Don't bother calling it.
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/composite.el10
-rw-r--r--lisp/ibuf-ext.el29
-rw-r--r--lisp/mh-e/ChangeLog5
-rw-r--r--lisp/mh-e/mh-e.el6
-rw-r--r--lisp/mh-e/mh-show.el10
-rw-r--r--lisp/org/ChangeLog9
-rw-r--r--lisp/org/org-table.el92
-rw-r--r--lisp/progmodes/vhdl-mode.el56
-rw-r--r--lisp/savehist.el25
-rw-r--r--lisp/tar-mode.el19
-rw-r--r--lisp/term/vt100.el14
-rw-r--r--lisp/textmodes/reftex.el40
-rw-r--r--lisp/type-break.el39
-rw-r--r--lisp/url/ChangeLog4
-rw-r--r--lisp/url/url-dired.el39
-rw-r--r--lisp/view.el21
17 files changed, 136 insertions, 301 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a7414aa2586..eb42484950f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12010-05-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 Use define-minor-mode where applicable.
4 * view.el (view-mode):
5 * type-break.el (type-break-query-mode)
6 (type-break-mode-line-message-mode):
7 * textmodes/reftex.el (reftex-mode):
8 * term/vt100.el (vt100-wide-mode):
9 * tar-mode.el (tar-subfile-mode):
10 * savehist.el (savehist-mode):
11 * ibuf-ext.el (ibuffer-auto-mode):
12 * composite.el (auto-composition-mode):
13 * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode):
14 Use define-minor-mode.
15 (vhdl-mode): Use static mode-line format.
16 (vhdl-mode-line-update): Delete.
17 (vhdl-create-mode-menu, vhdl-activate-customizations)
18 (vhdl-hs-minor-mode): Don't bother calling it.
19
12010-05-02 Stefan Monnier <monnier@iro.umontreal.ca> 202010-05-02 Stefan Monnier <monnier@iro.umontreal.ca>
2 21
3 * simple.el (with-wrapper-hook): Move. 22 * simple.el (with-wrapper-hook): Move.
diff --git a/lisp/composite.el b/lisp/composite.el
index 5b01718fc71..2b65839b93f 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -745,14 +745,13 @@ This function is the default value of `auto-composition-function' (which see)."
745 (setq func 'compose-gstring-for-terminal)) 745 (setq func 'compose-gstring-for-terminal))
746 (funcall func gstring)))) 746 (funcall func gstring))))
747 747
748(make-variable-buffer-local 'auto-composition-mode)
749(put 'auto-composition-mode 'permanent-local t) 748(put 'auto-composition-mode 'permanent-local t)
750 749
751(make-variable-buffer-local 'auto-composition-function) 750(make-variable-buffer-local 'auto-composition-function)
752(setq-default auto-composition-function 'auto-compose-chars) 751(setq-default auto-composition-function 'auto-compose-chars)
753 752
754;;;###autoload 753;;;###autoload
755(defun auto-composition-mode (&optional arg) 754(define-minor-mode auto-composition-mode
756 "Toggle Auto Composition mode. 755 "Toggle Auto Composition mode.
757With ARG, turn Auto Composition mode off if and only if ARG is a non-positive 756With ARG, turn Auto Composition mode off if and only if ARG is a non-positive
758number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto 757number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto
@@ -762,12 +761,7 @@ When Auto Composition is enabled, text characters are automatically composed
762by functions registered in `composition-function-table' (which see). 761by functions registered in `composition-function-table' (which see).
763 762
764You can use `global-auto-composition-mode' to turn on 763You can use `global-auto-composition-mode' to turn on
765Auto Composition mode in all buffers (this is the default)." 764Auto Composition mode in all buffers (this is the default).")
766 (interactive "P")
767 (setq auto-composition-mode
768 (if arg
769 (or (not (integerp arg)) (> arg 0))
770 (not auto-composition-mode))))
771 765
772;;;###autoload 766;;;###autoload
773(defun global-auto-composition-mode (&optional arg) 767(defun global-auto-composition-mode (&optional arg)
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 69eb3188862..dcea1e57472 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -91,11 +91,6 @@ regardless of any active filters in this buffer."
91(defvar ibuffer-tmp-show-regexps nil 91(defvar ibuffer-tmp-show-regexps nil
92 "A list of regexps which should match buffer names to always show.") 92 "A list of regexps which should match buffer names to always show.")
93 93
94(defvar ibuffer-auto-mode nil
95 "If non-nil, Ibuffer auto-mode should be enabled for this buffer.
96Do not set this variable directly! Use the function
97`ibuffer-auto-mode' instead.")
98
99(defvar ibuffer-auto-buffers-changed nil) 94(defvar ibuffer-auto-buffers-changed nil)
100 95
101(defcustom ibuffer-saved-filters '(("gnus" 96(defcustom ibuffer-saved-filters '(("gnus"
@@ -220,6 +215,16 @@ Currently, this only applies to `ibuffer-saved-filters' and
220 (ibuffer-included-in-filters-p buf ibuffer-filtering-qualifiers) 215 (ibuffer-included-in-filters-p buf ibuffer-filtering-qualifiers)
221 (ibuffer-buf-matches-predicates buf ibuffer-always-show-predicates))))) 216 (ibuffer-buf-matches-predicates buf ibuffer-always-show-predicates)))))
222 217
218;;;###autoload
219(define-minor-mode ibuffer-auto-mode
220 "Toggle use of Ibuffer's auto-update facility.
221With numeric ARG, enable auto-update if and only if ARG is positive."
222 nil nil nil
223 (unless (derived-mode-p 'ibuffer-mode)
224 (error "This buffer is not in Ibuffer mode"))
225 (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector
226 (add-hook 'post-command-hook 'ibuffer-auto-update-changed))
227
223(defun ibuffer-auto-update-changed () 228(defun ibuffer-auto-update-changed ()
224 (when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) 229 (when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed)
225 (dolist (buf (buffer-list)) 230 (dolist (buf (buffer-list))
@@ -230,20 +235,6 @@ Currently, this only applies to `ibuffer-saved-filters' and
230 (ibuffer-update nil t))))))) 235 (ibuffer-update nil t)))))))
231 236
232;;;###autoload 237;;;###autoload
233(defun ibuffer-auto-mode (&optional arg)
234 "Toggle use of Ibuffer's auto-update facility.
235With numeric ARG, enable auto-update if and only if ARG is positive."
236 (interactive)
237 (unless (derived-mode-p 'ibuffer-mode)
238 (error "This buffer is not in Ibuffer mode"))
239 (set (make-local-variable 'ibuffer-auto-mode)
240 (if arg
241 (plusp arg)
242 (not ibuffer-auto-mode)))
243 (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector
244 (add-hook 'post-command-hook 'ibuffer-auto-update-changed))
245
246;;;###autoload
247(defun ibuffer-mouse-filter-by-mode (event) 238(defun ibuffer-mouse-filter-by-mode (event)
248 "Enable or disable filtering by the major mode chosen via mouse." 239 "Enable or disable filtering by the major mode chosen via mouse."
249 (interactive "e") 240 (interactive "e")
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 4584aa0bbd7..8ed4279721e 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,3 +1,8 @@
12010-05-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * mh-show.el (mh-showing-mode): Move function to mh-e.el.
4 * mh-e.el (mh-showing-mode): Use define-minor-mode.
5
12010-03-24 Juanma Barranquero <lekktu@gmail.com> 62010-03-24 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * mh-scan.el (mh-scan-cmd-note-width): Doc fix. 8 * mh-scan.el (mh-scan-cmd-note-width): Doc fix.
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 3639920f514..9a2bccbc967 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -287,8 +287,10 @@ Elements have the form (SEQUENCE . MESSAGES).")
287(defvar mh-show-buffer nil 287(defvar mh-show-buffer nil
288 "Buffer that displays message for this folder.") 288 "Buffer that displays message for this folder.")
289 289
290(defvar mh-showing-mode nil 290(define-minor-mode mh-showing-mode
291 "If non-nil, show the message in a separate window.") 291 "Minor mode to show the message in a separate window."
292 ;; FIXME: maybe this should be moved to mh-show.el.
293 :lighter " Show")
292 294
293(defvar mh-view-ops nil 295(defvar mh-view-ops nil
294 "Stack of operations that change the folder view. 296 "Stack of operations that change the folder view.
diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el
index 766b6982d98..58d52205079 100644
--- a/lisp/mh-e/mh-show.el
+++ b/lisp/mh-e/mh-show.el
@@ -170,16 +170,6 @@ displayed."
170 (run-hooks 'mh-show-hook))) 170 (run-hooks 'mh-show-hook)))
171 171
172;;;###mh-autoload 172;;;###mh-autoload
173(defun mh-showing-mode (&optional arg)
174 "Change whether messages should be displayed.
175
176With ARG, display messages if ARG is positive, otherwise don't display them."
177 (setq mh-showing-mode
178 (if (null arg)
179 (not mh-showing-mode)
180 (> (prefix-numeric-value arg) 0))))
181
182;;;###mh-autoload
183(defun mh-start-of-uncleaned-message () 173(defun mh-start-of-uncleaned-message ()
184 "Position uninteresting headers off the top of the window." 174 "Position uninteresting headers off the top of the window."
185 (let ((case-fold-search t)) 175 (let ((case-fold-search t))
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index 770fd883e2c..b4675723096 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,8 +1,11 @@
12010-05-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * org-table.el (orgtbl-mode): Use define-minor-mode.
4
12010-04-10 Carsten Dominik <carsten.dominik@gmail.com> 52010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
2 6
3 * org.el (org-insert-link): Find the link buffer on visible 7 * org.el (org-insert-link): Find the link buffer on visible frames.
4 frames. 8 (org-export-latex-default-packages-alist): Hyperref must be loaded
5 (org-export-latex-default-packages-alist): hyperref must be loaded
6 late. 9 late.
7 (org-open-file): More care with the new matching for file links. 10 (org-open-file): More care with the new matching for file links.
8 11
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 24c02a658ba..98c48baf52c 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -3401,11 +3401,6 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line."
3401;; active, this binding is ignored inside tables and replaced with a 3401;; active, this binding is ignored inside tables and replaced with a
3402;; modified self-insert. 3402;; modified self-insert.
3403 3403
3404(defvar orgtbl-mode nil
3405 "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
3406table editor in arbitrary modes.")
3407(make-variable-buffer-local 'orgtbl-mode)
3408
3409(defvar orgtbl-mode-map (make-keymap) 3404(defvar orgtbl-mode-map (make-keymap)
3410 "Keymap for `orgtbl-mode'.") 3405 "Keymap for `orgtbl-mode'.")
3411 3406
@@ -3426,49 +3421,51 @@ table editor in arbitrary modes.")
3426 0 (quote 'org-table) 'prepend)) 3421 0 (quote 'org-table) 'prepend))
3427 "Extra font-lock-keywords to be added when orgtbl-mode is active.") 3422 "Extra font-lock-keywords to be added when orgtbl-mode is active.")
3428 3423
3424;; Install it as a minor mode.
3425(put 'orgtbl-mode :included t)
3426(put 'orgtbl-mode :menu-tag "Org Table Mode")
3429;;;###autoload 3427;;;###autoload
3430(defun orgtbl-mode (&optional arg) 3428(define-minor-mode orgtbl-mode
3431 "The `org-mode' table editor as a minor mode for use in other modes." 3429 "The `org-mode' table editor as a minor mode for use in other modes."
3432 (interactive) 3430 :lighter " OrgTbl" :keymap orgtbl-mode-map
3433 (org-load-modules-maybe) 3431 (org-load-modules-maybe)
3434 (if (org-mode-p) 3432 (cond
3435 ;; Exit without error, in case some hook functions calls this 3433 ((org-mode-p)
3436 ;; by accident in org-mode. 3434 ;; Exit without error, in case some hook functions calls this
3437 (message "Orgtbl-mode is not useful in org-mode, command ignored") 3435 ;; by accident in org-mode.
3438 (setq orgtbl-mode 3436 (message "Orgtbl-mode is not useful in org-mode, command ignored"))
3439 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) 3437 (orgtbl-mode
3440 (if orgtbl-mode 3438 (and (orgtbl-setup) (defun orgtbl-setup () nil)) ;; FIXME: Yuck!?!
3441 (progn 3439 ;; Make sure we are first in minor-mode-map-alist
3442 (and (orgtbl-setup) (defun orgtbl-setup () nil)) 3440 (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
3443 ;; Make sure we are first in minor-mode-map-alist 3441 ;; FIXME: maybe it should use emulation-mode-map-alists?
3444 (let ((c (assq 'orgtbl-mode minor-mode-map-alist))) 3442 (and c (setq minor-mode-map-alist
3445 (and c (setq minor-mode-map-alist 3443 (cons c (delq c minor-mode-map-alist)))))
3446 (cons c (delq c minor-mode-map-alist))))) 3444 (org-set-local (quote org-table-may-need-update) t)
3447 (org-set-local (quote org-table-may-need-update) t) 3445 (org-add-hook 'before-change-functions 'org-before-change-function
3448 (org-add-hook 'before-change-functions 'org-before-change-function 3446 nil 'local)
3449 nil 'local) 3447 (org-set-local 'org-old-auto-fill-inhibit-regexp
3450 (org-set-local 'org-old-auto-fill-inhibit-regexp 3448 auto-fill-inhibit-regexp)
3451 auto-fill-inhibit-regexp) 3449 (org-set-local 'auto-fill-inhibit-regexp
3452 (org-set-local 'auto-fill-inhibit-regexp 3450 (if auto-fill-inhibit-regexp
3453 (if auto-fill-inhibit-regexp 3451 (concat orgtbl-line-start-regexp "\\|"
3454 (concat orgtbl-line-start-regexp "\\|" 3452 auto-fill-inhibit-regexp)
3455 auto-fill-inhibit-regexp) 3453 orgtbl-line-start-regexp))
3456 orgtbl-line-start-regexp)) 3454 (org-add-to-invisibility-spec '(org-cwidth))
3457 (org-add-to-invisibility-spec '(org-cwidth)) 3455 (when (fboundp 'font-lock-add-keywords)
3458 (when (fboundp 'font-lock-add-keywords) 3456 (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
3459 (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) 3457 (org-restart-font-lock))
3460 (org-restart-font-lock)) 3458 (easy-menu-add orgtbl-mode-menu))
3461 (easy-menu-add orgtbl-mode-menu) 3459 (t
3462 (run-hooks 'orgtbl-mode-hook)) 3460 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
3463 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) 3461 (org-table-cleanup-narrow-column-properties)
3464 (org-table-cleanup-narrow-column-properties) 3462 (org-remove-from-invisibility-spec '(org-cwidth))
3465 (org-remove-from-invisibility-spec '(org-cwidth)) 3463 (remove-hook 'before-change-functions 'org-before-change-function t)
3466 (remove-hook 'before-change-functions 'org-before-change-function t) 3464 (when (fboundp 'font-lock-remove-keywords)
3467 (when (fboundp 'font-lock-remove-keywords) 3465 (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
3468 (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords) 3466 (org-restart-font-lock))
3469 (org-restart-font-lock)) 3467 (easy-menu-remove orgtbl-mode-menu)
3470 (easy-menu-remove orgtbl-mode-menu) 3468 (force-mode-line-update 'all))))
3471 (force-mode-line-update 'all))))
3472 3469
3473(defun org-table-cleanup-narrow-column-properties () 3470(defun org-table-cleanup-narrow-column-properties ()
3474 "Remove all properties related to narrow-column invisibility." 3471 "Remove all properties related to narrow-column invisibility."
@@ -3483,11 +3480,6 @@ table editor in arbitrary modes.")
3483 (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth)) 3480 (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth))
3484 (remove-text-properties s (1+ s) '(invisible t))))) 3481 (remove-text-properties s (1+ s) '(invisible t)))))
3485 3482
3486;; Install it as a minor mode.
3487(put 'orgtbl-mode :included t)
3488(put 'orgtbl-mode :menu-tag "Org Table Mode")
3489(add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map)
3490
3491(defun orgtbl-make-binding (fun n &rest keys) 3483(defun orgtbl-make-binding (fun n &rest keys)
3492 "Create a function for binding in the table minor mode. 3484 "Create a function for binding in the table minor mode.
3493FUN is the command to call inside a table. N is used to create a unique 3485FUN is the command to call inside a table. N is used to create a unique
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 1210592af18..e0c8ee404a6 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -199,21 +199,6 @@ Examples:
199 "Customizations for modes." 199 "Customizations for modes."
200 :group 'vhdl) 200 :group 'vhdl)
201 201
202(defcustom vhdl-electric-mode t
203 "*Non-nil enables electrification (automatic template generation).
204If nil, template generators can still be invoked through key bindings and
205menu. Is indicated in the modeline by \"/e\" after the mode name and can be
206toggled by `\\[vhdl-electric-mode]'."
207 :type 'boolean
208 :group 'vhdl-mode)
209
210(defcustom vhdl-stutter-mode t
211 "*Non-nil enables stuttering.
212Is indicated in the modeline by \"/s\" after the mode name and can be toggled
213by `\\[vhdl-stutter-mode]'."
214 :type 'boolean
215 :group 'vhdl-mode)
216
217(defcustom vhdl-indent-tabs-mode nil 202(defcustom vhdl-indent-tabs-mode nil
218 "*Non-nil means indentation can insert tabs. 203 "*Non-nil means indentation can insert tabs.
219Overrides local variable `indent-tabs-mode'." 204Overrides local variable `indent-tabs-mode'."
@@ -3466,13 +3451,11 @@ STRING are replaced by `-' and substrings are converted to lower case."
3466 ("Mode" 3451 ("Mode"
3467 ["Electric Mode" 3452 ["Electric Mode"
3468 (progn (customize-set-variable 'vhdl-electric-mode 3453 (progn (customize-set-variable 'vhdl-electric-mode
3469 (not vhdl-electric-mode)) 3454 (not vhdl-electric-mode)))
3470 (vhdl-mode-line-update))
3471 :style toggle :selected vhdl-electric-mode :keys "C-c C-m C-e"] 3455 :style toggle :selected vhdl-electric-mode :keys "C-c C-m C-e"]
3472 ["Stutter Mode" 3456 ["Stutter Mode"
3473 (progn (customize-set-variable 'vhdl-stutter-mode 3457 (progn (customize-set-variable 'vhdl-stutter-mode
3474 (not vhdl-stutter-mode)) 3458 (not vhdl-stutter-mode)))
3475 (vhdl-mode-line-update))
3476 :style toggle :selected vhdl-stutter-mode :keys "C-c C-m C-s"] 3459 :style toggle :selected vhdl-stutter-mode :keys "C-c C-m C-s"]
3477 ["Indent Tabs Mode" 3460 ["Indent Tabs Mode"
3478 (progn (customize-set-variable 'vhdl-indent-tabs-mode 3461 (progn (customize-set-variable 'vhdl-indent-tabs-mode
@@ -4670,7 +4653,10 @@ Key bindings:
4670 (interactive) 4653 (interactive)
4671 (kill-all-local-variables) 4654 (kill-all-local-variables)
4672 (setq major-mode 'vhdl-mode) 4655 (setq major-mode 'vhdl-mode)
4673 (setq mode-name "VHDL") 4656 (setq mode-name '("VHDL"
4657 (vhdl-electric-mode "/" (vhdl-stutter-mode "/"))
4658 (vhdl-electric-mode "e")
4659 (vhdl-stutter-mode "s")))
4674 4660
4675 ;; set maps and tables 4661 ;; set maps and tables
4676 (use-local-map vhdl-mode-map) 4662 (use-local-map vhdl-mode-map)
@@ -4737,7 +4723,6 @@ Key bindings:
4737 ;; miscellaneous 4723 ;; miscellaneous
4738 (vhdl-ps-print-init) 4724 (vhdl-ps-print-init)
4739 (vhdl-write-file-hooks-init) 4725 (vhdl-write-file-hooks-init)
4740 (vhdl-mode-line-update)
4741 (message "VHDL Mode %s.%s" vhdl-version 4726 (message "VHDL Mode %s.%s" vhdl-version
4742 (if noninteractive "" " See menu for documentation and release notes.")) 4727 (if noninteractive "" " See menu for documentation and release notes."))
4743 4728
@@ -4757,8 +4742,7 @@ Key bindings:
4757 (vhdl-write-file-hooks-init) 4742 (vhdl-write-file-hooks-init)
4758 (vhdl-update-mode-menu) 4743 (vhdl-update-mode-menu)
4759 (vhdl-hideshow-init) 4744 (vhdl-hideshow-init)
4760 (run-hooks 'menu-bar-update-hook) 4745 (run-hooks 'menu-bar-update-hook))
4761 (vhdl-mode-line-update))
4762 4746
4763(defun vhdl-write-file-hooks-init () 4747(defun vhdl-write-file-hooks-init ()
4764 "Add/remove hooks when buffer is saved." 4748 "Add/remove hooks when buffer is saved."
@@ -8055,31 +8039,15 @@ project is defined."
8055;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8039;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8056;; Enabling/disabling 8040;; Enabling/disabling
8057 8041
8058(defun vhdl-mode-line-update () 8042(define-minor-mode vhdl-electric-mode
8059 "Update the modeline string for VHDL major mode."
8060 (setq mode-name (concat "VHDL"
8061 (and (or vhdl-electric-mode vhdl-stutter-mode) "/")
8062 (and vhdl-electric-mode "e")
8063 (and vhdl-stutter-mode "s")))
8064 (force-mode-line-update t))
8065
8066(defun vhdl-electric-mode (arg)
8067 "Toggle VHDL electric mode. 8043 "Toggle VHDL electric mode.
8068Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil." 8044Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil."
8069 (interactive "P") 8045 :global t)
8070 (setq vhdl-electric-mode
8071 (cond ((or (not arg) (zerop arg)) (not vhdl-electric-mode))
8072 ((> arg 0) t) (t nil)))
8073 (vhdl-mode-line-update))
8074 8046
8075(defun vhdl-stutter-mode (arg) 8047(define-minor-mode vhdl-stutter-mode
8076 "Toggle VHDL stuttering mode. 8048 "Toggle VHDL stuttering mode.
8077Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil." 8049Turn on if ARG positive, turn off if ARG negative, toggle if ARG zero or nil."
8078 (interactive "P") 8050 :global t)
8079 (setq vhdl-stutter-mode
8080 (cond ((or (not arg) (zerop arg)) (not vhdl-stutter-mode))
8081 ((> arg 0) t) (t nil)))
8082 (vhdl-mode-line-update))
8083 8051
8084;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8052;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8085;; Stuttering 8053;; Stuttering
@@ -12533,7 +12501,7 @@ File statistics: \"%s\"\n\
12533 (add-hook 'hs-minor-mode-hook 'hs-hide-all) 12501 (add-hook 'hs-minor-mode-hook 'hs-hide-all)
12534 (remove-hook 'hs-minor-mode-hook 'hs-hide-all)) 12502 (remove-hook 'hs-minor-mode-hook 'hs-hide-all))
12535 (hs-minor-mode arg) 12503 (hs-minor-mode arg)
12536 (vhdl-mode-line-update))) ; hack to update menu bar 12504 (force-mode-line-update))) ; hack to update menu bar
12537 12505
12538 12506
12539;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12507;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/savehist.el b/lisp/savehist.el
index eebc5ec942b..15c841ac9c7 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -59,17 +59,6 @@
59 :version "22.1" 59 :version "22.1"
60 :group 'minibuffer) 60 :group 'minibuffer)
61 61
62;;;###autoload
63(defcustom savehist-mode nil
64 "Mode for automatic saving of minibuffer history.
65Set this by calling the `savehist-mode' function or using the customize
66interface."
67 :type 'boolean
68 :set (lambda (symbol value) (savehist-mode (or value 0)))
69 :initialize 'custom-initialize-default
70 :require 'savehist
71 :group 'savehist)
72
73(defcustom savehist-save-minibuffer-history t 62(defcustom savehist-save-minibuffer-history t
74 "If non-nil, save all recorded minibuffer histories. 63 "If non-nil, save all recorded minibuffer histories.
75If you want to save only specific histories, use `savehist-save-hook' to 64If you want to save only specific histories, use `savehist-save-hook' to
@@ -181,7 +170,7 @@ minibuffer history.")
181;; Functions. 170;; Functions.
182 171
183;;;###autoload 172;;;###autoload
184(defun savehist-mode (arg) 173(define-minor-mode savehist-mode
185 "Toggle savehist-mode. 174 "Toggle savehist-mode.
186Positive ARG turns on `savehist-mode'. When on, savehist-mode causes 175Positive ARG turns on `savehist-mode'. When on, savehist-mode causes
187minibuffer history to be saved periodically and when exiting Emacs. 176minibuffer history to be saved periodically and when exiting Emacs.
@@ -191,11 +180,7 @@ previous minibuffer history to be loaded from `savehist-file'.
191This mode should normally be turned on from your Emacs init file. 180This mode should normally be turned on from your Emacs init file.
192Calling it at any other time replaces your current minibuffer histories, 181Calling it at any other time replaces your current minibuffer histories,
193which is probably undesirable." 182which is probably undesirable."
194 (interactive "P") 183 :global t
195 (setq savehist-mode
196 (if (null arg)
197 (not savehist-mode)
198 (> (prefix-numeric-value arg) 0)))
199 (if (not savehist-mode) 184 (if (not savehist-mode)
200 (savehist-uninstall) 185 (savehist-uninstall)
201 (when (and (not savehist-loaded) 186 (when (and (not savehist-loaded)
@@ -214,11 +199,7 @@ which is probably undesirable."
214 (setq savehist-mode nil) 199 (setq savehist-mode nil)
215 (savehist-uninstall) 200 (savehist-uninstall)
216 (signal (car errvar) (cdr errvar))))) 201 (signal (car errvar) (cdr errvar)))))
217 (savehist-install) 202 (savehist-install)))
218 (run-hooks 'savehist-mode-hook))
219 ;; Return the new setting.
220 savehist-mode)
221(add-minor-mode 'savehist-mode "")
222 203
223(defun savehist-load () 204(defun savehist-load ()
224 "Load the variables stored in `savehist-file' and turn on `savehist-mode'. 205 "Load the variables stored in `savehist-file' and turn on `savehist-mode'.
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index f8925706337..f8b9cf09fba 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -137,7 +137,6 @@ This information is useful, but it takes screen space away from file names."
137(defvar tar-parse-info nil) 137(defvar tar-parse-info nil)
138(defvar tar-superior-buffer nil) 138(defvar tar-superior-buffer nil)
139(defvar tar-superior-descriptor nil) 139(defvar tar-superior-descriptor nil)
140(defvar tar-subfile-mode nil)
141(defvar tar-file-name-coding-system nil) 140(defvar tar-file-name-coding-system nil)
142 141
143(put 'tar-superior-buffer 'permanent-local t) 142(put 'tar-superior-buffer 'permanent-local t)
@@ -672,29 +671,21 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
672 (signal (car err) (cdr err))))) 671 (signal (car err) (cdr err)))))
673 672
674 673
675(defun tar-subfile-mode (p) 674(define-minor-mode tar-subfile-mode
676 "Minor mode for editing an element of a tar-file. 675 "Minor mode for editing an element of a tar-file.
677This mode arranges for \"saving\" this buffer to write the data 676This mode arranges for \"saving\" this buffer to write the data
678into the tar-file buffer that it came from. The changes will actually 677into the tar-file buffer that it came from. The changes will actually
679appear on disk when you save the tar-file's buffer." 678appear on disk when you save the tar-file's buffer."
680 (interactive "P") 679 ;; Don't do this, because it is redundant and wastes mode line space.
680 ;; :lighter " TarFile"
681 nil nil nil
681 (or (and (boundp 'tar-superior-buffer) tar-superior-buffer) 682 (or (and (boundp 'tar-superior-buffer) tar-superior-buffer)
682 (error "This buffer is not an element of a tar file")) 683 (error "This buffer is not an element of a tar file"))
683 ;; Don't do this, because it is redundant and wastes mode line space.
684 ;; (or (assq 'tar-subfile-mode minor-mode-alist)
685 ;; (setq minor-mode-alist (append minor-mode-alist
686 ;; (list '(tar-subfile-mode " TarFile")))))
687 (make-local-variable 'tar-subfile-mode)
688 (setq tar-subfile-mode
689 (if (null p)
690 (not tar-subfile-mode)
691 (> (prefix-numeric-value p) 0)))
692 (cond (tar-subfile-mode 684 (cond (tar-subfile-mode
693 (add-hook 'write-file-functions 'tar-subfile-save-buffer nil t) 685 (add-hook 'write-file-functions 'tar-subfile-save-buffer nil t)
694 ;; turn off auto-save. 686 ;; turn off auto-save.
695 (auto-save-mode -1) 687 (auto-save-mode -1)
696 (setq buffer-auto-save-file-name nil) 688 (setq buffer-auto-save-file-name nil))
697 (run-hooks 'tar-subfile-mode-hook))
698 (t 689 (t
699 (remove-hook 'write-file-functions 'tar-subfile-save-buffer t)))) 690 (remove-hook 'write-file-functions 'tar-subfile-save-buffer t))))
700 691
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index d0560702ac0..017c976ed51 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -41,19 +41,13 @@
41 (tty-run-terminal-initialization (selected-frame) "lk201")) 41 (tty-run-terminal-initialization (selected-frame) "lk201"))
42 42
43;;; Controlling the screen width. 43;;; Controlling the screen width.
44(defvar vt100-wide-mode (= (frame-width) 132) 44(define-minor-mode vt100-wide-mode
45 "t if vt100 is in 132-column mode.")
46
47(defun vt100-wide-mode (&optional arg)
48 "Toggle 132/80 column mode for vt100s. 45 "Toggle 132/80 column mode for vt100s.
49With positive argument, switch to 132-column mode. 46With positive argument, switch to 132-column mode.
50With negative argument, switch to 80-column mode." 47With negative argument, switch to 80-column mode."
51 (interactive "P") 48 :global t :initial-value (= (frame-width) 132)
52 (setq vt100-wide-mode 49 (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l"))
53 (if (null arg) (not vt100-wide-mode) 50 (set-frame-width terminal-frame (if vt100-wide-mode 132 80)))
54 (> (prefix-numeric-value arg) 0)))
55 (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l"))
56 (set-frame-width terminal-frame (if vt100-wide-mode 132 80)))
57 51
58;; arch-tag: 9ff41f24-a7c9-4dee-9cf2-fbaa951eb840 52;; arch-tag: 9ff41f24-a7c9-4dee-9cf2-fbaa951eb840
59;;; vt100.el ends here 53;;; vt100.el ends here
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 66dec462b83..b4b0a281ca6 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -305,10 +305,6 @@
305(defconst reftex-version "RefTeX version 4.31" 305(defconst reftex-version "RefTeX version 4.31"
306 "Version string for RefTeX.") 306 "Version string for RefTeX.")
307 307
308(defvar reftex-mode nil
309 "Determines if RefTeX mode is active.")
310(make-variable-buffer-local 'reftex-mode)
311
312(defvar reftex-mode-map (make-sparse-keymap) 308(defvar reftex-mode-map (make-sparse-keymap)
313 "Keymap for RefTeX mode.") 309 "Keymap for RefTeX mode.")
314 310
@@ -504,8 +500,10 @@
504 "Turn on RefTeX mode." 500 "Turn on RefTeX mode."
505 (reftex-mode t)) 501 (reftex-mode t))
506 502
503(put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode)))
504(put 'reftex-mode :menu-tag "RefTeX Mode")
507;;;###autoload 505;;;###autoload
508(defun reftex-mode (&optional arg) 506(define-minor-mode reftex-mode
509 "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX. 507 "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX.
510 508
511\\<reftex-mode-map>A Table of Contents of the entire (multifile) document with browsing 509\\<reftex-mode-map>A Table of Contents of the entire (multifile) document with browsing
@@ -535,11 +533,7 @@ Under X, these and other functions will also be available as `Ref' menu
535on the menu bar. 533on the menu bar.
536 534
537------------------------------------------------------------------------------" 535------------------------------------------------------------------------------"
538 536 :lighter " Ref" :keymap reftex-mode-map
539 (interactive "P")
540 (setq reftex-mode (not (or (and (null arg) reftex-mode)
541 (<= (prefix-numeric-value arg) 0))))
542
543 (if reftex-mode 537 (if reftex-mode
544 (progn 538 (progn
545 ;; Mode was turned on 539 ;; Mode was turned on
@@ -565,24 +559,10 @@ on the menu bar.
565 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) 559 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
566 (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) 560 (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
567 (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) 561 (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
568 (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib) 562 (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
569
570 (run-hooks 'reftex-mode-hook))
571 ;; Mode was turned off 563 ;; Mode was turned off
572 (easy-menu-remove reftex-mode-menu))) 564 (easy-menu-remove reftex-mode-menu)))
573 565
574(if (fboundp 'add-minor-mode)
575 ;; Use it so that we get the extras
576 (progn
577 (put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode)))
578 (put 'reftex-mode :menu-tag "RefTeX Mode")
579 (add-minor-mode 'reftex-mode " Ref" reftex-mode-map))
580 ;; The standard way
581 (unless (assoc 'reftex-mode minor-mode-alist)
582 (push '(reftex-mode " Ref") minor-mode-alist))
583 (unless (assoc 'reftex-mode minor-mode-map-alist)
584 (push (cons 'reftex-mode reftex-mode-map) minor-mode-map-alist)))
585
586(defvar reftex-docstruct-symbol) 566(defvar reftex-docstruct-symbol)
587(defun reftex-kill-buffer-hook () 567(defun reftex-kill-buffer-hook ()
588 "Save RefTeX's parse file for this buffer if the information has changed." 568 "Save RefTeX's parse file for this buffer if the information has changed."
@@ -625,11 +605,11 @@ on the menu bar.
625;;; 605;;;
626;;; Multibuffer Variables 606;;; Multibuffer Variables
627;;; 607;;;
628;;; Technical notes: These work as follows: We keep just one list 608;; Technical notes: These work as follows: We keep just one list
629;;; of labels for each master file - this can save a lot of memory. 609;; of labels for each master file - this can save a lot of memory.
630;;; `reftex-master-index-list' is an alist which connects the true file name 610;; `reftex-master-index-list' is an alist which connects the true file name
631;;; of each master file with the symbols holding the information on that 611;; of each master file with the symbols holding the information on that
632;;; document. Each buffer has local variables which point to these symbols. 612;; document. Each buffer has local variables which point to these symbols.
633 613
634;; List of variables which handle the multifile stuff. 614;; List of variables which handle the multifile stuff.
635;; This list is used to tie, untie, and reset these symbols. 615;; This list is used to tie, untie, and reset these symbols.
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 46523c22995..641215be8cf 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -152,13 +152,6 @@ guess a reasonably good pair of values for this variable."
152 :type 'sexp 152 :type 'sexp
153 :group 'type-break) 153 :group 'type-break)
154 154
155(defcustom type-break-query-mode t
156 "Non-nil means ask whether or not to prompt user for breaks.
157If so, call the function specified in the value of the variable
158`type-break-query-function' to do the asking."
159 :type 'boolean
160 :group 'type-break)
161
162(defcustom type-break-query-function 'yes-or-no-p 155(defcustom type-break-query-function 'yes-or-no-p
163 "Function to use for making query for a typing break. 156 "Function to use for making query for a typing break.
164It should take a string as an argument, the prompt. 157It should take a string as an argument, the prompt.
@@ -245,14 +238,6 @@ remove themselves after running.")
245 238
246;; Mode line frobs 239;; Mode line frobs
247 240
248(defcustom type-break-mode-line-message-mode nil
249 "Non-nil means put type-break related messages in the mode line.
250Otherwise, messages typically go in the echo area.
251
252See also `type-break-mode-line-format' and its members."
253 :type 'boolean
254 :group 'type-break)
255
256(defvar type-break-mode-line-format 241(defvar type-break-mode-line-format
257 '(type-break-mode-line-message-mode 242 '(type-break-mode-line-message-mode
258 ("" 243 (""
@@ -447,7 +432,7 @@ problems."
447 (message "Type Break mode is disabled"))))) 432 (message "Type Break mode is disabled")))))
448 type-break-mode) 433 type-break-mode)
449 434
450(defun type-break-mode-line-message-mode (&optional prefix) 435(define-minor-mode type-break-mode-line-message-mode
451 "Enable or disable warnings in the mode line about typing breaks. 436 "Enable or disable warnings in the mode line about typing breaks.
452 437
453A negative PREFIX argument disables this mode. 438A negative PREFIX argument disables this mode.
@@ -462,16 +447,9 @@ Variables controlling the display of messages in the mode line include:
462 `global-mode-string' 447 `global-mode-string'
463 `type-break-mode-line-break-message' 448 `type-break-mode-line-break-message'
464 `type-break-mode-line-warning'" 449 `type-break-mode-line-warning'"
465 (interactive "P") 450 :global t)
466 (setq type-break-mode-line-message-mode 451
467 (>= (prefix-numeric-value prefix) 0)) 452(define-minor-mode type-break-query-mode
468 (and (called-interactively-p 'interactive)
469 (if type-break-mode-line-message-mode
470 (message "type-break-mode-line-message-mode is enabled")
471 (message "type-break-mode-line-message-mode is disabled")))
472 type-break-mode-line-message-mode)
473
474(defun type-break-query-mode (&optional prefix)
475 "Enable or disable warnings in the mode line about typing breaks. 453 "Enable or disable warnings in the mode line about typing breaks.
476 454
477When enabled, the user is periodically queried about whether to take a 455When enabled, the user is periodically queried about whether to take a
@@ -483,14 +461,7 @@ No argument or any non-negative argument enables it.
483 461
484The user may also enable or disable this mode simply by setting the 462The user may also enable or disable this mode simply by setting the
485variable of the same name." 463variable of the same name."
486 (interactive "P") 464 :global t)
487 (setq type-break-query-mode
488 (>= (prefix-numeric-value prefix) 0))
489 (and (called-interactively-p 'interactive)
490 (if type-break-query-mode
491 (message "type-break-query-mode is enabled")
492 (message "type-break-query-mode is disabled")))
493 type-break-query-mode)
494 465
495 466
496;;; session file functions 467;;; session file functions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index d3231672dd2..5a79712dfae 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,7 @@
12010-05-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * url-dired.el (url-dired-minor-mode): Use define-minor-mode.
4
12010-03-24 Teodor Zlatanov <tzz@lifelogs.com> 52010-03-24 Teodor Zlatanov <tzz@lifelogs.com>
2 6
3 * url-http.el (url-http-parse-headers): Fix wrong variable name. 7 * url-http.el (url-http-parse-headers): Fix wrong variable name.
diff --git a/lisp/url/url-dired.el b/lisp/url/url-dired.el
index af2f4b202d9..143c5721b34 100644
--- a/lisp/url/url-dired.el
+++ b/lisp/url/url-dired.el
@@ -31,11 +31,6 @@
31 map) 31 map)
32 "Keymap used when browsing directories.") 32 "Keymap used when browsing directories.")
33 33
34(defvar url-dired-minor-mode nil
35 "Whether we are in url-dired-minor-mode.")
36
37(make-variable-buffer-local 'url-dired-minor-mode)
38
39(defun url-dired-find-file () 34(defun url-dired-find-file ()
40 "In dired, visit the file or directory named on this line." 35 "In dired, visit the file or directory named on this line."
41 (interactive) 36 (interactive)
@@ -48,39 +43,9 @@
48 (mouse-set-point event) 43 (mouse-set-point event)
49 (url-dired-find-file)) 44 (url-dired-find-file))
50 45
51(defun url-dired-minor-mode (&optional arg) 46(define-minor-mode url-dired-minor-mode
52 "Minor mode for directory browsing." 47 "Minor mode for directory browsing."
53 (interactive "P") 48 :lighter " URL" :keymap url-dired-minor-mode-map)
54 (cond
55 ((null arg)
56 (setq url-dired-minor-mode (not url-dired-minor-mode)))
57 ((equal 0 arg)
58 (setq url-dired-minor-mode nil))
59 (t
60 (setq url-dired-minor-mode t))))
61
62(if (not (fboundp 'add-minor-mode))
63 (defun add-minor-mode (toggle name &optional keymap after toggle-fun)
64 "Add a minor mode to `minor-mode-alist' and `minor-mode-map-alist'.
65TOGGLE is a symbol which is used as the variable which toggle the minor mode,
66NAME is the name that should appear in the modeline (it should be a string
67beginning with a space), KEYMAP is a keymap to make active when the minor
68mode is active, and AFTER is the toggling symbol used for another minor
69mode. If AFTER is non-nil, then it is used to position the new mode in the
70minor-mode alists. TOGGLE-FUN specifies an interactive function that
71is called to toggle the mode on and off; this affects what appens when
72button2 is pressed on the mode, and when button3 is pressed somewhere
73in the list of modes. If TOGGLE-FUN is nil and TOGGLE names an
74interactive function, TOGGLE is used as the toggle function.
75
76Example: (add-minor-mode 'view-minor-mode \" View\" view-mode-map)"
77 (if (not (assq toggle minor-mode-alist))
78 (setq minor-mode-alist (cons (list toggle name) minor-mode-alist)))
79 (if (and keymap (not (assq toggle minor-mode-map-alist)))
80 (setq minor-mode-map-alist (cons (cons toggle keymap)
81 minor-mode-map-alist)))))
82
83(add-minor-mode 'url-dired-minor-mode " URL" url-dired-minor-mode-map)
84 49
85(defun url-find-file-dired (dir) 50(defun url-find-file-dired (dir)
86 "\"Edit\" directory DIR, but with additional URL-friendly bindings." 51 "\"Edit\" directory DIR, but with additional URL-friendly bindings."
diff --git a/lisp/view.el b/lisp/view.el
index 7493f641b6c..f6698ae5a9f 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -161,14 +161,6 @@ that use View mode automatically.")
161 "Overlay used to display where a search operation found its match. 161 "Overlay used to display where a search operation found its match.
162This is local in each buffer, once it is used.") 162This is local in each buffer, once it is used.")
163(make-variable-buffer-local 'view-overlay) 163(make-variable-buffer-local 'view-overlay)
164
165(unless (assq 'view-mode minor-mode-alist)
166 (setq minor-mode-alist
167 (cons (list 'view-mode
168 (propertize " View"
169 'local-map mode-line-minor-mode-keymap
170 'help-echo "mouse-3: minor mode menu"))
171 minor-mode-alist)))
172 164
173;; Define keymap inside defvar to make it easier to load changes. 165;; Define keymap inside defvar to make it easier to load changes.
174;; Some redundant "less"-like key bindings below have been commented out. 166;; Some redundant "less"-like key bindings below have been commented out.
@@ -230,10 +222,6 @@ This is local in each buffer, once it is used.")
230 (define-key map "?" 'describe-mode) ; Maybe do as less instead? See above. 222 (define-key map "?" 'describe-mode) ; Maybe do as less instead? See above.
231 (define-key map "h" 'describe-mode) 223 (define-key map "h" 'describe-mode)
232 map)) 224 map))
233
234(or (assq 'view-mode minor-mode-map-alist)
235 (setq minor-mode-map-alist
236 (cons (cons 'view-mode view-mode-map) minor-mode-map-alist)))
237 225
238;;; Commands that enter or exit view mode. 226;;; Commands that enter or exit view mode.
239 227
@@ -393,7 +381,7 @@ this argument instead of explicitly setting `view-exit-action'."
393 exit-action))) 381 exit-action)))
394 382
395;;;###autoload 383;;;###autoload
396(defun view-mode (&optional arg) 384(define-minor-mode view-mode
397 ;; In the following documentation string we have to use some explicit key 385 ;; In the following documentation string we have to use some explicit key
398 ;; bindings instead of using the \\[] construction. The reason for this 386 ;; bindings instead of using the \\[] construction. The reason for this
399 ;; is that most commands have more than one key binding. 387 ;; is that most commands have more than one key binding.
@@ -473,11 +461,8 @@ If view-mode was entered from another buffer, by \\[view-buffer],
473then \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] will return to that buffer. 461then \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] will return to that buffer.
474 462
475Entry to view-mode runs the normal hook `view-mode-hook'." 463Entry to view-mode runs the normal hook `view-mode-hook'."
476 (interactive "P") 464 :lighter " View" :keymap view-mode-map
477 (unless (and arg ; Do nothing if already OK. 465 (if view-mode (view-mode-enable) (view-mode-disable)))
478 (if (> (prefix-numeric-value arg) 0) view-mode (not view-mode)))
479 (if view-mode (view-mode-disable)
480 (view-mode-enable))))
481 466
482(defun view-mode-enable () 467(defun view-mode-enable ()
483 "Turn on View mode." 468 "Turn on View mode."