[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rec-mode: Symbol’s value as variable is void: res-type
From: |
Giovanni Biscuolo |
Subject: |
Re: rec-mode: Symbol’s value as variable is void: res-type |
Date: |
Thu, 31 Mar 2022 18:31:49 +0200 |
Hi Liliana and Antoine,
it seems rec-mode have a bug affecting Emacs 27.2
Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> I'm experiencing something similar (also using recutils with Guix).
Yes I know, nice to find you here, too :-)
[...]
> Inside my init.el, I redefined it to the following (using an override
> advice):
> --8<---------------cut here---------------start------------->8---
> (and-let* ((descriptor (rec-current-record-descriptor))
> (types (rec-record-assoc "%type" descriptor)))
> (let (res-type)
> ...))
> --8<---------------cut here---------------end--------------->8---
I did the same and it also works for me, thanks!
> It appears as though the implementation assumes that if-let* can
> introduce new variables, which at least in Emacs 27.2 it does not.
Do you know if this was working with older Emacs versions?
> I have yet to observe bugs in my implementation, but that doesn't mean
> there are none, so use with care.
I'm still making simple training sessions/tests with recfiles so I don't
have large or complex databases, but I'll give some feedback here if
I'll get some problem/bug (I don't think will occur)
Here is the patch to rec-mode.el:
--8<---------------cut here---------------start------------->8---
--- #<buffer rec-mode.el>
+++ #<buffer rec-mode-patched.el>
@@ -1289,9 +1289,9 @@
If the field has no type, i.e. it is an unrestricted field which
can contain any text, then nil is returned."
- (if-let ((descriptor (rec-current-record-descriptor))
- (types (rec-record-assoc "%type" descriptor))
- res-type)
+ (and-let* ((descriptor (rec-current-record-descriptor))
+ (types (rec-record-assoc "%type" descriptor)))
+ (let (res-type)
;; Note that invalid %type entries are simply ignored.
(mapc
(lambda (type-descr)
@@ -1309,7 +1309,7 @@
(setq res-type (rec-parse-type (buffer-substring
(point) (point-max)))))
(goto-char (match-end 0))))))))
types)
- res-type))
+ res-type)))
;;;; Mode line and Head line
--8<---------------cut here---------------end--------------->8---
Antoine Kalmbach WDYT of this patch please?
Thanks! Giovanni
--
Giovanni Biscuolo
Xelera IT Infrastructures
signature.asc
Description: PGP signature