comparison 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
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
1414 (princ (car cmd)) 1414 (princ (car cmd))
1415 (setq cmd (cdr cmd)) 1415 (setq cmd (cdr cmd))
1416 (if cmd (princ " "))))) 1416 (if cmd (princ " ")))))
1417 (terpri)))))) 1417 (terpri))))))
1418 1418
1419 ;; Stop gap for 21.0 untill we do help-char etc properly.
1420 (defun help-keymap-with-help-key (keymap form)
1421 "Return a copy of KEYMAP with an help-key binding according to help-char
1422 invoking FORM like help-form. An existing binding is not overridden.
1423 If FORM is nil then no binding is made."
1424 (let ((map (copy-keymap keymap))
1425 (key (if (characterp help-char)
1426 (vector (character-to-event help-char))
1427 help-char)))
1428 (when (and form key (not (lookup-key map key)))
1429 (define-key map key
1430 `(lambda () (interactive) (help-print-help-form ,form))))
1431 map))
1432
1433 (defun help-print-help-form (form)
1434 (let ((string (eval form)))
1435 (if (stringp string)
1436 (with-displaying-help-buffer
1437 (insert string)))))
1438
1439
1419 ;;; help.el ends here 1440 ;;; help.el ends here