aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Friedman1995-11-13 01:37:40 +0000
committerNoah Friedman1995-11-13 01:37:40 +0000
commitdd159a748e20e1977310e333a8e08e947a78746f (patch)
treea796fc724c1a3b7e45c7ac34c0ef9910150580b7
parent213d9a4f6ef51145a7898e5bfd87fde7332ecb11 (diff)
downloademacs-dd159a748e20e1977310e333a8e08e947a78746f.tar.gz
emacs-dd159a748e20e1977310e333a8e08e947a78746f.zip
(top level): Make sure to set global minor-mode-alist, not local one.
(eldoc-mode-print-current-symbol-info): Make sure this-command is a symbol. (eldoc-function-argstring): If fn is a macro, skip leading `macro' elt. (eldoc-function-argstring-from-docstring): Look for `condition-case' pattern.
-rw-r--r--lisp/emacs-lisp/eldoc.el36
1 files changed, 25 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index d5cddaa1626..ff9826375df 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -11,9 +11,9 @@
11;; LCD Archive Entry: 11;; LCD Archive Entry:
12;; eldoc|Noah Friedman|friedman@prep.ai.mit.edu| 12;; eldoc|Noah Friedman|friedman@prep.ai.mit.edu|
13;; show function arglist or variable docstring in echo area| 13;; show function arglist or variable docstring in echo area|
14;; $Date$|$Revision$|~/misc/eldoc.el.gz| 14;; $Date: 1995/11/12 21:04:08 $|$Revision: 1.1 $|~/misc/eldoc.el.gz|
15 15
16;; $Id$ 16;; $Id: eldoc.el,v 1.1 1995/11/12 21:04:08 friedman Rel friedman $
17 17
18;; This program is free software; you can redistribute it and/or modify 18;; This program is free software; you can redistribute it and/or modify
19;; it under the terms of the GNU General Public License as published by 19;; it under the terms of the GNU General Public License as published by
@@ -115,10 +115,11 @@ It is probably best to manipulate this data structure with the commands
115;; be printed again if necessary without reconsing. 115;; be printed again if necessary without reconsing.
116(defvar eldoc-last-data '(nil . nil)) 116(defvar eldoc-last-data '(nil . nil))
117 117
118;; Put this minor mode on the minor-mode-alist. 118;; Put this minor mode on the global minor-mode-alist.
119(or (assq 'eldoc-mode minor-mode-alist) 119(or (assq 'eldoc-mode (default-value 'minor-mode-alist))
120 (setq-default minor-mode-alist 120 (setq-default minor-mode-alist
121 (append minor-mode-alist '((eldoc-mode " ElDoc"))))) 121 (append (default-value 'minor-mode-alist)
122 '((eldoc-mode " ElDoc")))))
122 123
123 124
124;;;###autoload 125;;;###autoload
@@ -185,6 +186,7 @@ overwrite them unless it is more restrained."
185 ;; see what you're doing. 186 ;; see what you're doing.
186 (not (eq (selected-window) (minibuffer-window))) 187 (not (eq (selected-window) (minibuffer-window)))
187 (sit-for eldoc-idle-delay) 188 (sit-for eldoc-idle-delay)
189 (symbolp this-command)
188 (intern-soft (symbol-name this-command) eldoc-mode-message-commands) 190 (intern-soft (symbol-name this-command) eldoc-mode-message-commands)
189 (let ((current-symbol (eldoc-current-symbol)) 191 (let ((current-symbol (eldoc-current-symbol))
190 (current-fnsym (eldoc-fnsym-in-current-sexp))) 192 (current-fnsym (eldoc-fnsym-in-current-sexp)))
@@ -284,18 +286,20 @@ documentation string if possible."
284 sym))) 286 sym)))
285 287
286(defun eldoc-function-argstring (fn) 288(defun eldoc-function-argstring (fn)
287 (let* ((def (eldoc-symbol-function fn)) 289 (let* ((prelim-def (eldoc-symbol-function fn))
290 (def (if (eq (car-safe prelim-def) 'macro)
291 (cdr prelim-def)
292 prelim-def))
288 (arglist (cond ((null def) nil) 293 (arglist (cond ((null def) nil)
289 ((compiled-function-p def) 294 ((byte-code-function-p def)
290 (if (fboundp 'compiled-function-arglist) 295 (if (fboundp 'compiled-function-arglist)
291 (funcall 'compiled-function-arglist def) 296 (funcall 'compiled-function-arglist def)
292 (car (append def nil)))) 297 (aref def 0)))
293 ((eq (car-safe def) 'lambda) 298 ((eq (car-safe def) 'lambda)
294 (nth 1 def)) 299 (nth 1 def))
295 (t t)))) 300 (t t))))
296 (eldoc-function-argstring-format arglist))) 301 (eldoc-function-argstring-format arglist)))
297 302
298
299(defun eldoc-function-argstring-from-docstring (fn) 303(defun eldoc-function-argstring-from-docstring (fn)
300 (let ((docstring (documentation fn 'raw)) 304 (let ((docstring (documentation fn 'raw))
301 (doc nil) 305 (doc nil)
@@ -339,8 +343,18 @@ documentation string if possible."
339 (match-beginning 1) 343 (match-beginning 1)
340 (match-end 1)))) 344 (match-end 1))))
341 345
342 ;; Some subrs have examples of usage, but they are indented. 346 ;; This finds the argstring for `condition-case'.
343 ;; Actually, `setq-default' may be the only one. 347 ;; I don't know if there are any others with the same pattern.
348 ((string-match (format "^Usage looks like \\((%s[^\n)]*)\\)\\.$" fn)
349 docstring)
350 ;; end does not include trailing ")" sequence.
351 (setq end (- (match-end 1) 1))
352 (if (string-match " +" docstring (match-beginning 1))
353 (setq doc (substring docstring (match-end 0) end))
354 (setq doc "")))
355
356 ;; This finds the argstring for `setq-default'.
357 ;; I don't know if there are any others with the same pattern.
344 ((string-match (format "^[ \t]+\\((%s[^\n)]*)\\)$" fn) docstring) 358 ((string-match (format "^[ \t]+\\((%s[^\n)]*)\\)$" fn) docstring)
345 ;; end does not include trailing ")" sequence. 359 ;; end does not include trailing ")" sequence.
346 (setq end (- (match-end 1) 1)) 360 (setq end (- (match-end 1) 1))