[emacs-berlin] Criticize this little elisp snippet

Michael Albinus michael.albinus at gmx.de
Mon Feb 19 08:44:55 UTC 2024

jman <emacs-berlin at city17.xyz> writes:

> Hi!


> Feel free to nitpick! :-)

Thanks for the invitation :-)

>         (write-file (format "%s/%s" save-location filename) t)))))

On a first glance, (write-file (expand-file-name filename save-location) t)
seems to be more natural. Or you let-bind default-directory to
save-location, then you can simply use (write-file filename t) .

Another nitpick is your (switch-to-buffer ...) (insert ...) sequence.
What if the buffer isn't empty? Shouldn't you erase it before inserting
something?  Or, in case you want keep the contents, shouldn't you move
point to a defined position, like (goto-char (point-min)) ?

> Thanks!

Best regards, Michael.

More information about the emacs-berlin mailing list