;;; eldoc.el --- Show function arglist or variable docstring in echo area -*- lexical-binding:t; -*-
-;; Copyright (C) 1996-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2015 Free Software Foundation, Inc.
;; Author: Noah Friedman <friedman@splode.com>
;; Maintainer: friedman@splode.com
;;; Code:
-(require 'help-fns) ;For fundoc-usage handling functions.
-(require 'cl-lib)
-
(defgroup eldoc nil
"Show function arglist or variable docstring in echo area."
:group 'lisp
Actually, any name of a function which takes a string as an argument and
returns another string is acceptable.
-Note that if `eldoc-documentation-function' is non-nil, this variable
-has no effect, unless the function handles it explicitly."
+Note that this variable has no effect, unless
+`eldoc-documentation-function' handles it explicitly."
:type '(radio (function-item upcase)
(function-item downcase)
function)
display in the echo area. Function or variable symbol name may be
truncated to make more of the arglist or documentation string visible.
-Note that if `eldoc-documentation-function' is non-nil, this variable
-has no effect, unless the function handles it explicitly."
+Note that this variable has no effect, unless
+`eldoc-documentation-function' handles it explicitly."
:type '(radio (const :tag "Always" t)
(const :tag "Never" nil)
(const :tag "Yes, but truncate symbol names if it will\
this file since the obarray is initialized at load time.
Remember to keep it a prime number to improve hash performance.")
-(defconst eldoc-message-commands
+(defvar eldoc-message-commands
+ ;; Don't define as `defconst' since it would then go to (read-only) purespace.
(make-vector eldoc-message-commands-table-size 0)
"Commands after which it is appropriate to print in the echo area.
ElDoc does not try to print function arglists, etc., after just any command,
directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'.")
;; Not a constant.
-(defconst eldoc-last-data (make-vector 3 nil)
+(defvar eldoc-last-data (make-vector 3 nil)
+ ;; Don't define as `defconst' since it would then go to (read-only) purespace.
"Bookkeeping; elements are as follows:
0 - contains the last symbol read from the buffer.
1 - contains the string last displayed in the echo area for variables,
or argument string for functions.
- 2 - 'function if function args, 'variable if variable documentation.")
+ 2 - `function' if function args, `variable' if variable documentation.")
+(make-obsolete-variable 'eldoc-last-data "use your own instead" "25.1")
(defvar eldoc-last-message nil)
:group 'eldoc :lighter eldoc-minor-mode-string
(setq eldoc-last-message nil)
(cond
- ((not eldoc-documentation-function)
+ ((memq eldoc-documentation-function '(nil ignore))
(message "There is no ElDoc support in this buffer")
(setq eldoc-mode nil))
(eldoc-mode
(define-minor-mode global-eldoc-mode
"Enable `eldoc-mode' in all buffers where it's applicable."
:group 'eldoc :global t
+ :initialize 'custom-initialize-delay
+ :init-value t
(setq eldoc-last-message nil)
(if global-eldoc-mode
(progn
- (when eldoc-print-after-edit
- (setq-local eldoc-message-commands (eldoc-edit-message-commands)))
(add-hook 'post-command-hook #'eldoc-schedule-timer)
(add-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area))
- (kill-local-variable 'eldoc-message-commands)
(remove-hook 'post-command-hook #'eldoc-schedule-timer)
(remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area)))
eldoc-idle-delay t
(lambda ()
(when (or eldoc-mode
- (and global-eldoc-mode eldoc-documentation-function))
+ (and global-eldoc-mode
+ (not (memq eldoc-documentation-function
+ '(nil ignore)))))
(eldoc-print-current-symbol-info))))))
;; If user has changed the idle delay, update the timer.
\f
;;;###autoload
-(defvar eldoc-documentation-function nil
+(defvar eldoc-documentation-function #'ignore
"Function to call to return doc string.
The function of no args should return a one-line string for displaying
doc about a function etc. appropriate to the context around point.