]> git.eshelyaron.com Git - emacs.git/commitdiff
* help.el (describe-key): Properly handle the return value of
authorChong Yidong <cyd@stupidchicken.com>
Mon, 6 Mar 2006 20:27:06 +0000 (20:27 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Mon, 6 Mar 2006 20:27:06 +0000 (20:27 +0000)
read-key-sequence when grabbing an up-event.  Cleanup mouse-1
remaps.

lisp/ChangeLog
lisp/help.el

index 8b3dba4f4cddf499b056b02cd5f340776477c806..ac8adc89ea558c96eff7effed0550d591464e990 100644 (file)
@@ -1,8 +1,15 @@
+2006-03-06  Chong Yidong  <cyd@stupidchicken.com>
+
+       * help.el (describe-key): Properly handle the return value of
+       read-key-sequence when grabbing an up-event.  Cleanup mouse-1
+       remaps.
+
 2006-03-06  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * complete.el (PC-expand-many-files): Try be more careful when parsing
        the shell's output.
 
+>>>>>>> 1.9228
 2006-03-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * outline.el (hide-sublevels): Provide better interactive default.
index bed25366aab3ff0499d0c54732e5fcb486f6a1ac..0690cc644317cd950948331933080126f7edb182 100644 (file)
@@ -653,13 +653,15 @@ temporarily enables it to allow getting help on disabled items and buttons."
             (setq saved-yank-menu (copy-sequence yank-menu))
             (menu-bar-update-yank-menu "(any string)" nil))
           (setq key (read-key-sequence "Describe key (or click or menu item): "))
+          (setq foo key)
           (list
            key
            (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 (consp key) (symbolp (car key))
-                    (memq 'down (cdr (get (car key) 'event-symbol-elements))))
+           (if (and (vectorp key)
+                    (eventp (elt key 0))
+                    (memq 'down (event-modifiers (elt key 0))))
                (read-event))))
        ;; Put yank-menu back as it was, if we changed it.
        (when saved-yank-menu
@@ -704,31 +706,29 @@ temporarily enables it to allow getting help on disabled items and buttons."
            (prin1 defn)
            (princ "\n   which is ")
            (describe-function-1 defn)
+           (setq foo up-event)
            (when up-event
-             (let ((ev (aref up-event 0))
-                   (descr (key-description up-event))
+             (let ((type (event-basic-type up-event))
                    (hdr "\n\n-------------- up event ---------------\n\n")
                    defn
                    mouse-1-tricky mouse-1-remapped)
-               (when (and (consp ev)
-                          (eq (car ev) 'mouse-1)
+               (when (and (eq type 'mouse-1)
                           (windowp window)
                           mouse-1-click-follows-link
                           (not (eq mouse-1-click-follows-link 'double))
                           (with-current-buffer (window-buffer window)
-                            (mouse-on-link-p (posn-point (event-start ev)))))
-                 (setq mouse-1-tricky (integerp mouse-1-click-follows-link)
-                       mouse-1-remapped (or (not mouse-1-tricky)
-                                            (> mouse-1-click-follows-link 0)))
-                 (if mouse-1-remapped
-                     (setcar ev 'mouse-2)))
-               (setq defn (or (string-key-binding up-event) (key-binding up-event)))
+                            (mouse-on-link-p (posn-point (event-start up-event)))))
+                 (setq mouse-1-remapped t)
+                 (setq mouse-1-tricky (and (integerp mouse-1-click-follows-link)
+                                           (> mouse-1-click-follows-link 0)))
+                 (setcar up-event 'mouse-2))
+               (setq defn (key-binding (vector 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 descr)
+                 (princ (symbol-name type))
                  (if (windowp window)
                      (princ " at that spot"))
                  (if mouse-1-remapped
@@ -738,26 +738,21 @@ temporarily enables it to allow getting help on disabled items and buttons."
                  (princ "\n   which is ")
                  (describe-function-1 defn))
                (when mouse-1-tricky
-                 (setcar ev
-                         (if (> mouse-1-click-follows-link 0) 'mouse-1 'mouse-2))
-                 (setq defn (or (string-key-binding up-event) (key-binding up-event)))
-                 (unless (or (null defn) (integerp defn) (equal defn 'undefined))
+                 (setcar up-event 'mouse-1)
+                 (setq defn (key-binding (vector up-event)))
+                 (unless (or (null defn) (integerp defn) (eq defn 'undefined))
                    (princ (or hdr
                               "\n\n----------------- up-event (long click) ----------------\n\n"))
-                   (princ "Pressing ")
-                   (princ descr)
+                   (princ "Pressing mouse-1")
                    (if (windowp window)
                        (princ " at that spot"))
                    (princ (format " for longer than %d milli-seconds\n"
-                                  (abs mouse-1-click-follows-link)))
-                   (if (not mouse-1-remapped)
-                       (princ " remaps it to <mouse-2> which" ))
+                                  mouse-1-click-follows-link))
                    (princ " runs the command ")
                    (prin1 defn)
                    (princ "\n   which is ")
                    (describe-function-1 defn)))))
            (print-help-return-message)))))))
-
 \f
 (defun describe-mode (&optional buffer)
   "Display documentation of current major mode and minor modes.