all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Proposal: move write-contents-functions higher up in basic-save-buffer
@ 2017-05-23  7:19 Eric Abrahamsen
  2017-05-23  7:25 ` Eric Abrahamsen
  2017-05-23 18:39 ` Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Eric Abrahamsen @ 2017-05-23  7:19 UTC (permalink / raw)
  To: emacs-devel

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.

Then `save-some-buffers' could check for the buffer-local presence of
this variable, and do the save. `do-auto-save' would behave the same.
"s" could be bound to `save-buffer' by default in special-mode.

WDYT? I think the docstring of `write-contents-functions' already
supports this interpretation, it just needs a bit of tweaking to divorce
it from buffer-file-name altogether.

Eric

PS: My original idea was to introduce a buffer-local
`save-buffer-function' variable, but I think this makes more sense.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-05-28 10:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.