aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-11-16 23:58:48 +0000
committerStefan Monnier2001-11-16 23:58:48 +0000
commit95193cc5c48a66a85d5375f26379a89322b9243c (patch)
treecce9b2d450a672cae0e1044502ba974912cf3e55
parent98cbb9fa3943d914de9099ab85fc1836f9c8c1c7 (diff)
downloademacs-95193cc5c48a66a85d5375f26379a89322b9243c.tar.gz
emacs-95193cc5c48a66a85d5375f26379a89322b9243c.zip
(eldoc-mode): Use define-minor-mode.
-rw-r--r--lisp/emacs-lisp/eldoc.el64
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
66For the emacs lisp function at the beginning of the sexp which point is
67within, show the defined parameters for the function in the echo area.
68This information is extracted directly from the function or macro if it is
69in pure lisp. If the emacs function is a subr, the parameters are obtained
70from the documentation string if possible.
71
72If point is over a documented variable, print that variable's docstring
73instead.
74
75This 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.
82If user input arrives before this interval of time has elapsed after the 64If 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.
185See documentation for the variable of the same name for more details. 157Show the defined parameters for the elisp function near point.
186 158
187If called interactively with no prefix argument, toggle current condition 159For the emacs lisp function at the beginning of the sexp which point is
188of the mode. 160within, show the defined parameters for the function in the echo area.
189If called with a positive or negative prefix argument, enable or disable 161This information is extracted directly from the function or macro if it is
190the mode, respectively." 162in pure lisp. If the emacs function is a subr, the parameters are obtained
191 (interactive "P") 163from the documentation string if possible.
164
165If point is over a documented variable, print that variable's docstring
166instead.
167
168With 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 ()