[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 472f378 39/98: rec-mode: initial work for sele
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 472f378 39/98: rec-mode: initial work for selection. |
Date: |
Thu, 12 Nov 2020 13:18:36 -0500 (EST) |
branch: externals/rec-mode
commit 472f37825638def71fafa31a24a220cab13a3854
Author: Jose E. Marchesi <jemarch@gnu.org>
Commit: Antoine Kalmbach <ane@iki.fi>
rec-mode: initial work for selection.
---
etc/rec-mode.el | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index 9b286e6..caf73df 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -132,6 +132,8 @@ hidden by default in navigation mode.")
(define-key map "\C-c#" 'rec-cmd-count)
(define-key map "\C-cm" 'rec-cmd-trim-field-value)
(define-key map "\C-cc" 'rec-cmd-compile)
+ (define-key map "\C-csq" 'rec-cmd-select-fast)
+ (define-key map "\C-css" 'rec-cmd-select-sex)
(define-key map "\C-cI" 'rec-cmd-show-info)
(define-key map (kbd "TAB") 'rec-cmd-goto-next-field)
(define-key map "\C-cb" 'rec-cmd-jump-back)
@@ -153,6 +155,8 @@ hidden by default in navigation mode.")
(define-key map "t" 'rec-cmd-show-type)
(define-key map "m" 'rec-cmd-trim-field-value)
(define-key map "c" 'rec-cmd-compile)
+ (define-key map "sq" 'rec-cmd-select-fast)
+ (define-key map "ss" 'rec-cmd-select-sex)
(define-key map "\C-ct" 'rec-find-type)
;; (define-key map [remap move-beginning-of-line]
'rec-cmd-beginning-of-line)
(define-key map "#" 'rec-cmd-count)
@@ -1455,12 +1459,40 @@ ARGS contains the arguments to pass to the program."
or `nil' if no selection is active.")
(make-variable-buffer-local 'rec-current-selection)
-(defun rec-select ()
+(defun rec-navigate-selection ()
+ "Goto the first record of the current selection, if any."
+ (if (not rec-current-selection)
+ (message "No current selection")
+ (widen)
+ (let* ((first-record (car rec-current-selection))
+ (pos (rec-record-position first-record)))
+ (goto-char pos)
+ (rec-show-record))))
+
+(defun rec-cmd-select ()
"Perform a selection on the current buffer using some criteria.
The result of the selection is stored in `rec-current-selection'."
(interactive)
(setq rec-current-selection (rec-query)))
+
+(defun rec-cmd-select-fast (str)
+ "Perform a selection on the current record set using a fast string search.
+
+A prefix argument means to use a case-insensitive search."
+ (interactive "sFast string query: ")
+ (when (not (equal str ""))
+ (setq rec-current-selection (rec-query :fast-string str))
+ (rec-navigate-selection)))
+
+(defun rec-cmd-select-sex (sex)
+ "Perform a selection on the current record set using a selection expression.
+
+A prefix argument means to use a case-insensitive search."
+ (interactive "sSelection expression: ")
+ (when (not (equal sex ""))
+ (setq rec-current-selection (rec-query :sex sex))
+ (rec-navigate-selection)))
;;;; Commands
;;
- [elpa] externals/rec-mode a89b7c2 89/98: rec-mode: split fields by comma and whitespace for summary, (continued)
- [elpa] externals/rec-mode a89b7c2 89/98: rec-mode: split fields by comma and whitespace for summary, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 3e2f5a7 46/98: rec-mode: support for multiple field names in %type entries., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode ceb00b5 41/98: rec-mode: rec-cmd-edit-field supports a numeric argument., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 9f7a14d 43/98: rec-mode: fix edition of the default record set., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode b149dfc 58/98: rec-mode: avoid trying to delete the sole window in the current frame., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode eaf5e93 60/98: rec-mode: support for a mode hook., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 4b485a0 76/98: rec-mode: several fixes while removing byte-compilation warnings., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 80b2815 75/98: rec-mode: fix selection commands when there are more than one record sets on the recfile., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode d97175a 82/98: rec-mode: define faces and use them, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode e94505f 95/98: README, COPYING, Info fixes, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 472f378 39/98: rec-mode: initial work for selection.,
Stefan Monnier <=
- [elpa] externals/rec-mode 20c3d6f 51/98: Do not kill the preceding empty line., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode f106531 62/98: rec-mode: do the right thing when the selected window is the only window in the frame., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 8d404d8 56/98: rec-mode: fixed to allow comments in records., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 113747c 71/98: maint: syntax-check fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 0ea7b18 80/98: rec-mode: quote the shell argument with the file name when invoking recfix., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode c302e6e 79/98: Copyright years updated to 2015., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 98b98ad 81/98: Quote the file name argument before to pass it to recfix in a shell., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 3ac3482 83/98: ob-rec.el: switch to lexical-binding, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 5fa6020 92/98: Font lock fixes and many small checkdoc fixes, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode d0e8456 98/98: Improve regexp that matched on empty strings, Stefan Monnier, 2020/11/12