bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67313: [PATCH] New command write-file-no-switch


From: Eli Zaretskii
Subject: bug#67313: [PATCH] New command write-file-no-switch
Date: Tue, 21 Nov 2023 13:26:49 +0200

> Date: Mon, 20 Nov 2023 23:33:27 +0000
> From:  Jeremy Bryant via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> By default write-file changes the buffer to point to the new filename,
> but a user may wish to simply do the equivalent of write-file without
> switching, as a sort of backup file.
> 
> The attached is a patch concept to introduce the idea.  Please let me
> know if this makes sense to introduce a new command rather than
> modifying the existing one (which may be less convenient).  I understand
> there would be additional things to do for new commands, but would like
> to propose the idea first.  Any suggestions welcome.

Why is it not enough to be able to use "M-x write-region"?

In any case, a new command is definitely overkill, IMO.

> +  (copy-file buffer-file-name filename)

This doesn't write the buffer to the file, it copies the file visited
by the buffer to the new file.  So if the buffer has unsaved edits,
they will not be written, unlike what write-file does.

Also, what if this command is invoked from a buffer that doesn't visit
any file, and thus buffer-file-name is nil?

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]