]> git.eshelyaron.com Git - emacs.git/commitdiff
Bind 'n' and 'p' to move between symbols in apropos
authorJustin Timmons <justinmtimmons@gmail.com>
Fri, 17 Apr 2020 04:00:19 +0000 (06:00 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Fri, 17 Apr 2020 04:26:43 +0000 (06:26 +0200)
* 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.

etc/NEWS
lisp/apropos.el

index 396c757e708096d5de6e80b90c55faff65d1fa1a..025d5c14a780f2278a58ba6ca7e35b40b4827457 100644 (file)
--- 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'.
+
 \f
 * New Modes and Packages in Emacs 28.1
 
index 23f70d10fd45ba2d929b11df469687c1dd9323ea..7277319cd890bc4a7f4e1bb5be2458133ca1177c 100644 (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."