Mercurial > hg > xemacs-beta
diff lisp/help.el @ 373:6240c7796c7a r21-2b2
Import from CVS: tag r21-2b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:04:06 +0200 |
parents | cc15677e0335 |
children | 8626e4521993 |
line wrap: on
line diff
--- a/lisp/help.el Mon Aug 13 11:03:09 2007 +0200 +++ b/lisp/help.el Mon Aug 13 11:04:06 2007 +0200 @@ -1416,4 +1416,25 @@ (if cmd (princ " "))))) (terpri)))))) +;; Stop gap for 21.0 untill we do help-char etc properly. +(defun help-keymap-with-help-key (keymap form) + "Return a copy of KEYMAP with an help-key binding according to help-char + invoking FORM like help-form. An existing binding is not overridden. + If FORM is nil then no binding is made." + (let ((map (copy-keymap keymap)) + (key (if (characterp help-char) + (vector (character-to-event help-char)) + help-char))) + (when (and form key (not (lookup-key map key))) + (define-key map key + `(lambda () (interactive) (help-print-help-form ,form)))) + map)) + +(defun help-print-help-form (form) + (let ((string (eval form))) + (if (stringp string) + (with-displaying-help-buffer + (insert string))))) + + ;;; help.el ends here