diff options
| author | Stefan Monnier | 2001-11-16 23:58:48 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-11-16 23:58:48 +0000 |
| commit | 95193cc5c48a66a85d5375f26379a89322b9243c (patch) | |
| tree | cce9b2d450a672cae0e1044502ba974912cf3e55 | |
| parent | 98cbb9fa3943d914de9099ab85fc1836f9c8c1c7 (diff) | |
| download | emacs-95193cc5c48a66a85d5375f26379a89322b9243c.tar.gz emacs-95193cc5c48a66a85d5375f26379a89322b9243c.zip | |
(eldoc-mode): Use define-minor-mode.
| -rw-r--r-- | lisp/emacs-lisp/eldoc.el | 64 |
1 files changed, 17 insertions, 47 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 54fbb896b51..4b86f0d08ec 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Keywords: extensions | 7 | ;; Keywords: extensions |
| 8 | ;; Created: 1995-10-06 | 8 | ;; Created: 1995-10-06 |
| 9 | 9 | ||
| 10 | ;; $Id: eldoc.el,v 1.17 2000/07/24 00:37:03 friedman Exp $ | 10 | ;; $Id: eldoc.el,v 1.18 2000/12/02 20:10:49 schwab Exp $ |
| 11 | 11 | ||
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| 13 | 13 | ||
| @@ -59,24 +59,6 @@ | |||
| 59 | :group 'lisp | 59 | :group 'lisp |
| 60 | :group 'extensions) | 60 | :group 'extensions) |
| 61 | 61 | ||
| 62 | ;;;###autoload | ||
| 63 | (defcustom eldoc-mode nil | ||
| 64 | "*If non-nil, show the defined parameters for the elisp function near point. | ||
| 65 | |||
| 66 | For the emacs lisp function at the beginning of the sexp which point is | ||
| 67 | within, show the defined parameters for the function in the echo area. | ||
| 68 | This information is extracted directly from the function or macro if it is | ||
| 69 | in pure lisp. If the emacs function is a subr, the parameters are obtained | ||
| 70 | from the documentation string if possible. | ||
| 71 | |||
| 72 | If point is over a documented variable, print that variable's docstring | ||
| 73 | instead. | ||
| 74 | |||
| 75 | This variable is buffer-local." | ||
| 76 | :type 'boolean | ||
| 77 | :group 'eldoc) | ||
| 78 | (make-variable-buffer-local 'eldoc-mode) | ||
| 79 | |||
| 80 | (defcustom eldoc-idle-delay 0.50 | 62 | (defcustom eldoc-idle-delay 0.50 |
| 81 | "*Number of seconds of idle time to wait before printing. | 63 | "*Number of seconds of idle time to wait before printing. |
| 82 | If user input arrives before this interval of time has elapsed after the | 64 | If user input arrives before this interval of time has elapsed after the |
| @@ -168,27 +150,23 @@ Non-nil values for this variable have no effect unless | |||
| 168 | ;; This is used to determine if eldoc-idle-delay is changed by the user. | 150 | ;; This is used to determine if eldoc-idle-delay is changed by the user. |
| 169 | (defvar eldoc-current-idle-delay eldoc-idle-delay) | 151 | (defvar eldoc-current-idle-delay eldoc-idle-delay) |
| 170 | 152 | ||
| 171 | ;; Put minor mode string on the global minor-mode-alist. | ||
| 172 | ;;;###autoload | ||
| 173 | (cond ((fboundp 'add-minor-mode) | ||
| 174 | (add-minor-mode 'eldoc-mode 'eldoc-minor-mode-string)) | ||
| 175 | ((assq 'eldoc-mode (default-value 'minor-mode-alist))) | ||
| 176 | (t | ||
| 177 | (setq-default minor-mode-alist | ||
| 178 | (append (default-value 'minor-mode-alist) | ||
| 179 | '((eldoc-mode eldoc-minor-mode-string)))))) | ||
| 180 | |||
| 181 | 153 | ||
| 182 | ;;;###autoload | 154 | ;;;###autoload |
| 183 | (defun eldoc-mode (&optional prefix) | 155 | (define-minor-mode eldoc-mode |
| 184 | "*Enable or disable eldoc mode. | 156 | "Toggle ElDoc mode on or off. |
| 185 | See documentation for the variable of the same name for more details. | 157 | Show the defined parameters for the elisp function near point. |
| 186 | 158 | ||
| 187 | If called interactively with no prefix argument, toggle current condition | 159 | For the emacs lisp function at the beginning of the sexp which point is |
| 188 | of the mode. | 160 | within, show the defined parameters for the function in the echo area. |
| 189 | If called with a positive or negative prefix argument, enable or disable | 161 | This information is extracted directly from the function or macro if it is |
| 190 | the mode, respectively." | 162 | in pure lisp. If the emacs function is a subr, the parameters are obtained |
| 191 | (interactive "P") | 163 | from the documentation string if possible. |
| 164 | |||
| 165 | If point is over a documented variable, print that variable's docstring | ||
| 166 | instead. | ||
| 167 | |||
| 168 | With prefix ARG, turn ElDoc mode on if and only if ARG is positive." | ||
| 169 | nil eldoc-minor-mode-string nil | ||
| 192 | (setq eldoc-last-message nil) | 170 | (setq eldoc-last-message nil) |
| 193 | (cond (eldoc-use-idle-timer-p | 171 | (cond (eldoc-use-idle-timer-p |
| 194 | (add-hook 'post-command-hook 'eldoc-schedule-timer) | 172 | (add-hook 'post-command-hook 'eldoc-schedule-timer) |
| @@ -205,15 +183,7 @@ the mode, respectively." | |||
| 205 | ;; quick and dirty hack for seeing if this is XEmacs | 183 | ;; quick and dirty hack for seeing if this is XEmacs |
| 206 | (and (fboundp 'display-message) | 184 | (and (fboundp 'display-message) |
| 207 | (add-hook 'pre-command-hook | 185 | (add-hook 'pre-command-hook |
| 208 | 'eldoc-pre-command-refresh-echo-area t t)))) | 186 | 'eldoc-pre-command-refresh-echo-area t t))))) |
| 209 | (setq eldoc-mode (if prefix | ||
| 210 | (>= (prefix-numeric-value prefix) 0) | ||
| 211 | (not eldoc-mode))) | ||
| 212 | (and (interactive-p) | ||
| 213 | (if eldoc-mode | ||
| 214 | (message "eldoc-mode is enabled") | ||
| 215 | (message "eldoc-mode is disabled"))) | ||
| 216 | eldoc-mode) | ||
| 217 | 187 | ||
| 218 | ;;;###autoload | 188 | ;;;###autoload |
| 219 | (defun turn-on-eldoc-mode () | 189 | (defun turn-on-eldoc-mode () |