all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Should write-contents-functions be permanent-local?
@ 2023-08-15  6:35 Joseph Turner
  2023-08-15 11:52 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Turner @ 2023-08-15  6:35 UTC (permalink / raw)
  To: emacs-devel

In hyperdrive.el, we set write-contents-functions in a local minor mode
so that buffer contents can be written to a hyperdrive "file." In our
use-case, we want write-contents-functions to stay the same even when
the user manually changes the buffer's major mode. AFAIK, there's no way
to make a variable permanent-local on a per-buffer basis, and we don't
dare to make write-contents-functions permanent-local globally.

The solution we came up with in hyperdrive.el is to hook into
after-change-major-mode-hook with a function (with permanent-local-hook)
that sets write-contents-functions after kill-all-local-variables:

https://git.sr.ht/~ushin/hyperdrive.el/tree/master/item/hyperdrive.el#L320

Does anyone have a better solution?

WDYT about making write-contents-functions permanent-local?

Joseph



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

end of thread, other threads:[~2023-08-16  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-15  6:35 Should write-contents-functions be permanent-local? Joseph Turner
2023-08-15 11:52 ` Eli Zaretskii
2023-08-16  1:48   ` Joseph Turner

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.