aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-10-04 21:49:09 +0000
committerStefan Monnier2005-10-04 21:49:09 +0000
commitc0752bdcf73a29a2ebb23d2a4a8e3f01cad9b22b (patch)
tree5344316f9a6e0dc9379e4f909929d173d0a2b7aa
parentd35b8a281b5d0ffa8ca33a4214047bc2f26d1b29 (diff)
downloademacs-c0752bdcf73a29a2ebb23d2a4a8e3f01cad9b22b.tar.gz
emacs-c0752bdcf73a29a2ebb23d2a4a8e3f01cad9b22b.zip
Move comments into docstrings.
(eldoc-message-commands): Initialize in its declaration. Add move-beginning-of-line and move-end-of-line. (eldoc-add-command, eldoc-add-command-completions) (eldoc-remove-command, eldoc-remove-command-completions): Simplify.
-rw-r--r--lisp/emacs-lisp/eldoc.el109
1 files changed, 44 insertions, 65 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 4ae8f53a981..7712ab5af1c 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -103,37 +103,37 @@ truncated to make more of the arglist or documentation string visible."
103 103
104;;; No user options below here. 104;;; No user options below here.
105 105
106;; Commands after which it is appropriate to print in the echo area. 106(defvar eldoc-message-commands-table-size 31
107;; Eldoc does not try to print function arglists, etc. after just any command, 107 "This is used by eldoc-add-command to initialize eldoc-message-commands
108;; because some commands print their own messages in the echo area and these 108as an obarray.
109;; functions would instantly overwrite them. But self-insert-command as well 109It should probably never be necessary to do so, but if you
110;; as most motion commands are good candidates. 110choose to increase the number of buckets, you must do so before loading
111;; This variable contains an obarray of symbols; do not manipulate it 111this file since the obarray is initialized at load time.
112;; directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'. 112Remember to keep it a prime number to improve hash performance.")
113(defvar eldoc-message-commands nil) 113
114 114(defconst eldoc-message-commands
115;; This is used by eldoc-add-command to initialize eldoc-message-commands 115 (make-vector eldoc-message-commands-table-size 0)
116;; as an obarray. 116 "Commands after which it is appropriate to print in the echo area.
117;; It should probably never be necessary to do so, but if you 117Eldoc does not try to print function arglists, etc. after just any command,
118;; choose to increase the number of buckets, you must do so before loading 118because some commands print their own messages in the echo area and these
119;; this file since the obarray is initialized at load time. 119functions would instantly overwrite them. But self-insert-command as well
120;; Remember to keep it a prime number to improve hash performance. 120as most motion commands are good candidates.
121(defvar eldoc-message-commands-table-size 31) 121This variable contains an obarray of symbols; do not manipulate it
122 122directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'.")
123;; Bookkeeping; elements are as follows: 123
124;; 0 - contains the last symbol read from the buffer. 124(defconst eldoc-last-data (make-vector 3 nil)
125;; 1 - contains the string last displayed in the echo area for that 125 "Bookkeeping; elements are as follows:
126;; symbol, so it can be printed again if necessary without reconsing. 126 0 - contains the last symbol read from the buffer.
127;; 2 - 'function if function args, 'variable if variable documentation. 127 1 - contains the string last displayed in the echo area for that
128(defvar eldoc-last-data (make-vector 3 nil)) 128 symbol, so it can be printed again if necessary without reconsing.
129 2 - 'function if function args, 'variable if variable documentation.")
129(defvar eldoc-last-message nil) 130(defvar eldoc-last-message nil)
130 131
131;; eldoc's timer object. 132(defvar eldoc-timer nil "eldoc's timer object.")
132(defvar eldoc-timer nil)
133 133
134;; idle time delay currently in use by timer. 134(defvar eldoc-current-idle-delay eldoc-idle-delay
135;; This is used to determine if eldoc-idle-delay is changed by the user. 135 "idle time delay currently in use by timer.
136(defvar eldoc-current-idle-delay eldoc-idle-delay) 136This is used to determine if `eldoc-idle-delay' is changed by the user.")
137 137
138 138
139;;;###autoload 139;;;###autoload
@@ -408,53 +408,32 @@ Emacs Lisp mode) that support Eldoc.")
408;; These functions do display-command table management. 408;; These functions do display-command table management.
409 409
410(defun eldoc-add-command (&rest cmds) 410(defun eldoc-add-command (&rest cmds)
411 (or eldoc-message-commands 411 (dolist (name cmds)
412 (setq eldoc-message-commands 412 (and (symbolp name)
413 (make-vector eldoc-message-commands-table-size 0))) 413 (setq name (symbol-name name)))
414 414 (set (intern name eldoc-message-commands) t)))
415 (let (name sym)
416 (while cmds
417 (setq name (car cmds))
418 (setq cmds (cdr cmds))
419
420 (cond ((symbolp name)
421 (setq sym name)
422 (setq name (symbol-name sym)))
423 ((stringp name)
424 (setq sym (intern-soft name))))
425
426 (and (symbolp sym)
427 (fboundp sym)
428 (set (intern name eldoc-message-commands) t)))))
429 415
430(defun eldoc-add-command-completions (&rest names) 416(defun eldoc-add-command-completions (&rest names)
431 (while names 417 (dolist (name names)
432 (apply 'eldoc-add-command 418 (apply 'eldoc-add-command (all-completions name obarray 'commandp))))
433 (all-completions (car names) obarray 'fboundp))
434 (setq names (cdr names))))
435 419
436(defun eldoc-remove-command (&rest cmds) 420(defun eldoc-remove-command (&rest cmds)
437 (let (name) 421 (dolist (name cmds)
438 (while cmds 422 (and (symbolp name)
439 (setq name (car cmds)) 423 (setq name (symbol-name name)))
440 (setq cmds (cdr cmds)) 424 (unintern name eldoc-message-commands)))
441
442 (and (symbolp name)
443 (setq name (symbol-name name)))
444
445 (unintern name eldoc-message-commands))))
446 425
447(defun eldoc-remove-command-completions (&rest names) 426(defun eldoc-remove-command-completions (&rest names)
448 (while names 427 (dolist (name names)
449 (apply 'eldoc-remove-command 428 (apply 'eldoc-remove-command
450 (all-completions (car names) eldoc-message-commands)) 429 (all-completions name eldoc-message-commands))))
451 (setq names (cdr names))))
452 430
453 431
454;; Prime the command list. 432;; Prime the command list.
455(eldoc-add-command-completions 433(eldoc-add-command-completions
456 "backward-" "beginning-of-" "delete-other-windows" "delete-window" 434 "backward-" "beginning-of-" "move-beginning-of-" "delete-other-windows"
457 "end-of-" "exchange-point-and-mark" "forward-" 435 "delete-window"
436 "end-of-" "move-end-of-" "exchange-point-and-mark" "forward-"
458 "indent-for-tab-command" "goto-" "mark-page" "mark-paragraph" 437 "indent-for-tab-command" "goto-" "mark-page" "mark-paragraph"
459 "mouse-set-point" "move-" "pop-global-mark" "next-" "other-window" 438 "mouse-set-point" "move-" "pop-global-mark" "next-" "other-window"
460 "previous-" "recenter" "scroll-" "self-insert-command" 439 "previous-" "recenter" "scroll-" "self-insert-command"
@@ -462,5 +441,5 @@ Emacs Lisp mode) that support Eldoc.")
462 441
463(provide 'eldoc) 442(provide 'eldoc)
464 443
465;;; arch-tag: c9a58f9d-2055-46c1-9b82-7248b71a8375 444;; arch-tag: c9a58f9d-2055-46c1-9b82-7248b71a8375
466;;; eldoc.el ends here 445;;; eldoc.el ends here