Mercurial > emacs
diff lisp/savehist.el @ 108220:0b37f86b040e
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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 02 May 2010 22:29:46 -0400 |
parents | 1d1d5d9bd884 |
children | 417b1e4d63cd |
line wrap: on
line diff
--- a/lisp/savehist.el Sun May 02 19:23:42 2010 -0700 +++ b/lisp/savehist.el Sun May 02 22:29:46 2010 -0400 @@ -59,17 +59,6 @@ :version "22.1" :group 'minibuffer) -;;;###autoload -(defcustom savehist-mode nil - "Mode for automatic saving of minibuffer history. -Set this by calling the `savehist-mode' function or using the customize -interface." - :type 'boolean - :set (lambda (symbol value) (savehist-mode (or value 0))) - :initialize 'custom-initialize-default - :require 'savehist - :group 'savehist) - (defcustom savehist-save-minibuffer-history t "If non-nil, save all recorded minibuffer histories. If you want to save only specific histories, use `savehist-save-hook' to @@ -181,7 +170,7 @@ ;; Functions. ;;;###autoload -(defun savehist-mode (arg) +(define-minor-mode savehist-mode "Toggle savehist-mode. Positive ARG turns on `savehist-mode'. When on, savehist-mode causes minibuffer history to be saved periodically and when exiting Emacs. @@ -191,11 +180,7 @@ This mode should normally be turned on from your Emacs init file. Calling it at any other time replaces your current minibuffer histories, which is probably undesirable." - (interactive "P") - (setq savehist-mode - (if (null arg) - (not savehist-mode) - (> (prefix-numeric-value arg) 0))) + :global t (if (not savehist-mode) (savehist-uninstall) (when (and (not savehist-loaded) @@ -214,11 +199,7 @@ (setq savehist-mode nil) (savehist-uninstall) (signal (car errvar) (cdr errvar))))) - (savehist-install) - (run-hooks 'savehist-mode-hook)) - ;; Return the new setting. - savehist-mode) -(add-minor-mode 'savehist-mode "") + (savehist-install))) (defun savehist-load () "Load the variables stored in `savehist-file' and turn on `savehist-mode'.