diff options
| author | Miles Bader | 2001-10-08 06:58:32 +0000 |
|---|---|---|
| committer | Miles Bader | 2001-10-08 06:58:32 +0000 |
| commit | 894e460c17138f672e5cfbed39785485f843675d (patch) | |
| tree | 67669b8bd932319f2375f4e64fe586b0b76bc4d6 | |
| parent | 1e00f7205439ead3b7b63c9326934756cf850ac5 (diff) | |
| download | emacs-894e460c17138f672e5cfbed39785485f843675d.tar.gz emacs-894e460c17138f672e5cfbed39785485f843675d.zip | |
(apropos-symbol): Add `skip' property.
(apropos-function, apropos-macro, apropos-command)
(apropos-variable, apropos-face, apropos-group, apropos-widget)
(apropos-plist): New button types.
(apropos-label-properties): Variable removed.
(apropos-print): Pass button-type to apropos-print-doc, rather
than help function and label text.
(apropos-print-doc): Remove ACTION and STR args, add TYPE arg.
Get button label from TYPE.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/apropos.el | 104 |
2 files changed, 78 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 356816d07f2..20db64564a8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -4,8 +4,19 @@ | |||
| 4 | parameters. Don't pay attention to `skip' properties. | 4 | parameters. Don't pay attention to `skip' properties. |
| 5 | (forward-button): Implement wrapping, iterating, and skipping here | 5 | (forward-button): Implement wrapping, iterating, and skipping here |
| 6 | instead. | 6 | instead. |
| 7 | (button-activate): USE-MOUSE-ACTION is optional. | ||
| 8 | |||
| 7 | * apropos.el (apropos-next-label-button): Update arguments to | 9 | * apropos.el (apropos-next-label-button): Update arguments to |
| 8 | `next-button'. | 10 | `next-button'. |
| 11 | (apropos-symbol): Add `skip' property. | ||
| 12 | (apropos-function, apropos-macro, apropos-command) | ||
| 13 | (apropos-variable, apropos-face, apropos-group, apropos-widget) | ||
| 14 | (apropos-plist): New button types. | ||
| 15 | (apropos-label-properties): Variable removed. | ||
| 16 | (apropos-print): Pass button-type to apropos-print-doc, rather | ||
| 17 | than help function and label text. | ||
| 18 | (apropos-print-doc): Remove ACTION and STR args, add TYPE arg. | ||
| 19 | Get button label from TYPE. | ||
| 9 | 20 | ||
| 10 | 2001-10-07 Stefan Monnier <monnier@cs.yale.edu> | 21 | 2001-10-07 Stefan Monnier <monnier@cs.yale.edu> |
| 11 | 22 | ||
diff --git a/lisp/apropos.el b/lisp/apropos.el index 89462d609c4..23f772648c1 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -134,12 +134,9 @@ for the regexp; the part that matches gets displayed in this font." | |||
| 134 | 134 | ||
| 135 | (define-button-type 'apropos-symbol | 135 | (define-button-type 'apropos-symbol |
| 136 | 'face apropos-symbol-face | 136 | 'face apropos-symbol-face |
| 137 | 'help-echo "mouse-2, RET: Display more help on this symbol." | 137 | 'help-echo "mouse-2, RET: Display more help on this symbol" |
| 138 | 'action #'apropos-symbol-button-display-help) | 138 | 'action #'apropos-symbol-button-display-help |
| 139 | 139 | 'skip t) | |
| 140 | (define-button-type 'apropos-label | ||
| 141 | 'help-echo "mouse-2, RET: Display more help on this symbol." | ||
| 142 | 'action #'apropos-label-button-display-help) | ||
| 143 | 140 | ||
| 144 | (defun apropos-symbol-button-display-help (button) | 141 | (defun apropos-symbol-button-display-help (button) |
| 145 | "Display further help for the `apropos-symbol' button BUTTON." | 142 | "Display further help for the `apropos-symbol' button BUTTON." |
| @@ -147,10 +144,57 @@ for the regexp; the part that matches gets displayed in this font." | |||
| 147 | (or (apropos-next-label-button (button-start button)) | 144 | (or (apropos-next-label-button (button-start button)) |
| 148 | (error "There is nothing to follow for `%s'" (button-label button))))) | 145 | (error "There is nothing to follow for `%s'" (button-label button))))) |
| 149 | 146 | ||
| 150 | (defun apropos-label-button-display-help (button) | 147 | (define-button-type 'apropos-function |
| 151 | "Display further help for the `apropos-label' button BUTTON." | 148 | 'apropos-label "Function" |
| 152 | (funcall (button-get button 'apropos-action) | 149 | 'action (lambda (button) |
| 153 | (button-get button 'apropos-symbol))) | 150 | (describe-function (button-get button 'apropos-symbol))) |
| 151 | 'help-echo "mouse-2, RET: Display more help on this function") | ||
| 152 | (define-button-type 'apropos-macro | ||
| 153 | 'apropos-label "Macro" | ||
| 154 | 'action (lambda (button) | ||
| 155 | (describe-function (button-get button 'apropos-symbol))) | ||
| 156 | 'help-echo "mouse-2, RET: Display more help on this macro") | ||
| 157 | (define-button-type 'apropos-command | ||
| 158 | 'apropos-label "Command" | ||
| 159 | 'action (lambda (button) | ||
| 160 | (describe-function (button-get button 'apropos-symbol))) | ||
| 161 | 'help-echo "mouse-2, RET: Display more help on this command") | ||
| 162 | |||
| 163 | ;; We used to use `customize-variable-other-window' instead for a | ||
| 164 | ;; customizable variable, but that is slow. It is better to show an | ||
| 165 | ;; ordinary help buffer and let the user click on the customization | ||
| 166 | ;; button in that buffer, if he wants to. | ||
| 167 | ;; Likewise for `customize-face-other-window'. | ||
| 168 | (define-button-type 'apropos-variable | ||
| 169 | 'apropos-label "Variable" | ||
| 170 | 'help-echo "mouse-2, RET: Display more help on this variable" | ||
| 171 | 'action (lambda (button) | ||
| 172 | (describe-variable (button-get button 'apropos-symbol)))) | ||
| 173 | |||
| 174 | (define-button-type 'apropos-face | ||
| 175 | 'apropos-label "Face" | ||
| 176 | 'help-echo "mouse-2, RET: Display more help on this face" | ||
| 177 | 'action (lambda (button) | ||
| 178 | (describe-face (button-get button 'apropos-symbol)))) | ||
| 179 | |||
| 180 | (define-button-type 'apropos-group | ||
| 181 | 'apropos-label "Group" | ||
| 182 | 'help-echo "mouse-2, RET: Display more help on this group" | ||
| 183 | 'action (lambda (button) | ||
| 184 | (customize-variable-other-window | ||
| 185 | (button-get button 'apropos-symbol)))) | ||
| 186 | |||
| 187 | (define-button-type 'apropos-widget | ||
| 188 | 'apropos-label "Widget" | ||
| 189 | 'help-echo "mouse-2, RET: Display more help on this widget" | ||
| 190 | 'action (lambda (button) | ||
| 191 | (widget-browse-other-window (button-get button 'apropos-symbol)))) | ||
| 192 | |||
| 193 | (define-button-type 'apropos-plist | ||
| 194 | 'apropos-label "Plist" | ||
| 195 | 'help-echo "mouse-2, RET: Display more help on this plist" | ||
| 196 | 'action (lambda (button) | ||
| 197 | (apropos-describe-plist (button-get button 'apropos-symbol)))) | ||
| 154 | 198 | ||
| 155 | (defun apropos-next-label-button (pos) | 199 | (defun apropos-next-label-button (pos) |
| 156 | "Returns the next `apropos-label' button after POS, or nil if there's none. | 200 | "Returns the next `apropos-label' button after POS, or nil if there's none. |
| @@ -532,11 +576,6 @@ Will return nil instead." | |||
| 532 | function)) | 576 | function)) |
| 533 | 577 | ||
| 534 | 578 | ||
| 535 | |||
| 536 | (defvar apropos-label-properties nil | ||
| 537 | "List of face properties to use for a label. | ||
| 538 | Bound by `apropos-print' for use by `apropos-print-doc'.") | ||
| 539 | |||
| 540 | (defun apropos-print (do-keys spacing) | 579 | (defun apropos-print (do-keys spacing) |
| 541 | "Output result of apropos searching into buffer `*Apropos*'. | 580 | "Output result of apropos searching into buffer `*Apropos*'. |
| 542 | The value of `apropos-accumulator' is the list of items to output. | 581 | The value of `apropos-accumulator' is the list of items to output. |
| @@ -619,25 +658,18 @@ alphabetically by symbol name; but this function also sets | |||
| 619 | (put-text-property (- (point) 3) (point) | 658 | (put-text-property (- (point) 3) (point) |
| 620 | 'face apropos-keybinding-face))) | 659 | 'face apropos-keybinding-face))) |
| 621 | (terpri) | 660 | (terpri) |
| 622 | (apropos-print-doc 'describe-function 1 | 661 | (apropos-print-doc 1 |
| 623 | (if (commandp symbol) | 662 | (if (commandp symbol) |
| 624 | "Command" | 663 | 'apropos-command |
| 625 | (if (apropos-macrop symbol) | 664 | (if (apropos-macrop symbol) |
| 626 | "Macro" | 665 | 'apropos-macro |
| 627 | "Function")) | 666 | 'apropos-function)) |
| 628 | t) | 667 | t) |
| 629 | ;; We used to use `customize-variable-other-window' instead | 668 | (apropos-print-doc 2 'apropos-variable t) |
| 630 | ;; for a customizable variable, but that is slow. | 669 | (apropos-print-doc 6 'apropos-group t) |
| 631 | ;; It is better to show an ordinary help buffer | 670 | (apropos-print-doc 5 'apropos-face t) |
| 632 | ;; and let the user click on the customization button | 671 | (apropos-print-doc 4 'apropos-widget t) |
| 633 | ;; in that buffer, if he wants to. | 672 | (apropos-print-doc 3 'apropos-plist nil)) |
| 634 | ;; Likewise for `customize-face-other-window'. | ||
| 635 | (apropos-print-doc 'describe-variable 2 "Variable" t) | ||
| 636 | (apropos-print-doc 'customize-group-other-window 6 "Group" t) | ||
| 637 | (apropos-print-doc 'describe-face 5 "Face" t) | ||
| 638 | (apropos-print-doc 'widget-browse-other-window 4 "Widget" t) | ||
| 639 | (apropos-print-doc 'apropos-describe-plist 3 | ||
| 640 | "Plist" nil)) | ||
| 641 | (setq buffer-read-only t)))) | 673 | (setq buffer-read-only t)))) |
| 642 | (prog1 apropos-accumulator | 674 | (prog1 apropos-accumulator |
| 643 | (setq apropos-accumulator ()))) ; permit gc | 675 | (setq apropos-accumulator ()))) ; permit gc |
| @@ -654,19 +686,17 @@ alphabetically by symbol name; but this function also sets | |||
| 654 | '(macro t)))))) | 686 | '(macro t)))))) |
| 655 | 687 | ||
| 656 | 688 | ||
| 657 | (defun apropos-print-doc (action i str do-keys) | 689 | (defun apropos-print-doc (i type do-keys) |
| 658 | (if (stringp (setq i (nth i apropos-item))) | 690 | (if (stringp (setq i (nth i apropos-item))) |
| 659 | (progn | 691 | (progn |
| 660 | (insert " ") | 692 | (insert " ") |
| 661 | (insert-text-button str | 693 | (insert-text-button (button-type-get type 'apropos-label) |
| 662 | 'type 'apropos-label | 694 | 'type type |
| 663 | ;; Can't use the default button face, since | 695 | ;; Can't use the default button face, since |
| 664 | ;; user may have changed the variable! | 696 | ;; user may have changed the variable! |
| 665 | ;; Just say `no' to variables containing faces! | 697 | ;; Just say `no' to variables containing faces! |
| 666 | 'face apropos-label-face | 698 | 'face apropos-label-face |
| 667 | 'apropos-symbol (car apropos-item) | 699 | 'apropos-symbol (car apropos-item)) |
| 668 | 'apropos-action action | ||
| 669 | str) | ||
| 670 | (insert ": ") | 700 | (insert ": ") |
| 671 | (insert (if do-keys (substitute-command-keys i) i)) | 701 | (insert (if do-keys (substitute-command-keys i) i)) |
| 672 | (or (bolp) (terpri))))) | 702 | (or (bolp) (terpri))))) |