Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

soficshift
Copy link

@soficshift soficshift commented Jun 5, 2024

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. Submitting separate from the other PR since I don't know if the current behaviour is intentional (I found it counter-intuitive).

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)))))
Copy link
Owner

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.

Copy link
Author

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.

Copy link
Owner

@minad minad Jun 5, 2024

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...

Copy link
Author

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.

@minad minad closed this Jun 30, 2024
@minad
Copy link
Owner

minad commented Jun 30, 2024

(Blocked by FSF assignment)

@minad
Copy link
Owner

minad commented Jul 18, 2024

@luavreis I've added this small fix for now, given that single line changes do not fall under copyright assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants