changeset 13532:37fdd3664658

(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.
author Noah Friedman <friedman@splode.com>
date Mon, 13 Nov 1995 01:37:40 +0000
parents b4d9bb7adf24
children d081e1969406
files lisp/emacs-lisp/eldoc.el
diffstat 1 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/eldoc.el	Sun Nov 12 23:58:04 1995 +0000
+++ b/lisp/emacs-lisp/eldoc.el	Mon Nov 13 01:37:40 1995 +0000
@@ -11,9 +11,9 @@
 ;; LCD Archive Entry:
 ;; eldoc|Noah Friedman|friedman@prep.ai.mit.edu|
 ;; show function arglist or variable docstring in echo area|
-;; $Date$|$Revision$|~/misc/eldoc.el.gz|
+;; $Date: 1995/11/12 21:04:08 $|$Revision: 1.1 $|~/misc/eldoc.el.gz|
 
-;; $Id$
+;; $Id: eldoc.el,v 1.1 1995/11/12 21:04:08 friedman Rel friedman $
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -115,10 +115,11 @@
 ;; be printed again if necessary without reconsing.
 (defvar eldoc-last-data '(nil . nil))
 
-;; Put this minor mode on the minor-mode-alist.
-(or (assq 'eldoc-mode minor-mode-alist)
+;; Put this minor mode on the global minor-mode-alist.
+(or (assq 'eldoc-mode (default-value 'minor-mode-alist))
     (setq-default minor-mode-alist
-                  (append minor-mode-alist '((eldoc-mode " ElDoc")))))
+                  (append (default-value 'minor-mode-alist)
+                          '((eldoc-mode " ElDoc")))))
 
 
 ;;;###autoload
@@ -185,6 +186,7 @@
        ;; see what you're doing.
        (not (eq (selected-window) (minibuffer-window)))
        (sit-for eldoc-idle-delay)
+       (symbolp this-command)
        (intern-soft (symbol-name this-command) eldoc-mode-message-commands)
        (let ((current-symbol (eldoc-current-symbol))
              (current-fnsym  (eldoc-fnsym-in-current-sexp)))
@@ -284,18 +286,20 @@
          sym)))
 
 (defun eldoc-function-argstring (fn)
-  (let* ((def (eldoc-symbol-function fn))
+  (let* ((prelim-def (eldoc-symbol-function fn))
+         (def (if (eq (car-safe prelim-def) 'macro)
+                  (cdr prelim-def)
+                prelim-def))
          (arglist (cond ((null def) nil)
-                        ((compiled-function-p def)
+                        ((byte-code-function-p def)
                          (if (fboundp 'compiled-function-arglist)
                              (funcall 'compiled-function-arglist def)
-                           (car (append def nil))))
+                           (aref def 0)))
                         ((eq (car-safe def) 'lambda)
                          (nth 1 def))
                         (t t))))
     (eldoc-function-argstring-format arglist)))
 
-
 (defun eldoc-function-argstring-from-docstring (fn)
   (let ((docstring (documentation fn 'raw))
         (doc nil)
@@ -339,8 +343,18 @@
                              (match-beginning 1)
                              (match-end 1))))
 
-       ;; Some subrs have examples of usage, but they are indented.
-       ;; Actually, `setq-default' may be the only one.
+       ;; This finds the argstring for `condition-case'.
+       ;; I don't know if there are any others with the same pattern.
+       ((string-match (format "^Usage looks like \\((%s[^\n)]*)\\)\\.$" fn)
+                      docstring)
+        ;; end does not include trailing ")" sequence.
+        (setq end (- (match-end 1) 1))
+        (if (string-match " +" docstring (match-beginning 1))
+            (setq doc (substring docstring (match-end 0) end))
+          (setq doc "")))
+
+       ;; This finds the argstring for `setq-default'.
+       ;; I don't know if there are any others with the same pattern.
        ((string-match (format "^[ \t]+\\((%s[^\n)]*)\\)$" fn) docstring)
         ;; end does not include trailing ")" sequence.
         (setq end (- (match-end 1) 1))