>From da6a1c2e92113a626053f93a4bb9418c0ff8d789 Mon Sep 17 00:00:00 2001 From: Julio Claudio Matus Ramirez Date: Sat, 30 Nov 2013 21:33:13 +0900 Subject: [PATCH] next/prev-rec commands in rec-mode can accept numeric prefixes --- ChangeLog | 5 ++++ etc/rec-mode.el | 60 +++++++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index e64091d..3ca2e5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-11-21 Julio C. M. Ramirez + + * etc/rec-mode.el: adding numeric prefix to next/previous + records commands for recmode on emacs. + 2013-11-04 Jose E. Marchesi * .gitignore: Updated with the files generated when building the 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))) -- 1.7.2.5