[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 38751a8: Add 'n'/'p' key bindings in *Help* buffers
From: |
Lars Ingebrigtsen |
Subject: |
master 38751a8: Add 'n'/'p' key bindings in *Help* buffers |
Date: |
Sun, 31 Oct 2021 13:59:57 -0400 (EDT) |
branch: master
commit 38751a8585bf320983b78e0b654c1ffc9addbd2f
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Add 'n'/'p' key bindings in *Help* buffers
* lisp/help-mode.el (help-goto-previous-page): New command and key
binding.
(help-goto-previous-page): Ditto.
---
doc/emacs/help.texi | 8 ++++++++
etc/NEWS | 4 ++++
lisp/help-mode.el | 22 ++++++++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index d1329d5..4a6d20e 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -459,6 +459,14 @@ Move point back to the previous hyperlink
(@code{backward-button}).
@item mouse-1
@itemx mouse-2
Follow a hyperlink that you click on.
+@item n
+@itemx p
+Some help pages (like the list of key bindings you get with @kbd{C-h
+b}) are divided into pages (by the @samp{^L} character). The @kbd{n}
+(@code{help-goto-next-page}) command will take you to the start of the
+next page, and the @kbd{p} (@code{help-goto-previous-page}) command
+will take you to the start of the previous page, or (if point isn't at
+the start of the current page) to the start of the current page.
@item C-c C-c
Show all documentation about the symbol at point
(@code{help-follow-symbol}).
diff --git a/etc/NEWS b/etc/NEWS
index 546f8d1..e7360d2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -53,6 +53,10 @@ time.
Jumping to source from "*Help*" buffer moves the point when the source
buffer is already open. Now, the old point is pushed to mark ring.
++++
+*** New key bindings in *Help* buffers: 'n' and 'p'.
+These will take you (respectively) to the next and previous "page".
+
** Fonts
---
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 53acbf9..83e783b 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -35,6 +35,8 @@
(let ((map (make-sparse-keymap)))
(set-keymap-parent map (make-composed-keymap button-buffer-map
special-mode-map))
+ (define-key map "n" 'help-goto-next-page)
+ (define-key map "p" 'help-goto-previous-page)
(define-key map "l" 'help-go-back)
(define-key map "r" 'help-go-forward)
(define-key map "\C-c\C-b" 'help-go-back)
@@ -806,6 +808,26 @@ See `help-make-xrefs'."
(help-xref-go-forward (current-buffer))
(user-error "No next help buffer")))
+(defun help-goto-next-page ()
+ "Go to the next page (if any) in the current buffer.
+The help buffers are divided into \"pages\" by the ^L character."
+ (interactive)
+ (push-mark)
+ (forward-page)
+ (unless (eobp)
+ (forward-line 1)))
+
+(defun help-goto-previous-page ()
+ "Go to the previous page (if any) in the current buffer.
+(If not at the start of a page, go to the start of the current page.)
+
+The help buffers are divided into \"pages\" by the ^L character."
+ (interactive)
+ (push-mark)
+ (backward-page (if (looking-back "\f\n" (- (point) 5)) 2 1))
+ (unless (bobp)
+ (forward-line 1)))
+
(defun help-view-source ()
"View the source of the current help item."
(interactive nil help-mode)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 38751a8: Add 'n'/'p' key bindings in *Help* buffers,
Lars Ingebrigtsen <=