/[emacs]/emacs/lisp/emacs-lisp/easy-mmode.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/easy-mmode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.61 by eliz, Sun May 8 19:38:06 2005 UTC revision 1.62 by lute, Tue May 17 15:17:18 2005 UTC
# Line 36  Line 36 
36  ;; For each mode, easy-mmode defines the following:  ;; For each mode, easy-mmode defines the following:
37  ;; <mode>      : The minor mode predicate. A buffer-local variable.  ;; <mode>      : The minor mode predicate. A buffer-local variable.
38  ;; <mode>-map  : The keymap possibly associated to <mode>.  ;; <mode>-map  : The keymap possibly associated to <mode>.
 ;; <mode>-hook : The hook run at the end of the toggle function.  
39  ;;       see `define-minor-mode' documentation  ;;       see `define-minor-mode' documentation
40  ;;  ;;
41  ;; eval  ;; eval
# Line 90  replacing its case-insensitive matches w Line 89  replacing its case-insensitive matches w
89  (defmacro define-minor-mode (mode doc &optional init-value lighter keymap &rest body)  (defmacro define-minor-mode (mode doc &optional init-value lighter keymap &rest body)
90    "Define a new minor mode MODE.    "Define a new minor mode MODE.
91  This function defines the associated control variable MODE, keymap MODE-map,  This function defines the associated control variable MODE, keymap MODE-map,
92  toggle command MODE, and hook MODE-hook.  and toggle command MODE.
93    
94  DOC is the documentation for the mode toggle command.  DOC is the documentation for the mode toggle command.
95  Optional INIT-VALUE is the initial value of the mode's variable.  Optional INIT-VALUE is the initial value of the mode's variable.
# Line 103  The above three arguments can be skipped Line 102  The above three arguments can be skipped
102  used (see below).  used (see below).
103    
104  BODY contains code that will be executed each time the mode is (dis)activated.  BODY contains code that will be executed each time the mode is (dis)activated.
105    It will be executed after any toggling but before running the hooks.    It will be executed after any toggling but before running the hook variable
106    Before the actual body code, you can write    `mode-HOOK'.
107    keyword arguments (alternating keywords and values).    Before the actual body code, you can write keyword arguments (alternating
108    These following keyword arguments are supported (other keywords    keywords and values).  These following keyword arguments are supported (other
109    will be passed to `defcustom' if the minor mode is global):    keywords will be passed to `defcustom' if the minor mode is global):
110  :group GROUP    Custom group name to use in all generated `defcustom' forms.  :group GROUP    Custom group name to use in all generated `defcustom' forms.
111                  Defaults to MODE without the possible trailing \"-mode\".                  Defaults to MODE without the possible trailing \"-mode\".
112                  Don't use this default group name unless you have written a                  Don't use this default group name unless you have written a
# Line 241  With zero or negative ARG turn mode off. Line 240  With zero or negative ARG turn mode off.
240         ;; up-to-here.         ;; up-to-here.
241         :autoload-end         :autoload-end
242    
        ;; The toggle's hook.  
        (defcustom ,hook nil  
          ,(format "Hook run at the end of function `%s'." mode-name)  
          ,@group  
          :type 'hook)  
   
243         ;; Define the minor-mode keymap.         ;; Define the minor-mode keymap.
244         ,(unless (symbolp keymap)        ;nil is also a symbol.         ,(unless (symbolp keymap)        ;nil is also a symbol.
245            `(defvar ,keymap-sym            `(defvar ,keymap-sym
# Line 323  in which `%s' turns it on." Line 316  in which `%s' turns it on."
316             (with-current-buffer buf             (with-current-buffer buf
317               (if ,global-mode (,turn-on) (when ,mode (,mode -1))))))               (if ,global-mode (,turn-on) (when ,mode (,mode -1))))))
318    
319         ;; Autoloading easy-mmode-define-global-mode         ;; Autoloading define-global-minor-mode autoloads everything
320         ;; autoloads everything up-to-here.         ;; up-to-here.
321         :autoload-end         :autoload-end
322    
323         ;; List of buffers left to process.         ;; List of buffers left to process.

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26