[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/help.el,v
From: |
David Kastrup |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/help.el,v |
Date: |
Fri, 15 Sep 2006 08:53:20 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: David Kastrup <dak> 06/09/15 08:53:18
Index: help.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/help.el,v
retrieving revision 1.315
retrieving revision 1.316
diff -u -b -r1.315 -r1.316
--- help.el 11 Sep 2006 09:47:43 -0000 1.315
+++ help.el 15 Sep 2006 08:53:18 -0000 1.316
@@ -567,10 +567,15 @@
(menu-bar-update-yank-menu "(any string)" nil))
(setq key (read-key-sequence "Describe key (or click or menu item):
"))
;; If KEY is a down-event, read and discard the
- ;; corresponding up-event.
- (if (and (vectorp key)
- (eventp (elt key 0))
- (memq 'down (event-modifiers (elt key 0))))
+ ;; corresponding up-event. Note that there are also
+ ;; down-events on scroll bars and mode lines: the actual
+ ;; event then is in the second element of the vector.
+ (and (vectorp key)
+ (or (and (eventp (aref key 0))
+ (memq 'down (event-modifiers (aref key 0))))
+ (and (> (length key) 1)
+ (eventp (aref key 1))
+ (memq 'down (event-modifiers (aref key 1)))))
(read-event))
(list
key
@@ -582,21 +587,16 @@
(fset 'yank-menu (cons 'keymap yank-menu))))))
(if (numberp untranslated)
(setq untranslated (this-single-command-raw-keys)))
- (save-excursion
- (let ((modifiers (event-modifiers (aref key 0)))
+ (let* ((event (if (and (symbolp (aref key 0))
+ (> (length key) 1)
+ (consp (aref key 1)))
+ (aref key 1)
+ (aref key 0)))
+ (modifiers (event-modifiers event))
(standard-output (if insert (current-buffer) t))
- window position)
- ;; For a mouse button event, go to the button it applies to
- ;; to get the right key bindings. And go to the right place
- ;; in case the keymap depends on where you clicked.
- (if (or (memq 'click modifiers) (memq 'down modifiers)
- (memq 'drag modifiers))
- (setq window (posn-window (event-start (aref key 0)))
- position (posn-point (event-start (aref key 0)))))
- (if (windowp window)
- (progn
- (set-buffer (window-buffer window))
- (goto-char position)))
+ (mousep
+ (or (memq 'click modifiers) (memq 'down modifiers)
+ (memq 'drag modifiers))))
;; Ok, now look up the key and name the command.
(let ((defn (key-binding key t))
key-desc)
@@ -616,11 +616,11 @@
(setq key-desc (help-key-description key untranslated))
(if (or (null defn) (integerp defn) (equal defn 'undefined))
(princ (format "%s is undefined" key-desc))
- (princ (format (if (windowp window)
+ (princ (format (if mousep
"%s at that spot runs the command %s"
"%s runs the command %s")
key-desc
- (if (symbolp defn) defn (prin1-to-string defn)))))))))
+ (if (symbolp defn) defn (prin1-to-string defn))))))))
(defun describe-key (&optional key untranslated up-event)
"Display documentation of the function invoked by KEY.
@@ -652,9 +652,12 @@
(prefix-numeric-value current-prefix-arg)
;; If KEY is a down-event, read the corresponding up-event
;; and use it as the third argument.
- (if (and (vectorp key)
- (eventp (elt key 0))
- (memq 'down (event-modifiers (elt key 0))))
+ (and (vectorp key)
+ (or (and (eventp (aref key 0))
+ (memq 'down (event-modifiers (aref key 0))))
+ (and (> (length key) 1)
+ (eventp (aref key 1))
+ (memq 'down (event-modifiers (aref key 1)))))
(read-event))))
;; Put yank-menu back as it was, if we changed it.
(when saved-yank-menu
@@ -662,19 +665,17 @@
(fset 'yank-menu (cons 'keymap yank-menu))))))
(if (numberp untranslated)
(setq untranslated (this-single-command-raw-keys)))
- (save-excursion
- (let ((modifiers (event-modifiers (aref key 0)))
- window position)
- ;; For a mouse button event, go to the button it applies to
- ;; to get the right key bindings. And go to the right place
- ;; in case the keymap depends on where you clicked.
- (if (or (memq 'click modifiers) (memq 'down modifiers)
- (memq 'drag modifiers))
- (setq window (posn-window (event-start (aref key 0)))
- position (posn-point (event-start (aref key 0)))))
- (when (windowp window)
- (set-buffer (window-buffer window))
- (goto-char position))
+ (let* ((event (if (and (symbolp (aref key 0))
+ (> (length key) 1)
+ (consp (aref key 1)))
+ (aref key 1)
+ (aref key 0)))
+ (modifiers (event-modifiers event))
+ (mousep
+ (or (memq 'click modifiers) (memq 'down modifiers)
+ (memq 'drag modifiers))))
+ ;; Ok, now look up the key and name the command.
+
(let ((defn (key-binding key t)))
;; Handle the case where we faked an entry in "Select and Paste" menu.
(if (and (eq defn nil)
@@ -693,7 +694,7 @@
"(any string)"))
(with-output-to-temp-buffer (help-buffer)
(princ (help-key-description key untranslated))
- (if (windowp window)
+ (if mousep
(princ " at that spot"))
(princ " runs the command ")
(prin1 defn)
@@ -706,13 +707,10 @@
mouse-1-tricky mouse-1-remapped)
(setq sequence (vector up-event))
(when (and (eq type 'mouse-1)
- (windowp window)
mouse-1-click-follows-link
(not (eq mouse-1-click-follows-link 'double))
(setq mouse-1-remapped
- (with-current-buffer (window-buffer window)
- (mouse-on-link-p (posn-point
- (event-start up-event))))))
+ (mouse-on-link-p (event-start up-event))))
(setq mouse-1-tricky (and (integerp
mouse-1-click-follows-link)
(> mouse-1-click-follows-link 0)))
(cond ((stringp mouse-1-remapped)
@@ -720,14 +718,14 @@
((vectorp mouse-1-remapped)
(setcar up-event (elt mouse-1-remapped 0)))
(t (setcar up-event 'mouse-2))))
- (setq defn (key-binding sequence))
+ (setq defn (key-binding sequence nil nil (event-start up-event)))
(unless (or (null defn) (integerp defn) (equal defn 'undefined))
(princ (if mouse-1-tricky
"\n\n----------------- up-event (short click)
----------------\n\n"
hdr))
(setq hdr nil)
(princ (symbol-name type))
- (if (windowp window)
+ (if mousep
(princ " at that spot"))
(if mouse-1-remapped
(princ " is remapped to <mouse-2>\n which" ))
@@ -737,12 +735,13 @@
(describe-function-1 defn))
(when mouse-1-tricky
(setcar up-event 'mouse-1)
- (setq defn (key-binding (vector up-event)))
+ (setq defn (key-binding (vector up-event) nil nil
+ (event-start up-event)))
(unless (or (null defn) (integerp defn) (eq defn 'undefined))
(princ (or hdr
"\n\n----------------- up-event (long click)
----------------\n\n"))
(princ "Pressing mouse-1")
- (if (windowp window)
+ (if mousep
(princ " at that spot"))
(princ (format " for longer than %d milli-seconds\n"
mouse-1-click-follows-link))
@@ -750,7 +749,7 @@
(prin1 defn)
(princ "\n which is ")
(describe-function-1 defn)))))
- (print-help-return-message)))))))
+ (print-help-return-message))))))
(defun describe-mode (&optional buffer)
"Display documentation of current major mode and minor modes.
- [Emacs-diffs] Changes to emacs/lisp/help.el,v, David Kastrup, 2006/09/11
- [Emacs-diffs] Changes to emacs/lisp/help.el,v,
David Kastrup <=
- [Emacs-diffs] Changes to emacs/lisp/help.el,v, Kim F. Storm, 2006/09/15
- [Emacs-diffs] Changes to emacs/lisp/help.el,v, Eli Zaretskii, 2006/09/16
- [Emacs-diffs] Changes to emacs/lisp/help.el,v, Kim F. Storm, 2006/09/19
- [Emacs-diffs] Changes to emacs/lisp/help.el,v, Chong Yidong, 2006/09/23
- [Emacs-diffs] Changes to emacs/lisp/help.el,v, Richard M. Stallman, 2006/09/24