From 918f2e56d9ab0bf94ea260aec9d224a20c80c44f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 16 Dec 2004 13:05:37 +0000 Subject: * help.el (function-called-at-point): As a last resort try striping non-word prefixes and suffixes. --- lisp/help.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lisp/help.el') diff --git a/lisp/help.el b/lisp/help.el index 5ec9b1f5299..992a9b85f4b 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -267,8 +267,13 @@ If that doesn't give a function, return nil." (and (symbolp obj) (fboundp obj) obj)))) (error nil)))) (let* ((str (find-tag-default)) - (obj (if str (intern str)))) - (and (symbolp obj) (fboundp obj) obj)))) + (sym (if str (intern-soft str)))) + (if (and sym (fboundp sym)) + sym + (save-match-data + (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) + (setq sym (intern-soft (match-string 1 str))) + (and (fboundp sym) sym))))))) ;;; `User' help functions -- cgit v1.2.3 From 72b64ad5bae01aae2bd8c7d012cb392bafaf80a1 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 17 Dec 2004 15:16:46 +0000 Subject: (describe-key): Report effective and original binding for mouse-1 when clicked on a link. (describe-mode): Add follow-link property to "minor-mode" button. --- lisp/help.el | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'lisp/help.el') diff --git a/lisp/help.el b/lisp/help.el index 992a9b85f4b..f5831c9ab3f 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -614,17 +614,58 @@ the last key hit are used." (princ "\n which is ") (describe-function-1 defn) (when up-event - (let ((defn (or (string-key-binding up-event) (key-binding up-event)))) + (let ((ev (aref up-event 0)) + (descr (key-description 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) + (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))) (unless (or (null defn) (integerp defn) (equal defn 'undefined)) - (princ "\n\n-------------- up event ---------------\n\n") - (princ (key-description up-event)) + (princ (if mouse-1-tricky + "\n\n----------------- up-event (short click) ----------------\n\n" + hdr)) + (setq hdr nil) + (princ descr) (if (windowp window) (princ " at that spot")) + (if mouse-1-remapped + (princ " is remapped to \n which" )) (princ " runs the command ") (prin1 defn) (princ "\n which is ") - (describe-function-1 defn)))) - (print-help-return-message))))))) + (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)) + (princ (or hdr + "\n\n----------------- up-event (long click) ----------------\n\n")) + (princ "Pressing ") + (princ descr) + (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 which" )) + (princ " runs the command ") + (prin1 defn) + (princ "\n which is ") + (describe-function-1 defn)))) + (print-help-return-message)))))))) (defun describe-mode (&optional buffer) @@ -697,6 +738,7 @@ whose documentation describes the minor mode." (princ " ") (insert-button pretty-minor-mode 'action (car help-button-cache) + 'follow-link t 'help-echo "mouse-2, RET: show full information") (princ (format " minor mode (%s):\n" (if indicator -- cgit v1.2.3