aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kastrup2006-09-11 09:47:43 +0000
committerDavid Kastrup2006-09-11 09:47:43 +0000
commitbcd8e1a907a3d055f4b1152231f15cf5a21fba5e (patch)
treedc50aad89ea7ded306a10ad773edff1e40f6615a
parent4d32309c1425c4bd947e77d8d47297c4cbf8d5e0 (diff)
downloademacs-bcd8e1a907a3d055f4b1152231f15cf5a21fba5e.tar.gz
emacs-bcd8e1a907a3d055f4b1152231f15cf5a21fba5e.zip
* help.el (string-key-binding, describe-key-briefly)
(describe-key): Remove `string-key-binding' and its callers since `key-binding' already caters for the proper lookup now. (string-key-binding, describe-key-briefly) (describe-key): Remove `string-key-binding' and its callers since `key-binding' already caters for the proper lookup now.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/help.el33
2 files changed, 10 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 711edf8ab92..def6ac8bdfa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12006-09-11 David Kastrup <dak@gnu.org>
2
3 * help.el (string-key-binding, describe-key-briefly)
4 (describe-key): Remove `string-key-binding' and its callers since
5 `key-binding' already caters for the proper lookup now.
6
12006-09-11 Stefan Monnier <monnier@iro.umontreal.ca> 72006-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * progmodes/cfengine.el (cfengine-font-lock-syntactic-keywords): New var. 9 * progmodes/cfengine.el (cfengine-font-lock-syntactic-keywords): New var.
diff --git a/lisp/help.el b/lisp/help.el
index db76efb01a0..d5682512b2d 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -535,28 +535,6 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
535 (princ string))))) 535 (princ string)))))
536 nil) 536 nil)
537 537
538(defun string-key-binding (key)
539 "Value is the binding of KEY in a string.
540If KEY is an event on a string, and that string has a `local-map'
541or `keymap' property, return the binding of KEY in the string's keymap."
542 (let* ((defn nil)
543 (start (when (vectorp key)
544 (if (memq (aref key 0)
545 '(mode-line header-line left-margin right-margin))
546 (event-start (aref key 1))
547 (and (consp (aref key 0))
548 (event-start (aref key 0))))))
549 (string-info (and (consp start) (nth 4 start))))
550 (when string-info
551 (let* ((string (car string-info))
552 (pos (cdr string-info))
553 (local-map (and (>= pos 0)
554 (< pos (length string))
555 (or (get-text-property pos 'local-map string)
556 (get-text-property pos 'keymap string)))))
557 (setq defn (and local-map (lookup-key local-map key)))))
558 defn))
559
560(defun help-key-description (key untranslated) 538(defun help-key-description (key untranslated)
561 (let ((string (key-description key))) 539 (let ((string (key-description key)))
562 (if (or (not untranslated) 540 (if (or (not untranslated)
@@ -620,8 +598,7 @@ temporarily enables it to allow getting help on disabled items and buttons."
620 (set-buffer (window-buffer window)) 598 (set-buffer (window-buffer window))
621 (goto-char position))) 599 (goto-char position)))
622 ;; Ok, now look up the key and name the command. 600 ;; Ok, now look up the key and name the command.
623 (let ((defn (or (string-key-binding key) 601 (let ((defn (key-binding key t))
624 (key-binding key t)))
625 key-desc) 602 key-desc)
626 ;; Handle the case where we faked an entry in "Select and Paste" menu. 603 ;; Handle the case where we faked an entry in "Select and Paste" menu.
627 (if (and (eq defn nil) 604 (if (and (eq defn nil)
@@ -698,7 +675,7 @@ temporarily enables it to allow getting help on disabled items and buttons."
698 (when (windowp window) 675 (when (windowp window)
699 (set-buffer (window-buffer window)) 676 (set-buffer (window-buffer window))
700 (goto-char position)) 677 (goto-char position))
701 (let ((defn (or (string-key-binding key) (key-binding key t)))) 678 (let ((defn (key-binding key t)))
702 ;; Handle the case where we faked an entry in "Select and Paste" menu. 679 ;; Handle the case where we faked an entry in "Select and Paste" menu.
703 (if (and (eq defn nil) 680 (if (and (eq defn nil)
704 (stringp (aref key (1- (length key)))) 681 (stringp (aref key (1- (length key))))
@@ -743,8 +720,7 @@ temporarily enables it to allow getting help on disabled items and buttons."
743 ((vectorp mouse-1-remapped) 720 ((vectorp mouse-1-remapped)
744 (setcar up-event (elt mouse-1-remapped 0))) 721 (setcar up-event (elt mouse-1-remapped 0)))
745 (t (setcar up-event 'mouse-2)))) 722 (t (setcar up-event 'mouse-2))))
746 (setq defn (or (string-key-binding sequence) 723 (setq defn (key-binding sequence))
747 (key-binding sequence)))
748 (unless (or (null defn) (integerp defn) (equal defn 'undefined)) 724 (unless (or (null defn) (integerp defn) (equal defn 'undefined))
749 (princ (if mouse-1-tricky 725 (princ (if mouse-1-tricky
750 "\n\n----------------- up-event (short click) ----------------\n\n" 726 "\n\n----------------- up-event (short click) ----------------\n\n"
@@ -761,8 +737,7 @@ temporarily enables it to allow getting help on disabled items and buttons."
761 (describe-function-1 defn)) 737 (describe-function-1 defn))
762 (when mouse-1-tricky 738 (when mouse-1-tricky
763 (setcar up-event 'mouse-1) 739 (setcar up-event 'mouse-1)
764 (setq defn (or (string-key-binding (vector up-event)) 740 (setq defn (key-binding (vector up-event)))
765 (key-binding (vector up-event))))
766 (unless (or (null defn) (integerp defn) (eq defn 'undefined)) 741 (unless (or (null defn) (integerp defn) (eq defn 'undefined))
767 (princ (or hdr 742 (princ (or hdr
768 "\n\n----------------- up-event (long click) ----------------\n\n")) 743 "\n\n----------------- up-event (long click) ----------------\n\n"))