emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/rfc-mode dde7646c44 2/9: fix page navigation


From: ELPA Syncer
Subject: [nongnu] elpa/rfc-mode dde7646c44 2/9: fix page navigation
Date: Fri, 13 Oct 2023 10:02:11 -0400 (EDT)

branch: elpa/rfc-mode
commit dde7646c44240e4aacefb068845fa2c254185d2c
Author: Nicolas Martyanoff <nicolas@n16f.net>
Commit: Nicolas Martyanoff <nicolas@n16f.net>

    fix page navigation
    
    It was incorrect before (the header starts at the line after \f, not the 
line
    before), and was apparently broken by Emacs 29 (see #22).
---
 rfc-mode.el | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/rfc-mode.el b/rfc-mode.el
index fa1456db36..d16c583ff8 100644
--- a/rfc-mode.el
+++ b/rfc-mode.el
@@ -155,21 +155,25 @@ If nil (the default) then use e.g. *rfc21*, otherwise use 
e.g. rfc21.txt."
 
 (defun rfc-mode-recenter ()
   "Do the same as `recenter-top-bottom' would for the `top' position."
+  (rfc-mode-header-start)
   (let ((recenter-positions '(top)))
     (recenter-top-bottom)))
 
 (defun rfc-mode-backward-page ()
   "Scroll to the previous page of the current buffer."
   (interactive)
+  (beginning-of-line)
+  (unless (looking-at "")
+    (backward-page))
   (backward-page)
-  (rfc-mode-previous-header)
+  (beginning-of-line 1)
   (rfc-mode-recenter))
 
 (defun rfc-mode-forward-page ()
   "Scroll to the next page of the current buffer."
   (interactive)
   (forward-page)
-  (rfc-mode-previous-header)
+  (beginning-of-line 1)
   (rfc-mode-recenter))
 
 (defun rfc-mode-goto-section (section)  ;FIXME: Why not use imenu for that?
@@ -352,19 +356,8 @@ the header."
   (when (looking-at "")
     (forward-line 1)
     (move-end-of-line 1)
-    (let ((end (point)))
-      (forward-line -2)
-      (move-beginning-of-line 1)
-      end)))
-
-(defun rfc-mode-previous-header ()
-  "Move the the start of the previous header.
-
-Return the position of the end of the previous header or NIL if
-no previous header is found."
-  (when (search-backward "" nil t)
-    (goto-char (match-beginning 0))
-    (rfc-mode-header-start)))
+    (prog1 (point)
+      (move-beginning-of-line 1))))
 
 (defun rfc-mode-next-header ()
   "Move the end of the next header.



reply via email to

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