diff options
author | Dave Love <fx@gnu.org> | 2000-07-16 15:27:43 +0000 |
---|---|---|
committer | Dave Love <fx@gnu.org> | 2000-07-16 15:27:43 +0000 |
commit | 8eb85b6e82ff9f0df1bed533f98968de8c3e048a (patch) | |
tree | 289dc724e4a61f0a98a7753894e9a4803b55d47f /lisp/wid-edit.el | |
parent | 0721e2f4dabf0c6db169de242cf12e779cc526e0 (diff) | |
download | emacs-8eb85b6e82ff9f0df1bed533f98968de8c3e048a.tar.gz |
(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.
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r-- | lisp/wid-edit.el | 27 |
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.") (overlay-put overlay 'keymap map) (overlay-put overlay 'face face) ;;(overlay-put overlay 'balloon-help help-echo) - (if (stringp help-echo) - (overlay-put overlay 'help-echo help-echo))) + (overlay-put overlay 'help-echo help-echo)) (widget-specify-secret widget)) (defun widget-specify-secret (field) @@ -338,8 +337,7 @@ new value.") (overlay-put overlay 'face face) (overlay-put overlay 'mouse-face widget-mouse-face)) ;;(overlay-put overlay 'balloon-help help-echo) - (if (stringp help-echo) - (overlay-put overlay 'help-echo help-echo)))) + (overlay-put overlay 'help-echo help-echo))) (defun widget-specify-sample (widget from to) "Specify sample for WIDGET between FROM and TO." @@ -1167,7 +1165,8 @@ Optional EVENT is the event that triggered the action." found (widget-apply child :validate))) found)) -(defun widget-types-convert-widget (widget) +;; Made defsubst to speed up face editor creation. +(defsubst widget-types-convert-widget (widget) "Convert :args as widget types in WIDGET." (widget-put widget :args (mapcar 'widget-convert (widget-get widget :args))) widget) @@ -3367,12 +3366,24 @@ To use this type, you must define :match or :match-alternatives." (let* ((widget (widget-at pos)) (help-echo (and widget (widget-get widget :help-echo)))) (if (or (stringp help-echo) - (and (symbolp help-echo) (fboundp help-echo) - (stringp (setq help-echo (funcall help-echo widget))))) + (and (functionp help-echo) + ;; Kluge: help-echo originally could be a function of + ;; one arg -- the widget. It is more useful in Emacs + ;; 21 to have it as a function usable also as a + ;; help-echo property, when it can sort out its own + ;; widget if necessary. Try both calling sequences + ;; (rather than messing around to get the function's + ;; arity). + (stringp + (setq help-echo + (condition-case nil + (funcall help-echo (current-buffer) (point)) + (error (funcall help-echo widget)))))) + (stringp (eval help-echo))) (message "%s" help-echo)))) ;;; The End: (provide 'wid-edit) -;; wid-edit.el ends here +;;; wid-edit.el ends here |