[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 4413688 38/98: rec-mode: new functions returni
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 4413688 38/98: rec-mode: new functions returning properties of the current record set. |
Date: |
Thu, 12 Nov 2020 13:18:36 -0500 (EST) |
branch: externals/rec-mode
commit 441368844a31d6fffd769d9ba2e9961d73b08a37
Author: Jose E. Marchesi <jemarch@gnu.org>
Commit: Antoine Kalmbach <ane@iki.fi>
rec-mode: new functions returning properties of the current record set.
---
etc/rec-mode.el | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index 04643bd..9b286e6 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -69,6 +69,12 @@ hidden by default in navigation mode.")
;; value!!
"Rec keyword.")
+(defconst rec-keyword-key (concat rec-keyword-prefix "key")
+ "Key keyword.")
+
+(defconst rec-keyword-mandatory (concat rec-keyword-prefix "mandatory")
+ "Mandatory keyword.")
+
(defvar rec-comment-re "^#.*"
"regexp denoting a comment line")
@@ -811,6 +817,24 @@ Return nil if the point is not on a record."
descriptor
""))))
+(defun rec-mandatory-fields ()
+ "Return a list with the names of the mandatory fields in the
+current record set."
+ (let ((descriptor (cadr (rec-record-descriptor))))
+ (when descriptor
+ (let ((fields-str (rec-record-assoc rec-keyword-mandatory descriptor)))
+ (when fields-str
+ (split-string (car fields-str)))))))
+
+(defun rec-key ()
+ "Return the name of the field declared as the key of the
+current record set, if any. Otherwise return `nil'."
+ (let ((descriptor (cadr (rec-record-descriptor))))
+ (when descriptor
+ (let ((key (rec-record-assoc rec-keyword-key descriptor)))
+ (when key
+ (car key))))))
+
;;;; Navigation
(defun rec-show-type (type &optional show-descriptor)
@@ -1836,6 +1860,15 @@ expression."
(rec-unfold-field)
(rec-fold-field))))
+;; (defun rec-cmd-create-new-record ()
+;; "Create a new record with some default fields in the current
+;; record set."
+;; (interactive)
+;; (let ((key (rec-key))
+;; (mandatory (rec-mandatory-fields))
+;; fields record)
+;; (when (not (member key mandatory))
+
;;;; Definition of modes
(defun rec-mode ()
- [elpa] externals/rec-mode 2f8aa87 16/98: ob-rec: support for :sort and minor fixes., (continued)
- [elpa] externals/rec-mode 2f8aa87 16/98: ob-rec: support for :sort and minor fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode fbd02a9 24/98: rec-mode: field names are no longer lists of parts., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 0b52532 18/98: ob-rec: support for :sort and minor fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 18e9e4a 23/98: rec-mode: editing of individual fields now works., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 424eb72 25/98: rec-mode: fixes in goto-type and show-type., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode f063506 26/98: rec-mode: misc small fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 0f09c3f 33/98: rec-mode: support editing boolean fields as special enum values., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 3e47acf 05/98: rec-mode improvements., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode aa86480 08/98: rec-mode: several fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 6292f55 09/98: syntax-check fixes., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 4413688 38/98: rec-mode: new functions returning properties of the current record set.,
Stefan Monnier <=
- [elpa] externals/rec-mode 1982af5 42/98: rec-mode: allow the user to cancel the edit date operation by quitting the calendar window., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode eba1923 36/98: rec-mode: presentation of continuation lines in navigation modes, and other improvements., Stefan Monnier, 2020/11/12
- [elpa] externals/rec-mode 87abd92 49/98: rec-mode: new command rec-cmd-statistics., Stefan Monnier, 2020/11/12
- [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