comparison lisp/help.el @ 90143:146c086df160

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-37 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 241-257) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 59-65) - Update from CVS - Merge from emacs--cvs-trunk--0 - (mm-string-to-multibyte): Use Gnus trunk definition.
author Miles Bader <miles@gnu.org>
date Thu, 14 Apr 2005 05:03:52 +0000
parents 13796b0653c7 a5836c00c2ae
children 08185296b491
comparison
equal deleted inserted replaced
90142:627771f44771 90143:146c086df160
584 (set-buffer (window-buffer window)) 584 (set-buffer (window-buffer window))
585 (goto-char position))) 585 (goto-char position)))
586 ;; Ok, now look up the key and name the command. 586 ;; Ok, now look up the key and name the command.
587 (let ((defn (or (string-key-binding key) 587 (let ((defn (or (string-key-binding key)
588 (key-binding key))) 588 (key-binding key)))
589 (key-desc (help-key-description key untranslated))) 589 key-desc)
590 ;; Don't bother user with strings from (e.g.) the select-paste menu.
591 (if (stringp (aref key (1- (length key))))
592 (aset key (1- (length key)) "(any string)"))
593 (if (and (> (length untranslated) 0)
594 (stringp (aref untranslated (1- (length untranslated)))))
595 (aset untranslated (1- (length untranslated))
596 "(any string)"))
597 ;; Now describe the key, perhaps as changed.
598 (setq key-desc (help-key-description key untranslated))
590 (if (or (null defn) (integerp defn) (equal defn 'undefined)) 599 (if (or (null defn) (integerp defn) (equal defn 'undefined))
591 (princ (format "%s is undefined" key-desc)) 600 (princ (format "%s is undefined" key-desc))
592 (princ (format (if (windowp window) 601 (princ (format (if (windowp window)
593 "%s at that spot runs the command %s" 602 "%s at that spot runs the command %s"
594 "%s runs the command %s") 603 "%s runs the command %s")
595 key-desc 604 key-desc
596 (if (symbolp defn) defn (prin1-to-string defn))))))))) 605 (if (symbolp defn) defn (prin1-to-string defn)))))))))
597
598 606
599 (defun describe-key (key &optional untranslated up-event) 607 (defun describe-key (key &optional untranslated up-event)
600 "Display documentation of the function invoked by KEY. 608 "Display documentation of the function invoked by KEY.
601 KEY should be a key sequence--when calling from a program, 609 KEY should be a key sequence--when calling from a program,
602 pass a string or a vector. 610 pass a string or a vector.
621 (goto-char position)) 629 (goto-char position))
622 (let ((defn (or (string-key-binding key) (key-binding key)))) 630 (let ((defn (or (string-key-binding key) (key-binding key))))
623 (if (or (null defn) (integerp defn) (equal defn 'undefined)) 631 (if (or (null defn) (integerp defn) (equal defn 'undefined))
624 (message "%s is undefined" (help-key-description key untranslated)) 632 (message "%s is undefined" (help-key-description key untranslated))
625 (help-setup-xref (list #'describe-function defn) (interactive-p)) 633 (help-setup-xref (list #'describe-function defn) (interactive-p))
634 ;; Don't bother user with strings from (e.g.) the select-paste menu.
635 (if (stringp (aref key (1- (length key))))
636 (aset key (1- (length key)) "(any string)"))
637 (if (stringp (aref untranslated (1- (length untranslated))))
638 (aset untranslated (1- (length untranslated))
639 "(any string)"))
626 (with-output-to-temp-buffer (help-buffer) 640 (with-output-to-temp-buffer (help-buffer)
627 (princ (help-key-description key untranslated)) 641 (princ (help-key-description key untranslated))
628 (if (windowp window) 642 (if (windowp window)
629 (princ " at that spot")) 643 (princ " at that spot"))
630 (princ " runs the command ") 644 (princ " runs the command ")