[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 7ca1168 06/98: rec-mode.el
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 7ca1168 06/98: rec-mode.el |
Date: |
Thu, 12 Nov 2020 13:18:29 -0500 (EST) |
branch: externals/rec-mode
commit 7ca11688433d240790ba903b39cc5d2d98f8e36c
Author: Jose Marchesi <jco@wilhelm.(none)>
Commit: Antoine Kalmbach <ane@iki.fi>
rec-mode.el
---
etc/rec-mode.el | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index bac02e7..36ec536 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -39,9 +39,9 @@
:group 'applications
:link '(url-link "http://www.gnu.org/software/rec"))
-(defcustom rec-open-mode 'edit
+(defcustom rec-open-mode 'navigation
"Default mode to use when switching a buffer to rec-mode.
-Valid values are `edit' and `navigation'. The default is `edit'"
+Valid values are `edit' and `navigation'. The default is `navigation'"
:type 'symbol
:group 'rec-mode)
@@ -101,7 +101,7 @@ Valid values are `edit' and `navigation'. The default is
`edit'"
"Syntax table used in rec-mode")
(defvar rec-font-lock-keywords
- `(("^%\\(rec\\|key\\|unique\\|type\\|prohibit\\|mandatory\\|doc\\|fsort\\):"
. font-lock-keyword-face)
+
`(("^%\\(rec\\|key\\|unique\\|type\\|prohibit\\|mandatory\\|type\\|doc\\|fsort\\):"
. font-lock-keyword-face)
(,rec-field-name-re . font-lock-variable-name-face)
("^\\+" . font-lock-constant-face))
"Font lock keywords used in rec-mode")
@@ -144,6 +144,7 @@ Valid values are `edit' and `navigation'. The default is
`edit'"
(define-key map "#" 'rec-cmd-count)
(define-key map (kbd "RET") 'rec-cmd-jump)
(define-key map (kbd "TAB") 'rec-cmd-goto-next-field)
+ (define-key map (kbd "SPC") 'rec-cmd-toggle-field-visibility)
(define-key map "b" 'rec-cmd-jump-back)
map)
"Keymap for rec-mode")
@@ -642,6 +643,9 @@ file."
(defun rec-goto-type (type)
"Goto the beginning of the descriptor with type TYPE.
+If there are records of type TYPE in the record set then goto the
+first record. Otherwise goto to the record descriptor.
+
If the type do not exist in the current buffer then
this function returns nil."
(if (or (not type)
@@ -959,7 +963,7 @@ the result buffer."
"Show the records of the given type"
(widen)
(unless (rec-goto-type type)
- (message "No records with that type found in the file"))
+ (message "No records of the requested type were found."))
(rec-show-record))
(defun rec-show-record ()
@@ -969,16 +973,21 @@ the result buffer."
(use-local-map rec-mode-map)
;; TODO: Update field names for autocompletion
;; (let ((names (rec-record-field-names (rec-current-record)))))
+ (rec-set-head-line nil)
(rec-set-mode-line (rec-record-type)))
-;;;; Mode line
+;;;; Mode line and Head line
(defun rec-set-mode-line (str)
- "Set the modeline in rec buffers"
+ "Set the modeline in rec buffers."
(setq mode-line-buffer-identification
(list 20
"%b " str)))
+(defun rec-set-head-line (str)
+ "Set the headline in rec buffers."
+ (setq header-line-format str))
+
;;;; Fast selection
(defun rec-fast-selection (names prompt)
@@ -1240,7 +1249,7 @@ buffer"
(insert field-value)
(switch-to-buffer-other-window edit-buf)
(goto-char (point-min))
- (message "Edit the value of the field and press C-c C-c to exit"))
+ (message "Edit the value of the field and use C-c C-c to exit"))
(message "Not in a field"))))
(defun rec-finish-editing-field ()
@@ -1420,10 +1429,10 @@ point."
(setq rec-editing t)
(setq buffer-read-only nil)
(use-local-map rec-mode-edit-map)
+ (rec-set-head-line "Editing record - use C-cC-c to return to navigation
mode")
(rec-set-mode-line "Edit record")
(setq rec-update-p t)
- (setq rec-preserve-last-newline t)
- (message "Editing: Press C-c C-c when you are done"))
+ (setq rec-preserve-last-newline t))
(defun rec-edit-type ()
"Go to the type edition mode"
@@ -1435,8 +1444,10 @@ point."
(rec-narrow-to-type (rec-record-type))
(setq rec-update-p t)
(goto-char (point-min))
- (rec-set-mode-line "Edit type")
- (message "Editing: Press C-c C-c when you are done"))
+ (rec-set-head-line (concat "Editing type "
+ "'" (rec-record-type) "'"
+ " - use C-cC-c to return to navigation mode"))
+ (rec-set-mode-line "Edit type"))
(defun rec-edit-buffer ()
"Go to the buffer edition mode"
@@ -1447,8 +1458,8 @@ point."
(widen)
(setq rec-update-p t)
(goto-char (point-min))
- (rec-set-mode-line "Edit buffer")
- (message "Editing: Press C-c C-c when you are done"))
+ (rec-set-head-line "Editing buffer - use C-cC-c to return to navigation
mode")
+ (rec-set-mode-line "Edit buffer"))
(defun rec-finish-editing ()
"Go back from the record edition mode"
@@ -1467,7 +1478,7 @@ point."
(rec-update-buffer-descriptors))
(setq rec-update-p nil))
(rec-show-record)
- ;; TODO: Restore modeline
+ (rec-set-head-line nil)
(rec-set-mode-line (rec-record-type))
(setq rec-editing nil)
(rec-init-selections)
- [elpa] externals/rec-mode 7b1a375 53/98: rec-mode: provide a sensible log-current-defun for the add-log function., (continued)
- [elpa] externals/rec-mode 7b1a375 53/98: rec-mode: provide a sensible log-current-defun for the add-log function., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 33e106f 54/98: rec-mode: improve rec-log-current-defun so it works in all cases., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode da7b8c0 57/98: rec-mode: rec-end-of-field-pos now works properly when a field ends with the end of file mark., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode e20b7dd 63/98: rec-mode: don't hide continuation lines in editing modes after editing a field., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode f39f1a0 66/98: rec-mode: be smart assigning letters to enumerated entries., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode bb07fa5 47/98: rec-mode: support for undo in navigation mode., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode c72ec31 67/98: rec-mode: initial version of the summary mode, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 99e3e62 68/98: rec-mode: more work in the summary mode., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode b389387 97/98: Escape plus sign in regexp, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 849edd6 91/98: Move files to the root directory, Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 7ca1168 06/98: rec-mode.el,
Stefan Monnier <=
- [elpa] externals/rec-mode b77d494 30/98: rec-mode: avoid security problems in calls to message by using %s., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 37e53b6 31/98: rec-mode: complete support for editing fields storing enumerated values., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode debbdd5 19/98: Time-stamp marks removed from the entire codebase and syntax checks fixes., Stefan Monnier, 2020/11/12
- [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