>From acb545f0cff1ad382d2e78f4ec480cbad7f3bbb9 Mon Sep 17 00:00:00 2001 From: Julio Claudio Matus Ramirez Date: Wed, 4 Dec 2013 00:36:05 +0900 Subject: [PATCH] next/prev-rec commands in rec-mode can accept numeric prefixes --- ChangeLog | 6 +++++ doc/rec-mode.texi | 2 + etc/rec-mode.el | 60 ++++++++++++++++++++++++++++------------------------ 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index e64091d..a7264f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-12-04 Julio C. M. Ramirez + + * etc/rec-mode.el: adding numeric prefix to next/previous + records commands for recmode on emacs. + * doc/rec-mode.texi: adding mention for feature above. + 2013-11-04 Jose E. Marchesi * .gitignore: Updated with the files generated when building the diff --git a/doc/rec-mode.texi b/doc/rec-mode.texi index 3adc680..cdcc0d6 100644 --- a/doc/rec-mode.texi +++ b/doc/rec-mode.texi @@ -233,8 +233,10 @@ The following commands jump to other records in the buffer. @table @asis @reccmd{n,rec-cmd-goto-next-rec} Display the next record of the same type in the buffer. address@hidden N n' will move next N times. @reccmd{p,rec-cmd-goto-previous-rec} Display the previous record of the same type in the buffer. address@hidden N p' will move backwards N times. @reccmd{d, rec-cmd-show-descriptor} Display the record descriptor applicable to the current record. If the current record is anonymous, @ie{} there is not record 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