[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 8d404d8 56/98: rec-mode: fixed to allow commen
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 8d404d8 56/98: rec-mode: fixed to allow comments in records. |
Date: |
Thu, 12 Nov 2020 13:18:40 -0500 (EST) |
branch: externals/rec-mode
commit 8d404d8f10debd1dfa64b24ff9feec3fe15e617d
Author: Jose E. Marchesi <jemarch@gnu.org>
Commit: Antoine Kalmbach <ane@iki.fi>
rec-mode: fixed to allow comments in records.
---
etc/rec-mode.el | 71 ++++++++++++++++++++++++++++++---------------------------
1 file changed, 37 insertions(+), 34 deletions(-)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index 43a7b6a..41e8332 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -330,7 +330,7 @@ nil"
(cond
((rec-comment-p elem) (rec-insert-comment elem))
((rec-field-p elem) (rec-insert-field elem))))
- (rec-record-fields record))))
+ (rec-record-elems record))))
;;;; Operations on record structures
;;
@@ -347,8 +347,8 @@ nil"
(when (rec-record-p record)
(nth 1 record)))
-(defun rec-record-fields (record)
- "Return a list with the fields of the given record."
+(defun rec-record-elems (record)
+ "Return a list with the elements of the given record."
(when (rec-record-p record)
(nth 2 record)))
@@ -367,7 +367,7 @@ If no such field exists in RECORD then nil is returned."
(when (and (rec-field-p field)
(equal name (rec-field-name field)))
(setq result (cons (rec-field-value field) result))))
- (rec-record-fields record))
+ (rec-record-elems record))
(reverse result))))
(defun rec-record-names (record)
@@ -377,7 +377,7 @@ If no such field exists in RECORD then nil is returned."
(mapcar (lambda (field)
(when (rec-field-p field)
(setq result (cons (rec-field-name field) result))))
- (rec-record-fields record))
+ (rec-record-elems record))
(reverse result))))
;;;; Operations on comment structures
@@ -905,19 +905,20 @@ current buffer to look like indentation."
(when (rec-record-p record)
(mapcar
(lambda (field)
- (let* ((pos (rec-field-position field))
- (value-begin (+ pos (length (rec-field-name field)) 1))
- (value-end (+ value-begin
- (length (with-temp-buffer
- (rec-insert-field-value
(rec-field-value field))
- (buffer-substring (point-min)
(point-max)))))))
- (save-excursion
- (goto-char value-begin)
- (while (re-search-forward "^\\+ ?" (+ value-end 1) t)
- (let ((ov (make-overlay (match-beginning 0) (match-end 0))))
- (overlay-put ov 'display '(space . (:width
rec-continuation-line-markers-width)))
- (push ov rec-continuation-line-markers-overlays))))))
- (rec-record-fields record)))))
+ (when (rec-field-p field)
+ (let* ((pos (rec-field-position field))
+ (value-begin (+ pos (length (rec-field-name field)) 1))
+ (value-end (+ value-begin
+ (length (with-temp-buffer
+ (rec-insert-field-value
(rec-field-value field))
+ (buffer-substring (point-min)
(point-max)))))))
+ (save-excursion
+ (goto-char value-begin)
+ (while (re-search-forward "^\\+ ?" (+ value-end 1) t)
+ (let ((ov (make-overlay (match-beginning 0) (match-end 0))))
+ (overlay-put ov 'display '(space . (:width
rec-continuation-line-markers-width)))
+ (push ov rec-continuation-line-markers-overlays)))))))
+ (rec-record-elems record)))))
(defun rec-remove-continuation-line-marker-overlays ()
"Delete all the continuation line markers overlays."
@@ -937,16 +938,17 @@ the visibility."
(when (rec-record-p record)
(mapcar
(lambda (field)
- (let ((lines-in-value (with-temp-buffer
- (insert (rec-field-value field))
- (count-lines (point-min) (point-max))))
- ov)
- (when (> lines-in-value rec-max-lines-in-fields)
- (save-excursion
- (goto-char (rec-field-position field))
- (rec-fold-field))
- t)))
- (rec-record-fields record)))))
+ (when (rec-field-p field)
+ (let ((lines-in-value (with-temp-buffer
+ (insert (rec-field-value field))
+ (count-lines (point-min) (point-max))))
+ ov)
+ (when (> lines-in-value rec-max-lines-in-fields)
+ (save-excursion
+ (goto-char (rec-field-position field))
+ (rec-fold-field))
+ t))))
+ (rec-record-elems record)))))
(defun rec-field-folded-p ()
"Return whether the current field is folded."
@@ -993,10 +995,11 @@ the visibility."
(when (rec-record-p record)
(mapcar
(lambda (field)
- (save-excursion
- (goto-char (rec-field-position field))
- (rec-unfold-field)))
- (rec-record-fields record)))))
+ (when (rec-field-p field)
+ (save-excursion
+ (goto-char (rec-field-position field))
+ (rec-unfold-field))))
+ (rec-record-elems record)))))
(defun rec-toggle-field-visibility ()
"Toggle the visibility of the current field."
@@ -2052,8 +2055,8 @@ function returns `nil'."
(let ((values (rec-record-assoc key record)))
(if values
(car values)
- (rec-field-value (car (rec-record-fields record)))))
- (rec-field-value (car (rec-record-fields record)))))))
+ (rec-field-value (car (rec-record-elems record)))))
+ (rec-field-value (car (rec-record-elems record)))))))
;;;; Definition of modes
- [elpa] externals/rec-mode 9f7a14d 43/98: rec-mode: fix edition of the default record set., (continued)
- [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, 2020/11/12
- [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 <=
- [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
- [elpa] externals/rec-mode 299b496 44/98: rec-mode: support for generating time-stamps in date fields., Stefan Monnier, 2020/11/12