emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 763ec05: Bind 'n' and 'p' to move between symbols in apropos


From: Stefan Kangas
Subject: master 763ec05: Bind 'n' and 'p' to move between symbols in apropos
Date: Fri, 17 Apr 2020 00:28:08 -0400 (EDT)

branch: master
commit 763ec05cc17973134c440f2d0afb6eb5d095d0d4
Author: Justin Timmons <address@hidden>
Commit: Stefan Kangas <address@hidden>

    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.
---
 etc/NEWS        |  6 ++++++
 lisp/apropos.el | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 396c757..025d5c1 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 23f70d1..7277319 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]