[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 37fa271 21/98: rec-mode: fix error when saving
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 37fa271 21/98: rec-mode: fix error when saving a newly created file |
Date: |
Thu, 12 Nov 2020 13:18:32 -0500 (EST) |
branch: externals/rec-mode
commit 37fa271c1838357c19705c3d9427b2d49ff15f80
Author: Daiki Ueno <ueno@unixuser.org>
Commit: Antoine Kalmbach <ane@iki.fi>
rec-mode: fix error when saving a newly created file
Hi,
Perhaps this is the same issue as TODO 14. I get a "Wrong type
argument: number-or-marker-p, nil" error, when I open a non-existing
file and finish editing. In that case, an erroneous value is set to
rec-buffer-descriptors:
((descriptor error: #<marker in no buffer>)
(descriptor cannot #<marker in no buffer>)
(descriptor read #<marker in no buffer>)
(descriptor file #<marker in no buffer>)
(descriptor /home/ueno/recutils/foo\.rec #<marker in no buffer>))
So I guess this could be fixed by feeding data to recinf from the buffer
instead of the file. Here is a patch.
2012-04-09 Daiki Ueno <ueno@unixuser.org>
rec-mode: fix error when rec-finish-editing on newly created file.
* etc/rec-mode.el (rec-update-buffer-descriptors): Don't assume
that the current buffer is already saved on the disk.
>From 5db6934c2ab84080b72bfc7663db9495640dbfda Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Mon, 9 Apr 2012 11:29:10 +0900
Subject: [PATCH] rec-mode: fix error when rec-finish-editing on newly
created
file.
---
etc/rec-mode.el | 54 +++++++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/etc/rec-mode.el b/etc/rec-mode.el
index 48b3317..ceafca7 100644
--- a/etc/rec-mode.el
+++ b/etc/rec-mode.el
@@ -582,31 +582,35 @@ The current record is the record where the pointer is"
"Get a list of the record descriptors in the current buffer."
(message "Updating record descriptors...")
(setq rec-buffer-descriptors
- (save-excursion
- (let ((rec-file-name (if buffer-file-name
- buffer-file-name
- ""))
- descriptors records)
- ;; Call 'recinf' to get the list of record descriptors in
- ;; sexp format.
- (with-temp-buffer
- (call-process rec-recinf
- nil ; infile
- t ; output to current buffer
- nil ; display
- "-S" "-d" rec-file-name)
- (goto-char (point-min))
- (insert "(")
- (goto-char (point-max))
- (insert ")")
- (setq descriptors (read (buffer-substring-no-properties
(point-min) (point-max)))))
- ;; Calculate the value of 'rec-buffer-descriptors'.
- (mapcar (lambda (descriptor)
- (let ((marker (make-marker)))
- (set-marker marker (rec-record-position descriptor))
- (setq records (cons (list 'descriptor descriptor
marker) records))))
- descriptors)
- (reverse records))))
+ (let ((buffer (generate-new-buffer "Rec Inf "))
+ descriptors records status)
+ (unwind-protect
+ (progn
+ ;; Call 'recinf' to get the list of record descriptors in
+ ;; sexp format.
+ (setq status (call-process-region (point-min) (point-max)
+ rec-recinf
+ nil ; delete
+ buffer
+ nil ; display
+ "-S" "-d"))
+ (if (/= status 0)
+ (error "recinf returned error: %d" status))
+ (with-current-buffer buffer
+ (goto-char (point-min))
+ (insert "(")
+ (goto-char (point-max))
+ (insert ")")
+ (setq descriptors (read (point-min-marker)))))
+ (kill-buffer buffer))
+ ;; Calculate the value of 'rec-buffer-descriptors'.
+ (mapcar (lambda (descriptor)
+ (let ((marker (make-marker)))
+ (set-marker marker (rec-record-position descriptor))
+ (setq records (cons (list 'descriptor descriptor marker)
+ records))))
+ descriptors)
+ (reverse records)))
(message ""))
(defun rec-update-buffer-descriptors-xxx ()
- [elpa] externals/rec-mode debbdd5 19/98: Time-stamp marks removed from the entire codebase and syntax checks fixes., (continued)
- [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
- [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 <=
- [elpa] externals/rec-mode 19d0cef 35/98: rec-mode: support for selection expressions in rec-count., Stefan Monnier, 2020/11/12
- [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