Mercurial > emacs
comparison lisp/help.el @ 57709:fd2c192afcd3
(describe-key): Describe both down-event and up-event
for a mouse click.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 26 Oct 2004 12:59:44 +0000 |
parents | 289e10822308 |
children | 9af430d690ed 0fe073a08cef |
comparison
equal
deleted
inserted
replaced
57708:012a0b5cf591 | 57709:fd2c192afcd3 |
---|---|
571 "%s runs the command %s") | 571 "%s runs the command %s") |
572 key-desc | 572 key-desc |
573 (if (symbolp defn) defn (prin1-to-string defn))))))))) | 573 (if (symbolp defn) defn (prin1-to-string defn))))))))) |
574 | 574 |
575 | 575 |
576 (defun describe-key (key &optional untranslated) | 576 (defun describe-key (key &optional untranslated up-event) |
577 "Display documentation of the function invoked by KEY. | 577 "Display documentation of the function invoked by KEY. |
578 KEY should be a key sequence--when calling from a program, | 578 KEY should be a key sequence--when calling from a program, |
579 pass a string or a vector. | 579 pass a string or a vector. |
580 If non-nil UNTRANSLATED is a vector of the untranslated events. | 580 If non-nil UNTRANSLATED is a vector of the untranslated events. |
581 It can also be a number in which case the untranslated events from | 581 It can also be a number in which case the untranslated events from |
582 the last key hit are used." | 582 the last key hit are used." |
583 (interactive "kDescribe key: \np") | 583 (interactive "kDescribe key: \np\nU") |
584 (if (numberp untranslated) | 584 (if (numberp untranslated) |
585 (setq untranslated (this-single-command-raw-keys))) | 585 (setq untranslated (this-single-command-raw-keys))) |
586 (save-excursion | 586 (save-excursion |
587 (let ((modifiers (event-modifiers (aref key 0))) | 587 (let ((modifiers (event-modifiers (aref key 0))) |
588 window position) | 588 window position) |
606 (princ " at that spot")) | 606 (princ " at that spot")) |
607 (princ " runs the command ") | 607 (princ " runs the command ") |
608 (prin1 defn) | 608 (prin1 defn) |
609 (princ "\n which is ") | 609 (princ "\n which is ") |
610 (describe-function-1 defn) | 610 (describe-function-1 defn) |
611 (when up-event | |
612 (let ((defn (or (string-key-binding up-event) (key-binding up-event)))) | |
613 (unless (or (null defn) (integerp defn) (equal defn 'undefined)) | |
614 (princ "\n\n-------------- up event ---------------\n\n") | |
615 (princ (key-description up-event)) | |
616 (if (windowp window) | |
617 (princ " at that spot")) | |
618 (princ " runs the command ") | |
619 (prin1 defn) | |
620 (princ "\n which is ") | |
621 (describe-function-1 defn)))) | |
611 (print-help-return-message))))))) | 622 (print-help-return-message))))))) |
612 | 623 |
613 | 624 |
614 (defun describe-mode (&optional buffer) | 625 (defun describe-mode (&optional buffer) |
615 "Display documentation of current major mode and minor modes. | 626 "Display documentation of current major mode and minor modes. |