changeset 69310:270a2959d019

* help.el (describe-key): Properly handle the return value of read-key-sequence when grabbing an up-event. Cleanup mouse-1 remaps.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 06 Mar 2006 20:27:06 +0000
parents f0678aafb24e
children 86ebde8d0adc
files lisp/ChangeLog lisp/help.el
diffstat 2 files changed, 26 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Mar 06 20:09:17 2006 +0000
+++ b/lisp/ChangeLog	Mon Mar 06 20:27:06 2006 +0000
@@ -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.
--- a/lisp/help.el	Mon Mar 06 20:09:17 2006 +0000
+++ b/lisp/help.el	Mon Mar 06 20:27:06 2006 +0000
@@ -653,13 +653,15 @@
 	     (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 @@
 	    (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 @@
 		  (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)))))))
-
 
 (defun describe-mode (&optional buffer)
   "Display documentation of current major mode and minor modes.