aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-07-16 15:27:43 +0000
committerDave Love2000-07-16 15:27:43 +0000
commitaeba6f9ad3c88a093baba0444926c405ea74aca5 (patch)
tree6cbf19cd9a18e45105ef0cf7f49dd0e9aacc667b
parent06be8d32639652d092b0a2a9b270c500038d53d4 (diff)
downloademacs-aeba6f9ad3c88a093baba0444926c405ea74aca5.tar.gz
emacs-aeba6f9ad3c88a093baba0444926c405ea74aca5.zip
(widget-specify-field, widget-specify-button): Allow
non-string help-echo. (widget-types-convert-widget): Defsubst it. (widget-echo-help): Try to cope with a help-echo function of two possible sorts.
-rw-r--r--lisp/wid-edit.el27
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index dd5c3e2dd75..a4de1d35e2c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -304,8 +304,7 @@ new value.")
304 (overlay-put overlay 'keymap map) 304 (overlay-put overlay 'keymap map)
305 (overlay-put overlay 'face face) 305 (overlay-put overlay 'face face)
306 ;;(overlay-put overlay 'balloon-help help-echo) 306 ;;(overlay-put overlay 'balloon-help help-echo)
307 (if (stringp help-echo) 307 (overlay-put overlay 'help-echo help-echo))
308 (overlay-put overlay 'help-echo help-echo)))
309 (widget-specify-secret widget)) 308 (widget-specify-secret widget))
310 309
311(defun widget-specify-secret (field) 310(defun widget-specify-secret (field)
@@ -338,8 +337,7 @@ new value.")
338 (overlay-put overlay 'face face) 337 (overlay-put overlay 'face face)
339 (overlay-put overlay 'mouse-face widget-mouse-face)) 338 (overlay-put overlay 'mouse-face widget-mouse-face))
340 ;;(overlay-put overlay 'balloon-help help-echo) 339 ;;(overlay-put overlay 'balloon-help help-echo)
341 (if (stringp help-echo) 340 (overlay-put overlay 'help-echo help-echo)))
342 (overlay-put overlay 'help-echo help-echo))))
343 341
344(defun widget-specify-sample (widget from to) 342(defun widget-specify-sample (widget from to)
345 "Specify sample for WIDGET between FROM and TO." 343 "Specify sample for WIDGET between FROM and TO."
@@ -1167,7 +1165,8 @@ Optional EVENT is the event that triggered the action."
1167 found (widget-apply child :validate))) 1165 found (widget-apply child :validate)))
1168 found)) 1166 found))
1169 1167
1170(defun widget-types-convert-widget (widget) 1168;; Made defsubst to speed up face editor creation.
1169(defsubst widget-types-convert-widget (widget)
1171 "Convert :args as widget types in WIDGET." 1170 "Convert :args as widget types in WIDGET."
1172 (widget-put widget :args (mapcar 'widget-convert (widget-get widget :args))) 1171 (widget-put widget :args (mapcar 'widget-convert (widget-get widget :args)))
1173 widget) 1172 widget)
@@ -3367,12 +3366,24 @@ To use this type, you must define :match or :match-alternatives."
3367 (let* ((widget (widget-at pos)) 3366 (let* ((widget (widget-at pos))
3368 (help-echo (and widget (widget-get widget :help-echo)))) 3367 (help-echo (and widget (widget-get widget :help-echo))))
3369 (if (or (stringp help-echo) 3368 (if (or (stringp help-echo)
3370 (and (symbolp help-echo) (fboundp help-echo) 3369 (and (functionp help-echo)
3371 (stringp (setq help-echo (funcall help-echo widget))))) 3370 ;; Kluge: help-echo originally could be a function of
3371 ;; one arg -- the widget. It is more useful in Emacs
3372 ;; 21 to have it as a function usable also as a
3373 ;; help-echo property, when it can sort out its own
3374 ;; widget if necessary. Try both calling sequences
3375 ;; (rather than messing around to get the function's
3376 ;; arity).
3377 (stringp
3378 (setq help-echo
3379 (condition-case nil
3380 (funcall help-echo (current-buffer) (point))
3381 (error (funcall help-echo widget))))))
3382 (stringp (eval help-echo)))
3372 (message "%s" help-echo)))) 3383 (message "%s" help-echo))))
3373 3384
3374;;; The End: 3385;;; The End:
3375 3386
3376(provide 'wid-edit) 3387(provide 'wid-edit)
3377 3388
3378;; wid-edit.el ends here 3389;;; wid-edit.el ends here