unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* hook for buffers becoming writable/read-only
@ 2009-07-22  3:39 Steve Yegge
  2009-07-22 17:44 ` Lennart Borgman
  2009-07-22 18:23 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Yegge @ 2009-07-22  3:39 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

I have a minor mode that wishes to disable itself when the bufferbecomes
writable, but I do not see a way to do it.
The closest existing scenario I can see is view-mode, but view-mode
is special-cased in toggle-read-only, rather than listening on a hook.
This does not seem clean.

Moreover, most modes do not use toggle-read-only; they set the
buffer-read-only variable directly.  This has the (in my mind) unwanted
side-effect of leaving a writable buffer in view-mode if it is made
writable by setting the variable directly.

The semantics are admittedly a bit vague with respect to temporary
changes from let-binding buffer-read-only or inhibit-read-only, but
I would be satisfied if the hook were run on any persistent change
to the buffer-read-only variable.

Perhaps rather than creating a new hook, we could simply call the
before-change-functions and after-change-functions when the buffer
read-only status changes.

-steve

[-- Attachment #2: Type: text/html, Size: 1174 bytes --]

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

end of thread, other threads:[~2009-07-22 20:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22  3:39 hook for buffers becoming writable/read-only Steve Yegge
2009-07-22 17:44 ` Lennart Borgman
2009-07-22 18:23 ` Stefan Monnier
2009-07-22 20:42   ` Steve Yegge

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).