Closed piater closed 10 months ago
is this something you use programmatically? but otherwise doesn't change the default behavior?
is this something you use programmatically?
Yes.
but otherwise doesn't change the default behavior?
Correct.
I wonder if a simpler way to do this is instead of using a new argument, just check if the buffer is visiting a file.
e.g.
(when (buffer-file-name)
(save-buffer))
That should have an effect of not saving in a temp buffer that has no file.
I think the idiomatic way to write your small change is preferrably
(unless nosave
(save-buffer))
I updated the pull request according to your first suggestion, which I think perfectly expresses what's going on (save iff there is a file to save to).
Thanks also for reminding me of the unless
function.
Not saving is useful e.g. when inserting into a temp buffer.
If you agree to do me this favor :-) It will simplify my org-refman project (not (yet?) public). (There are no such uses inside org-ref for now.)