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

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

[elpa] externals/rec-mode 7e5c145 74/98: rec-mode: use a prefix argument


From: Stefan Monnier
Subject: [elpa] externals/rec-mode 7e5c145 74/98: rec-mode: use a prefix argument to move N records forward/backward
Date: Thu, 12 Nov 2020 13:18:43 -0500 (EST)

branch: externals/rec-mode
commit 7e5c1457da587aef95a006be559675c8d6a0af69
Author: Julio C. M. Ramirez <rikijpn@member.fsf.org>
Commit: Antoine Kalmbach <ane@iki.fi>

    rec-mode: use a prefix argument to move N records forward/backward
---
 etc/rec-mode.el | 60 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 32 insertions(+), 28 deletions(-)

diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index aa24849..65d1e61 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -1860,45 +1860,49 @@ record.  Interactive version."
       (rec-beginning-of-record))
     (rec-goto-next-field)))
 
-(defun rec-cmd-goto-next-rec ()
+(defun rec-cmd-goto-next-rec (&optional n)
   "Move the pointer to the beginning of the next record in the
 file.  Interactive version."
-  (interactive)
+  (interactive "P")
+  (when (null n) (setq n 1))
   (widen)
   (let ((record-type (rec-record-type)))
-    (if (save-excursion
-          (and (rec-goto-next-rec)
-               (equal (rec-record-type) record-type)
-               (not (rec-record-descriptor-p (rec-current-record)))))
-        (progn
-          (rec-unfold-all-fields)
-          (rec-remove-continuation-line-marker-overlays)
-          (rec-goto-next-rec))
-      (if (not (rec-record-type))
-          (message "No more records")
-        (message "%s" (concat "No more records of type "
-                              (rec-record-type))))))
+    (dotimes (i n)
+      (if (save-excursion
+           (and (rec-goto-next-rec)
+                (equal (rec-record-type) record-type)
+                (not (rec-record-descriptor-p (rec-current-record)))))
+         (progn
+           (rec-unfold-all-fields)
+           (rec-remove-continuation-line-marker-overlays)
+           (rec-goto-next-rec))
+       (if (not (rec-record-type))
+           (message "No more records")
+         (message "%s" (concat "No more records of type "
+                               (rec-record-type)))))))
   (unless rec-editing
     (rec-show-record)))
 
-(defun rec-cmd-goto-previous-rec ()
+(defun rec-cmd-goto-previous-rec (&optional n)
   "Move the pointer to the beginning of the previous record in
 the file.  Interactive version."
-  (interactive)
+  (interactive "P")
+  (when (null n) (setq n 1))
   (widen)
   (let ((record-type (rec-record-type)))
-    (if (save-excursion
-          (and (rec-goto-previous-rec)
-               (equal (rec-record-type) record-type)
-               (not (rec-record-descriptor-p (rec-current-record)))))
-        (progn
-          (rec-unfold-all-fields)
-          (rec-remove-continuation-line-marker-overlays)
-          (rec-goto-previous-rec))
-      (if (not (rec-record-type))
-          (message "No more records")
-        (message "%s" (concat "No more records of type "
-                              (rec-record-type))))))
+    (dotimes (i n)
+      (if (save-excursion
+           (and (rec-goto-previous-rec)
+                (equal (rec-record-type) record-type)
+                (not (rec-record-descriptor-p (rec-current-record)))))
+         (progn
+           (rec-unfold-all-fields)
+           (rec-remove-continuation-line-marker-overlays)
+           (rec-goto-previous-rec))
+       (if (not (rec-record-type))
+           (message "No more records")
+         (message "%s" (concat "No more records of type "
+                               (rec-record-type)))))))
   (unless rec-editing
     (rec-show-record)))
 



reply via email to

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