comparison lisp/emacs-lisp/eldoc.el @ 101225:84ba7288e2c7

Remove leading `*' from defcustoms. (eldoc-argument-case, eldoc-echo-area-use-multiline-p) (eldoc-highlight-function-argument): Doc fix - mention effect of eldoc-documentation-function. (eldoc-message-commands-table-size, eldoc-message-commands) (eldoc-current-idle-delay, eldoc-get-fnsym-args-string): Doc fix. (eldoc-documentation-function): Mention effect on user options.
author Glenn Morris <rgm@gnu.org>
date Fri, 16 Jan 2009 03:24:54 +0000
parents a9dc0e7c3f2b
children 652c25392003
comparison
equal deleted inserted replaced
101224:9346c2b4e4eb 101225:84ba7288e2c7
53 "Show function arglist or variable docstring in echo area." 53 "Show function arglist or variable docstring in echo area."
54 :group 'lisp 54 :group 'lisp
55 :group 'extensions) 55 :group 'extensions)
56 56
57 (defcustom eldoc-idle-delay 0.50 57 (defcustom eldoc-idle-delay 0.50
58 "*Number of seconds of idle time to wait before printing. 58 "Number of seconds of idle time to wait before printing.
59 If user input arrives before this interval of time has elapsed after the 59 If user input arrives before this interval of time has elapsed after the
60 last input, no documentation will be printed. 60 last input, no documentation will be printed.
61 61
62 If this variable is set to 0, no idle time is required." 62 If this variable is set to 0, no idle time is required."
63 :type 'number 63 :type 'number
64 :group 'eldoc) 64 :group 'eldoc)
65 65
66 ;;;###autoload 66 ;;;###autoload
67 (defcustom eldoc-minor-mode-string " ElDoc" 67 (defcustom eldoc-minor-mode-string " ElDoc"
68 "*String to display in mode line when Eldoc Mode is enabled; nil for none." 68 "String to display in mode line when Eldoc Mode is enabled; nil for none."
69 :type '(choice string (const :tag "None" nil)) 69 :type '(choice string (const :tag "None" nil))
70 :group 'eldoc) 70 :group 'eldoc)
71 71
72 (defcustom eldoc-argument-case 'upcase 72 (defcustom eldoc-argument-case 'upcase
73 "Case to display argument names of functions, as a symbol. 73 "Case to display argument names of functions, as a symbol.
74 This has two preferred values: `upcase' or `downcase'. 74 This has two preferred values: `upcase' or `downcase'.
75 Actually, any name of a function which takes a string as an argument and 75 Actually, any name of a function which takes a string as an argument and
76 returns another string is acceptable." 76 returns another string is acceptable.
77
78 Note that if `eldoc-documentation-function' is non-nil, this variable
79 has no effect, unless the function handles it explicitly."
77 :type '(radio (function-item upcase) 80 :type '(radio (function-item upcase)
78 (function-item downcase) 81 (function-item downcase)
79 function) 82 function)
80 :group 'eldoc) 83 :group 'eldoc)
81 84
82 (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit 85 (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit
83 "*Allow long eldoc messages to resize echo area display. 86 "Allow long ElDoc messages to resize echo area display.
84 If value is t, never attempt to truncate messages; complete symbol name 87 If value is t, never attempt to truncate messages; complete symbol name
85 and function arglist or 1-line variable documentation will be displayed 88 and function arglist or 1-line variable documentation will be displayed
86 even if echo area must be resized to fit. 89 even if echo area must be resized to fit.
87 90
88 If value is any non-nil value other than t, symbol name may be truncated 91 If value is any non-nil value other than t, symbol name may be truncated
90 single line without resizing window. Otherwise, behavior is just like 93 single line without resizing window. Otherwise, behavior is just like
91 former case. 94 former case.
92 95
93 If value is nil, messages are always truncated to fit in a single line of 96 If value is nil, messages are always truncated to fit in a single line of
94 display in the echo area. Function or variable symbol name may be 97 display in the echo area. Function or variable symbol name may be
95 truncated to make more of the arglist or documentation string visible." 98 truncated to make more of the arglist or documentation string visible.
99
100 Note that if `eldoc-documentation-function' is non-nil, this variable
101 has no effect, unless the function handles it explicitly."
96 :type '(radio (const :tag "Always" t) 102 :type '(radio (const :tag "Always" t)
97 (const :tag "Never" nil) 103 (const :tag "Never" nil)
98 (const :tag "Yes, but truncate symbol names if it will\ 104 (const :tag "Yes, but truncate symbol names if it will\
99 enable argument list to fit on one line" truncate-sym-name-if-fit)) 105 enable argument list to fit on one line" truncate-sym-name-if-fit))
100 :group 'eldoc) 106 :group 'eldoc)
101 107
102 (defface eldoc-highlight-function-argument 108 (defface eldoc-highlight-function-argument
103 '((t (:inherit bold))) 109 '((t (:inherit bold)))
104 "Face used for the argument at point in a function's argument list." 110 "Face used for the argument at point in a function's argument list.
111 Note that if `eldoc-documentation-function' is non-nil, this face
112 has no effect, unless the function handles it explicitly."
105 :group 'eldoc) 113 :group 'eldoc)
106 114
107 ;;; No user options below here. 115 ;;; No user options below here.
108 116
109 (defvar eldoc-message-commands-table-size 31 117 (defvar eldoc-message-commands-table-size 31
110 "This is used by `eldoc-add-command' to initialize `eldoc-message-commands' 118 "Used by `eldoc-add-command' to initialize `eldoc-message-commands' obarray.
111 as an obarray.
112 It should probably never be necessary to do so, but if you 119 It should probably never be necessary to do so, but if you
113 choose to increase the number of buckets, you must do so before loading 120 choose to increase the number of buckets, you must do so before loading
114 this file since the obarray is initialized at load time. 121 this file since the obarray is initialized at load time.
115 Remember to keep it a prime number to improve hash performance.") 122 Remember to keep it a prime number to improve hash performance.")
116 123
117 (defconst eldoc-message-commands 124 (defconst eldoc-message-commands
118 (make-vector eldoc-message-commands-table-size 0) 125 (make-vector eldoc-message-commands-table-size 0)
119 "Commands after which it is appropriate to print in the echo area. 126 "Commands after which it is appropriate to print in the echo area.
120 Eldoc does not try to print function arglists, etc. after just any command, 127 Eldoc does not try to print function arglists, etc., after just any command,
121 because some commands print their own messages in the echo area and these 128 because some commands print their own messages in the echo area and these
122 functions would instantly overwrite them. But `self-insert-command' as well 129 functions would instantly overwrite them. But `self-insert-command' as well
123 as most motion commands are good candidates. 130 as most motion commands are good candidates.
124 This variable contains an obarray of symbols; do not manipulate it 131 This variable contains an obarray of symbols; do not manipulate it
125 directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'.") 132 directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'.")
130 1 - contains the string last displayed in the echo area for variables, 137 1 - contains the string last displayed in the echo area for variables,
131 or argument string for functions. 138 or argument string for functions.
132 2 - 'function if function args, 'variable if variable documentation.") 139 2 - 'function if function args, 'variable if variable documentation.")
133 (defvar eldoc-last-message nil) 140 (defvar eldoc-last-message nil)
134 141
135 (defvar eldoc-timer nil "eldoc's timer object.") 142 (defvar eldoc-timer nil "ElDoc's timer object.")
136 143
137 (defvar eldoc-current-idle-delay eldoc-idle-delay 144 (defvar eldoc-current-idle-delay eldoc-idle-delay
138 "Idle time delay currently in use by timer. 145 "Idle time delay currently in use by timer.
139 This is used to determine if `eldoc-idle-delay' is changed by the user.") 146 This is used to determine if `eldoc-idle-delay' is changed by the user.")
140 147
238 The function of no args should return a one-line string for displaying 245 The function of no args should return a one-line string for displaying
239 doc about a function etc. appropriate to the context around point. 246 doc about a function etc. appropriate to the context around point.
240 It should return nil if there's no doc appropriate for the context. 247 It should return nil if there's no doc appropriate for the context.
241 Typically doc is returned if point is on a function-like name or in its 248 Typically doc is returned if point is on a function-like name or in its
242 arg list. 249 arg list.
250
251 The result is used as is, so the function must explicitly handle
252 the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p',
253 and the face `eldoc-highlight-function-argument', if they are to have any
254 effect.
243 255
244 This variable is expected to be made buffer-local by modes (other than 256 This variable is expected to be made buffer-local by modes (other than
245 Emacs Lisp mode) that support Eldoc.") 257 Emacs Lisp mode) that support Eldoc.")
246 258
247 (defun eldoc-print-current-symbol-info () 259 (defun eldoc-print-current-symbol-info ()
273 or elsewhere, return a 1-line docstring. Calls the functions 285 or elsewhere, return a 1-line docstring. Calls the functions
274 `eldoc-function-argstring-format' and 286 `eldoc-function-argstring-format' and
275 `eldoc-highlight-function-argument' to format the result. The 287 `eldoc-highlight-function-argument' to format the result. The
276 former calls `eldoc-argument-case'; the latter gives the 288 former calls `eldoc-argument-case'; the latter gives the
277 function name `font-lock-function-name-face', and optionally 289 function name `font-lock-function-name-face', and optionally
278 highlights argument number INDEX. " 290 highlights argument number INDEX."
279 (let (args doc) 291 (let (args doc)
280 (cond ((not (and sym (symbolp sym) (fboundp sym)))) 292 (cond ((not (and sym (symbolp sym) (fboundp sym))))
281 ((and (eq sym (aref eldoc-last-data 0)) 293 ((and (eq sym (aref eldoc-last-data 0))
282 (eq 'function (aref eldoc-last-data 2))) 294 (eq 'function (aref eldoc-last-data 2)))
283 (setq doc (aref eldoc-last-data 1))) 295 (setq doc (aref eldoc-last-data 1)))