all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Justin Timmons <justinmtimmons@gmail.com>
To: Juliusz Chroboczek <jch@pps.univ-paris-diderot.fr>
Cc: 20694@debbugs.gnu.org
Subject: bug#20694: 25.0.50; Please bind `p' and `n' in apropos-mode
Date: Mon, 12 Dec 2016 21:18:11 -0500	[thread overview]
Message-ID: <878trkh8rg.fsf@gmail.com> (raw)
In-Reply-To: <87k2vqhpuu.wl-jch@pps.univ-paris-diderot.fr> (Juliusz Chroboczek's message of "Sat, 30 May 2015 02:27:05 +0200")

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]


I wrote up a quick set of functions which accomplishes this and added them
to the apropos-mode keymap - see the attached patch file.

The functions search forward (or backwards) for the 'apropos-symbol
face; there could be a cleaner way to do this, but this seems to work
pretty well.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to add symbol movement to apropos-mode --]
[-- Type: text/x-patch, Size: 1296 bytes --]

diff --git a/lisp/apropos.el b/lisp/apropos.el
index 7c9ec12..d5a9a3a 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.")
 
@@ -1209,6 +1213,24 @@ as a heading."
        (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."
   (help-setup-xref (list 'apropos-describe-plist symbol)

  reply	other threads:[~2016-12-13  2:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30  0:27 bug#20694: 25.0.50; Please bind `p' and `n' in apropos-mode Juliusz Chroboczek
2016-12-13  2:18 ` Justin Timmons [this message]
2019-09-29 23:40 ` Stefan Kangas
2019-10-02  0:50   ` Justin Timmons
2019-10-02  9:40     ` Stefan Kangas
2019-10-02 15:13       ` Eli Zaretskii
2020-01-15  4:41         ` Stefan Kangas
2020-01-15  5:33           ` Justin Timmons
2020-01-15  6:02             ` Stefan Kangas
2020-04-16  4:09               ` Stefan Kangas
2020-04-16  5:30                 ` Eli Zaretskii
2020-04-17  4:31                   ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878trkh8rg.fsf@gmail.com \
    --to=justinmtimmons@gmail.com \
    --cc=20694@debbugs.gnu.org \
    --cc=jch@pps.univ-paris-diderot.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.