unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
Subject: Re: Proposal: move write-contents-functions higher up in basic-save-buffer
Date: Wed, 24 May 2017 12:55:53 +0800	[thread overview]
Message-ID: <87poeyyht2.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 83h90bm11c.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Wed, 24 May 2017 07:09:07 +0800
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> >> Date: Tue, 23 May 2017 15:19:11 +0800
>> >> 
>> >> Most special-mode buffers aren't visiting a file, and thus they miss out
>> >> on all the `do-auto-save' and `save-some-buffers' mechanisms. I'd guess
>> >> a fair number of packages that use special-mode *do* have some concept
>> >> of saving, or persisting data in some other way.
>> >> 
>> >> I think the `write-contents-functions' hook would be an ideal way of
>> >> solving this problem, except that the way `basic-save-buffer' is
>> >> written, it won't let you get that far without having a file name.
>> >> 
>> >> My proposal is to declare `write-contents-functions' as *explicitly* a
>> >> hook for buffers that don't have any file associated with them at all
>> >> (this would be in contrast to `write-file-functions'). Then we'd move it
>> >> up higher in the process: either earlier in `basic-save-buffer', or all
>> >> the way up to `save-buffer' -- that way `basic-save-buffer' could only
>> >> be for buffers that have a file.
>> >
>> > Did you investigate the alternative -- teach basic-save-buffer to save
>> > buffers that don't visit files?  If that's possible, it should be
>> > easier.
>> 
>> I thought that's what I was doing!
>
> I was referring specifically to this party of your description:
>
>> I think the `write-contents-functions' hook would be an ideal way of
>> solving this problem, except that the way `basic-save-buffer' is
>> written, it won't let you get that far without having a file name.
>
> My thinking was that by somehow overcoming this obstacle, you can
> allow users to easily use write-contents-functions as they need.
>
> Does this make sense?  If not, can you tell what is the difficulty in
> this regard?

I probably just did a poor job writing the initial message. That's what
I was proposing to begin with: to jiggle `basic-save-buffer' (and I
think also `save-some-buffers') so that the running of
`write-contents-functions' comes earlier in the function, or is
otherwise in its own branch that doesn't require a `buffer-file-name'. I
think it would be a fairly unintrusive change, it would just require a
bit of thought. I can try to produce a patch, if this is acceptable in
principle.

Eric




  reply	other threads:[~2017-05-24  4:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23  7:19 Proposal: move write-contents-functions higher up in basic-save-buffer Eric Abrahamsen
2017-05-23  7:25 ` Eric Abrahamsen
2017-05-23 18:41   ` Eli Zaretskii
2017-05-23 18:39 ` Eli Zaretskii
2017-05-23 23:09   ` Eric Abrahamsen
2017-05-24  2:38     ` Eli Zaretskii
2017-05-24  4:55       ` Eric Abrahamsen [this message]
2017-05-24 12:29         ` Stefan Monnier
2017-05-25  7:42           ` Eric Abrahamsen
2017-05-24 17:46         ` Eli Zaretskii
2017-05-24 14:12     ` Richard Stallman
2017-05-28 10:12     ` Eric Abrahamsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87poeyyht2.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).