Skip to content

Commit cc78c29

Browse files
committed
Adding basic overrides of apropos buttons to use helpful.
Possible problems: 1. I don't know _where_ these should go structurally. This file looks upside down to me. 2. I don't currently have any way to toggle this functionality on/off with the mode.
1 parent e2609e4 commit cc78c29

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

helpful.el

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,100 @@ See also `helpful-max-buffers'."
26822682
(when (eq (buffer-local-value 'major-mode buffer) 'helpful-mode)
26832683
(kill-buffer buffer))))
26842684

2685+
;; overrides in apropos to try to use helpful-* instead.
2686+
2687+
(require 'apropos)
2688+
2689+
(define-button-type 'apropos-function
2690+
'apropos-label "Function"
2691+
'apropos-short-label "f"
2692+
'face 'apropos-function-button
2693+
'help-echo "mouse-2, RET: Display more help on this function"
2694+
'follow-link t
2695+
'action (lambda (button)
2696+
(helpful-function (button-get button 'apropos-symbol))))
2697+
2698+
(define-button-type 'apropos-macro
2699+
'apropos-label "Macro"
2700+
'apropos-short-label "m"
2701+
'face 'apropos-function-button
2702+
'help-echo "mouse-2, RET: Display more help on this macro"
2703+
'follow-link t
2704+
'action (lambda (button)
2705+
(helpful-function (button-get button 'apropos-symbol))))
2706+
2707+
(define-button-type 'apropos-command
2708+
'apropos-label "Command"
2709+
'apropos-short-label "c"
2710+
'face 'apropos-function-button
2711+
'help-echo "mouse-2, RET: Display more help on this command"
2712+
'follow-link t
2713+
'action (lambda (button)
2714+
(helpful-function (button-get button 'apropos-symbol))))
2715+
2716+
(define-button-type 'apropos-variable
2717+
'apropos-label "Variable"
2718+
'apropos-short-label "v"
2719+
'face 'apropos-variable-button
2720+
'help-echo "mouse-2, RET: Display more help on this variable"
2721+
'follow-link t
2722+
'action (lambda (button)
2723+
(helpful-variable (button-get button 'apropos-symbol))))
2724+
2725+
(define-button-type 'apropos-user-option
2726+
'apropos-label "User option"
2727+
'apropos-short-label "o"
2728+
'face 'apropos-user-option-button
2729+
'help-echo "mouse-2, RET: Display more help on this user option"
2730+
'follow-link t
2731+
'action (lambda (button)
2732+
(helpful-variable (button-get button 'apropos-symbol))))
2733+
2734+
;;; TODO: these need helpful functions before they can be hooked up:
2735+
2736+
;; (define-button-type 'apropos-face
2737+
;; 'apropos-label "Face"
2738+
;; 'apropos-short-label "F"
2739+
;; 'face '(font-lock-variable-name-face button)
2740+
;; 'help-echo "mouse-2, RET: Display more help on this face"
2741+
;; 'follow-link t
2742+
;; 'action (lambda (button)
2743+
;; (describe-face (button-get button 'apropos-symbol))))
2744+
2745+
;; (define-button-type 'apropos-group
2746+
;; 'apropos-label "Group"
2747+
;; 'apropos-short-label "g"
2748+
;; 'face 'apropos-misc-button
2749+
;; 'help-echo "mouse-2, RET: Display more help on this group"
2750+
;; 'follow-link t
2751+
;; 'action (lambda (button)
2752+
;; (customize-group-other-window
2753+
;; (button-get button 'apropos-symbol))))
2754+
2755+
;; (define-button-type 'apropos-widget
2756+
;; 'apropos-label "Widget"
2757+
;; 'apropos-short-label "w"
2758+
;; 'face 'apropos-misc-button
2759+
;; 'help-echo "mouse-2, RET: Display more help on this widget"
2760+
;; 'follow-link t
2761+
;; 'action (lambda (button)
2762+
;; (widget-browse-other-window (button-get button 'apropos-symbol))))
2763+
2764+
;; (define-button-type 'apropos-plist
2765+
;; 'apropos-label "Properties"
2766+
;; 'apropos-short-label "p"
2767+
;; 'face 'apropos-misc-button
2768+
;; 'help-echo "mouse-2, RET: Display more help on this plist"
2769+
;; 'follow-link t
2770+
;; 'action (lambda (button)
2771+
;; (apropos-describe-plist (button-get button 'apropos-symbol))))
2772+
2773+
;; (define-button-type 'apropos-library
2774+
;; 'help-echo "mouse-2, RET: Display more help on this library"
2775+
;; 'follow-link t
2776+
;; 'action (lambda (button)
2777+
;; (apropos-library (button-get button 'apropos-symbol))))
2778+
26852779
(defvar helpful-mode-map
26862780
(let* ((map (make-sparse-keymap)))
26872781
(define-key map (kbd "g") #'helpful-update)

0 commit comments

Comments
 (0)