diff options
| author | Chong Yidong | 2006-03-06 20:27:06 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-03-06 20:27:06 +0000 |
| commit | aa38f98ed35bbff5c0dde3394d9029478ba4937d (patch) | |
| tree | 14d6436540d21d6829244881e57195e07cd273cb | |
| parent | 95983b950a75b69cc6b70cd5be70808747718cc8 (diff) | |
| download | emacs-aa38f98ed35bbff5c0dde3394d9029478ba4937d.tar.gz emacs-aa38f98ed35bbff5c0dde3394d9029478ba4937d.zip | |
* help.el (describe-key): Properly handle the return value of
read-key-sequence when grabbing an up-event. Cleanup mouse-1
remaps.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/help.el | 43 |
2 files changed, 26 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b3dba4f4cd..ac8adc89ea5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,8 +1,15 @@ | |||
| 1 | 2006-03-06 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * help.el (describe-key): Properly handle the return value of | ||
| 4 | read-key-sequence when grabbing an up-event. Cleanup mouse-1 | ||
| 5 | remaps. | ||
| 6 | |||
| 1 | 2006-03-06 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2006-03-06 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * complete.el (PC-expand-many-files): Try be more careful when parsing | 9 | * complete.el (PC-expand-many-files): Try be more careful when parsing |
| 4 | the shell's output. | 10 | the shell's output. |
| 5 | 11 | ||
| 12 | >>>>>>> 1.9228 | ||
| 6 | 2006-03-05 Stefan Monnier <monnier@iro.umontreal.ca> | 13 | 2006-03-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 7 | 14 | ||
| 8 | * outline.el (hide-sublevels): Provide better interactive default. | 15 | * outline.el (hide-sublevels): Provide better interactive default. |
diff --git a/lisp/help.el b/lisp/help.el index bed25366aab..0690cc64431 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -653,13 +653,15 @@ temporarily enables it to allow getting help on disabled items and buttons." | |||
| 653 | (setq saved-yank-menu (copy-sequence yank-menu)) | 653 | (setq saved-yank-menu (copy-sequence yank-menu)) |
| 654 | (menu-bar-update-yank-menu "(any string)" nil)) | 654 | (menu-bar-update-yank-menu "(any string)" nil)) |
| 655 | (setq key (read-key-sequence "Describe key (or click or menu item): ")) | 655 | (setq key (read-key-sequence "Describe key (or click or menu item): ")) |
| 656 | (setq foo key) | ||
| 656 | (list | 657 | (list |
| 657 | key | 658 | key |
| 658 | (prefix-numeric-value current-prefix-arg) | 659 | (prefix-numeric-value current-prefix-arg) |
| 659 | ;; If KEY is a down-event, read the corresponding up-event | 660 | ;; If KEY is a down-event, read the corresponding up-event |
| 660 | ;; and use it as the third argument. | 661 | ;; and use it as the third argument. |
| 661 | (if (and (consp key) (symbolp (car key)) | 662 | (if (and (vectorp key) |
| 662 | (memq 'down (cdr (get (car key) 'event-symbol-elements)))) | 663 | (eventp (elt key 0)) |
| 664 | (memq 'down (event-modifiers (elt key 0)))) | ||
| 663 | (read-event)))) | 665 | (read-event)))) |
| 664 | ;; Put yank-menu back as it was, if we changed it. | 666 | ;; Put yank-menu back as it was, if we changed it. |
| 665 | (when saved-yank-menu | 667 | (when saved-yank-menu |
| @@ -704,31 +706,29 @@ temporarily enables it to allow getting help on disabled items and buttons." | |||
| 704 | (prin1 defn) | 706 | (prin1 defn) |
| 705 | (princ "\n which is ") | 707 | (princ "\n which is ") |
| 706 | (describe-function-1 defn) | 708 | (describe-function-1 defn) |
| 709 | (setq foo up-event) | ||
| 707 | (when up-event | 710 | (when up-event |
| 708 | (let ((ev (aref up-event 0)) | 711 | (let ((type (event-basic-type up-event)) |
| 709 | (descr (key-description up-event)) | ||
| 710 | (hdr "\n\n-------------- up event ---------------\n\n") | 712 | (hdr "\n\n-------------- up event ---------------\n\n") |
| 711 | defn | 713 | defn |
| 712 | mouse-1-tricky mouse-1-remapped) | 714 | mouse-1-tricky mouse-1-remapped) |
| 713 | (when (and (consp ev) | 715 | (when (and (eq type 'mouse-1) |
| 714 | (eq (car ev) 'mouse-1) | ||
| 715 | (windowp window) | 716 | (windowp window) |
| 716 | mouse-1-click-follows-link | 717 | mouse-1-click-follows-link |
| 717 | (not (eq mouse-1-click-follows-link 'double)) | 718 | (not (eq mouse-1-click-follows-link 'double)) |
| 718 | (with-current-buffer (window-buffer window) | 719 | (with-current-buffer (window-buffer window) |
| 719 | (mouse-on-link-p (posn-point (event-start ev))))) | 720 | (mouse-on-link-p (posn-point (event-start up-event))))) |
| 720 | (setq mouse-1-tricky (integerp mouse-1-click-follows-link) | 721 | (setq mouse-1-remapped t) |
| 721 | mouse-1-remapped (or (not mouse-1-tricky) | 722 | (setq mouse-1-tricky (and (integerp mouse-1-click-follows-link) |
| 722 | (> mouse-1-click-follows-link 0))) | 723 | (> mouse-1-click-follows-link 0))) |
| 723 | (if mouse-1-remapped | 724 | (setcar up-event 'mouse-2)) |
| 724 | (setcar ev 'mouse-2))) | 725 | (setq defn (key-binding (vector up-event))) |
| 725 | (setq defn (or (string-key-binding up-event) (key-binding up-event))) | ||
| 726 | (unless (or (null defn) (integerp defn) (equal defn 'undefined)) | 726 | (unless (or (null defn) (integerp defn) (equal defn 'undefined)) |
| 727 | (princ (if mouse-1-tricky | 727 | (princ (if mouse-1-tricky |
| 728 | "\n\n----------------- up-event (short click) ----------------\n\n" | 728 | "\n\n----------------- up-event (short click) ----------------\n\n" |
| 729 | hdr)) | 729 | hdr)) |
| 730 | (setq hdr nil) | 730 | (setq hdr nil) |
| 731 | (princ descr) | 731 | (princ (symbol-name type)) |
| 732 | (if (windowp window) | 732 | (if (windowp window) |
| 733 | (princ " at that spot")) | 733 | (princ " at that spot")) |
| 734 | (if mouse-1-remapped | 734 | (if mouse-1-remapped |
| @@ -738,26 +738,21 @@ temporarily enables it to allow getting help on disabled items and buttons." | |||
| 738 | (princ "\n which is ") | 738 | (princ "\n which is ") |
| 739 | (describe-function-1 defn)) | 739 | (describe-function-1 defn)) |
| 740 | (when mouse-1-tricky | 740 | (when mouse-1-tricky |
| 741 | (setcar ev | 741 | (setcar up-event 'mouse-1) |
| 742 | (if (> mouse-1-click-follows-link 0) 'mouse-1 'mouse-2)) | 742 | (setq defn (key-binding (vector up-event))) |
| 743 | (setq defn (or (string-key-binding up-event) (key-binding up-event))) | 743 | (unless (or (null defn) (integerp defn) (eq defn 'undefined)) |
| 744 | (unless (or (null defn) (integerp defn) (equal defn 'undefined)) | ||
| 745 | (princ (or hdr | 744 | (princ (or hdr |
| 746 | "\n\n----------------- up-event (long click) ----------------\n\n")) | 745 | "\n\n----------------- up-event (long click) ----------------\n\n")) |
| 747 | (princ "Pressing ") | 746 | (princ "Pressing mouse-1") |
| 748 | (princ descr) | ||
| 749 | (if (windowp window) | 747 | (if (windowp window) |
| 750 | (princ " at that spot")) | 748 | (princ " at that spot")) |
| 751 | (princ (format " for longer than %d milli-seconds\n" | 749 | (princ (format " for longer than %d milli-seconds\n" |
| 752 | (abs mouse-1-click-follows-link))) | 750 | mouse-1-click-follows-link)) |
| 753 | (if (not mouse-1-remapped) | ||
| 754 | (princ " remaps it to <mouse-2> which" )) | ||
| 755 | (princ " runs the command ") | 751 | (princ " runs the command ") |
| 756 | (prin1 defn) | 752 | (prin1 defn) |
| 757 | (princ "\n which is ") | 753 | (princ "\n which is ") |
| 758 | (describe-function-1 defn))))) | 754 | (describe-function-1 defn))))) |
| 759 | (print-help-return-message))))))) | 755 | (print-help-return-message))))))) |
| 760 | |||
| 761 | 756 | ||
| 762 | (defun describe-mode (&optional buffer) | 757 | (defun describe-mode (&optional buffer) |
| 763 | "Display documentation of current major mode and minor modes. | 758 | "Display documentation of current major mode and minor modes. |