all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jeremy Bryant <jb@jeremybryant.net>
Cc: 67313@debbugs.gnu.org
Subject: bug#67313: [PATCH] New command write-file-no-switch
Date: Tue, 21 Nov 2023 13:26:49 +0200	[thread overview]
Message-ID: <83h6lfibye.fsf@gnu.org> (raw)
In-Reply-To: <87zfz8dmk5.fsf@jeremybryant.net> (bug-gnu-emacs@gnu.org)

> 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	other threads:[~2023-11-21 11:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 23:33 bug#67313: [PATCH] New command write-file-no-switch Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-21 11:26 ` Eli Zaretskii [this message]
2023-11-21 22:52   ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-24  8:04     ` Eli Zaretskii
2023-11-30 23:18       ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-01  8:38         ` Eli Zaretskii
2023-12-01 23:11           ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h6lfibye.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67313@debbugs.gnu.org \
    --cc=jb@jeremybryant.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.