[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 19d0cef 35/98: rec-mode: support for selection
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 19d0cef 35/98: rec-mode: support for selection expressions in rec-count. |
Date: |
Thu, 12 Nov 2020 13:18:35 -0500 (EST) |
branch: externals/rec-mode
commit 19d0cef367eae45e875aaf86a484440a7131d645
Author: Jose E. Marchesi <jemarch@gnu.org>
Commit: Antoine Kalmbach <ane@iki.fi>
rec-mode: support for selection expressions in rec-count.
---
etc/rec-mode.el | 62 ++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 41 insertions(+), 21 deletions(-)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index 0bed33d..289463d 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -730,7 +730,7 @@ If no such record exist then don't move and return nil."
(when pos
(goto-char pos))))
-(defun rec-count (&optional type)
+(defun rec-count (&optional type sex)
"If TYPE is a string, return the number of records of the
specified type in the current file."
(let (num
@@ -739,16 +739,28 @@ specified type in the current file."
"")))
(with-temp-buffer
(if (stringp type)
- (call-process rec-recsel
- nil ; infile
- t ; output to current buffer.
- nil ; display
- "-t" type "-c" rec-file-name)
- (call-process rec-recsel
- nil ; infile
- t ; output to current buffer.
- nil ; display
- "-c" rec-file-name))
+ (if (stringp sex)
+ (call-process rec-recsel
+ nil ; infile
+ t ; output to current buffer.
+ nil ; display
+ "-t" type "-e" sex "-c" rec-file-name)
+ (call-process rec-recsel
+ nil ; infile
+ t ; output to current buffer.
+ nil ; display
+ "-t" type "-c" rec-file-name))
+ (if (stringp sex)
+ (call-process rec-recsel
+ nil ; infile
+ t ; output to current buffer.
+ nil ; display
+ "-e" sex "-c" rec-file-name)
+ (call-process rec-recsel
+ nil ; infile
+ t ; output to current buffer.
+ nil ; display
+ "-c" rec-file-name)))
(setq num (buffer-substring-no-properties (point-min) (point-max))))
(string-to-number num)))
@@ -1604,17 +1616,25 @@ the modeline."
(display-message-or-buffer (rec-type-text type))
(message "Unrestricted text"))))
-(defun rec-cmd-count ()
+(defun rec-cmd-count (n)
"Display a message in the minibuffer showing the number of
-records of the current type"
- (interactive)
- (message "Counting records...")
- (let ((type (rec-record-type)))
- (message "%s" (concat (number-to-string (rec-count type))
- (if (or (not type)
- (equal type ""))
- " records"
- (concat " records of type " type))))))
+records of the current type.
+
+If a numeric argument is used then prompt for a selection
+expression."
+ (interactive "P")
+ (let ((sex (and (not (null n)) (read-from-minibuffer "Selection expression:
"))))
+ (when (equal sex "")
+ (setq sex nil))
+ (message "Counting records...")
+ (let ((type (rec-record-type)))
+ (message "%s" (concat (number-to-string (rec-count type sex))
+ (if (or (not type)
+ (equal type ""))
+ " records"
+ (concat " records of type " type))
+ (when (and sex (not (equal sex "")))
+ (concat " with sex " sex)))))))
(defun rec-cmd-append-field ()
"Goto the end of the record and switch to edit record mode."
- [elpa] externals/rec-mode 0cf9416 22/98: rec-mode: don't use a fixed list of keywords when font-locking special fields and other minor fixes., (continued)
- [elpa] externals/rec-mode 0cf9416 22/98: rec-mode: don't use a fixed list of keywords when font-locking special fields and other minor fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode d4ff2b1 32/98: rec-mode: support editing boolean fields as special enum values., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 99c7c8e 37/98: rec-mode: bug affecting the hiding of continuation line markers fixed., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 75e53c1 73/98: prepare for 1.5.90, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 4eb296f 94/98: Add Info mode manual, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode b03b215 07/98: Trailing blanks removed., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 6c82c97 13/98: ob-rec.el is not part of Emacs., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 884d53e 20/98: Initial implementation of encrypted fields., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode f111394 29/98: rec-mode: more work in the field types., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 37fa271 21/98: rec-mode: fix error when saving a newly created file, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 19d0cef 35/98: rec-mode: support for selection expressions in rec-count.,
Stefan Monnier <=
- [elpa] externals/rec-mode 2204ecc 40/98: rec-mode: support for editing date fields using the calendar., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 88bab07 45/98: rec-mode: time-stamps are now triggered with n'., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 9c6d63d 50/98: rec-mode: copy/kill fields and records commands., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 5eabbdb 52/98: syntax-check fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 241e824 55/98: rec-mode: don't move the pointer after switching to edit buffer or edit type mode., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode d505c30 61/98: rec-mode: visiting an empty file works again., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 903c1dc 59/98: rec-mode: check for the validity of the contents of the buffers before going to navigation mode., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 979fcef 69/98: ob-rec.el: support for :groupby and :join added., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 34714d3 85/98: rec-mode: fix typo and run the actual hooks., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode e1ad9fe 84/98: rec-mode: fix setq typo, Stefan Monnier, 2020/11/12