-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace by empty string when form evaluates to nil #139
Conversation
This aligns the behavior of tempel--synchronize-fields with the one of tempel--form. Previously, if form updates returned nil, tempel did not update the form, even though during creation nil values become the empty string.
@@ -254,7 +254,7 @@ BEG and END are the boundaries of the modification." | |||
(save-excursion | |||
(goto-char (overlay-start ov)) | |||
(let (x) | |||
(setq x (or (and (setq x (overlay-get ov 'tempel--form)) (eval x (cdr st))) | |||
(setq x (or (and (setq x (overlay-get ov 'tempel--form)) (or (eval x (cdr st)) "")) | |||
(and (setq x (overlay-get ov 'tempel--name)) (alist-get x (cdr st))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change cannot be correct since the other expression with the alist-get
in the outer or
won't be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be executed if (overlay-get ov 'tempel--form)
is nil, right? And my understanding is that this is the right condition for it to be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you're probably right. We won't have both tempel--form and tempel--name at the same time? It is a while that I've hacked on Tempel...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, forms don't have names and named fields don't have forms.
(Blocked by FSF assignment) |
@luavreis I've added this small fix for now, given that single line changes do not fall under copyright assignment. |
This aligns the behavior of
tempel--synchronize-fields
with the one oftempel--form
. Previously, if form updates returned nil, tempel did not update the form, even though during creation nil values become the empty string. Submitting separate from the other PR since I don't know if the current behaviour is intentional (I found it counter-intuitive).