From: Justin Timmons Date: Fri, 17 Apr 2020 04:00:19 +0000 (+0200) Subject: Bind 'n' and 'p' to move between symbols in apropos X-Git-Tag: emacs-28.0.90~7560 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=763ec05cc17973134c440f2d0afb6eb5d095d0d4;p=emacs.git 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. --- diff --git a/etc/NEWS b/etc/NEWS index 396c757e708..025d5c14a78 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/apropos.el b/lisp/apropos.el index 23f70d10fd4..7277319cd89 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -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."