comparison lisp/help.el @ 59018:52e86589c83a

(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.
author Kim F. Storm <storm@cua.dk>
date Fri, 17 Dec 2004 15:16:46 +0000
parents 1a8bbdcb009f
children 7c0a2065c3ee eac554634bfa
comparison
equal deleted inserted replaced
59017:3d934eda2724 59018:52e86589c83a
612 (princ " runs the command ") 612 (princ " runs the command ")
613 (prin1 defn) 613 (prin1 defn)
614 (princ "\n which is ") 614 (princ "\n which is ")
615 (describe-function-1 defn) 615 (describe-function-1 defn)
616 (when up-event 616 (when up-event
617 (let ((defn (or (string-key-binding up-event) (key-binding up-event)))) 617 (let ((ev (aref up-event 0))
618 (descr (key-description up-event))
619 (hdr "\n\n-------------- up event ---------------\n\n")
620 defn
621 mouse-1-tricky mouse-1-remapped)
622 (when (and (consp ev)
623 (eq (car ev) 'mouse-1)
624 (windowp window)
625 mouse-1-click-follows-link
626 (not (eq mouse-1-click-follows-link 'double))
627 (with-current-buffer (window-buffer window)
628 (mouse-on-link-p (posn-point (event-start ev)))))
629 (setq mouse-1-tricky (integerp mouse-1-click-follows-link)
630 mouse-1-remapped (or (not mouse-1-tricky)
631 (> mouse-1-click-follows-link 0)))
632 (if mouse-1-remapped
633 (setcar ev 'mouse-2)))
634 (setq defn (or (string-key-binding up-event) (key-binding up-event)))
618 (unless (or (null defn) (integerp defn) (equal defn 'undefined)) 635 (unless (or (null defn) (integerp defn) (equal defn 'undefined))
619 (princ "\n\n-------------- up event ---------------\n\n") 636 (princ (if mouse-1-tricky
620 (princ (key-description up-event)) 637 "\n\n----------------- up-event (short click) ----------------\n\n"
638 hdr))
639 (setq hdr nil)
640 (princ descr)
621 (if (windowp window) 641 (if (windowp window)
622 (princ " at that spot")) 642 (princ " at that spot"))
643 (if mouse-1-remapped
644 (princ " is remapped to <mouse-2>\n which" ))
623 (princ " runs the command ") 645 (princ " runs the command ")
624 (prin1 defn) 646 (prin1 defn)
625 (princ "\n which is ") 647 (princ "\n which is ")
626 (describe-function-1 defn)))) 648 (describe-function-1 defn))
627 (print-help-return-message))))))) 649 (when mouse-1-tricky
650 (setcar ev
651 (if (> mouse-1-click-follows-link 0) 'mouse-1 'mouse-2))
652 (setq defn (or (string-key-binding up-event) (key-binding up-event)))
653 (unless (or (null defn) (integerp defn) (equal defn 'undefined))
654 (princ (or hdr
655 "\n\n----------------- up-event (long click) ----------------\n\n"))
656 (princ "Pressing ")
657 (princ descr)
658 (if (windowp window)
659 (princ " at that spot"))
660 (princ (format " for longer than %d milli-seconds\n"
661 (abs mouse-1-click-follows-link)))
662 (if (not mouse-1-remapped)
663 (princ " remaps it to <mouse-2> which" ))
664 (princ " runs the command ")
665 (prin1 defn)
666 (princ "\n which is ")
667 (describe-function-1 defn))))
668 (print-help-return-message))))))))
628 669
629 670
630 (defun describe-mode (&optional buffer) 671 (defun describe-mode (&optional buffer)
631 "Display documentation of current major mode and minor modes. 672 "Display documentation of current major mode and minor modes.
632 A brief summary of the minor modes comes first, followed by the 673 A brief summary of the minor modes comes first, followed by the
695 "no indicator"))) 736 "no indicator")))
696 (princ (documentation mode-function))) 737 (princ (documentation mode-function)))
697 (princ " ") 738 (princ " ")
698 (insert-button pretty-minor-mode 739 (insert-button pretty-minor-mode
699 'action (car help-button-cache) 740 'action (car help-button-cache)
741 'follow-link t
700 'help-echo "mouse-2, RET: show full information") 742 'help-echo "mouse-2, RET: show full information")
701 (princ (format " minor mode (%s):\n" 743 (princ (format " minor mode (%s):\n"
702 (if indicator 744 (if indicator
703 (format "indicator%s" indicator) 745 (format "indicator%s" indicator)
704 "no indicator")))))) 746 "no indicator"))))))