Bind 'n' and 'p' to move between symbols in apropos

* lisp/apropos.el (apropos-next-symbol)
(apropos-previous-symbol): New commands.
(apropos-mode-map): Bind above commands to 'n' and 'p'.  (Bug#20694)
* etc/NEWS: Announce the new commands.
This commit is contained in:
Justin Timmons 2020-04-17 06:00:19 +02:00 committed by Stefan Kangas
parent be77a68d52
commit 763ec05cc1
2 changed files with 25 additions and 0 deletions

View file

@ -282,6 +282,12 @@ This is used when invoking 'texi2dvi' from 'texinfo-tex-buffer'.
Its default value matches localized abbreviations of the "reply"
prefix on the Subject line in various languages.
** Apropos
*** New commands 'apropos-next-symbol' and 'apropos-previous-symbol'.
These new navigation commands are bound to 'n' and 'p' in
'apropos-mode'.
* New Modes and Packages in Emacs 28.1

View file

@ -160,6 +160,10 @@ If value is `verbose', the computed score is shown for each match."
;; definition of RET, so that users can use it anywhere in an
;; apropos item, not just on top of a button.
(define-key map "\C-m" 'apropos-follow)
;; Movement keys
(define-key map "n" 'apropos-next-symbol)
(define-key map "p" 'apropos-previous-symbol)
map)
"Keymap used in Apropos mode.")
@ -1270,6 +1274,21 @@ as a heading."
(or (apropos-next-label-button (line-beginning-position))
(error "There is nothing to follow here"))))
(defun apropos-next-symbol ()
"Move cursor down to the next symbol in an apropos-mode buffer."
(interactive)
(forward-line)
(while (and (not (eq (face-at-point) 'apropos-symbol))
(< (point) (point-max)))
(forward-line)))
(defun apropos-previous-symbol ()
"Move cursor back to the last symbol in an apropos-mode buffer."
(interactive)
(forward-line -1)
(while (and (not (eq (face-at-point) 'apropos-symbol))
(> (point) (point-min)))
(forward-line -1)))
(defun apropos-describe-plist (symbol)
"Display a pretty listing of SYMBOL's plist."