emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hook for buffers becoming writable/read-only


From: Lennart Borgman
Subject: Re: hook for buffers becoming writable/read-only
Date: Wed, 22 Jul 2009 19:44:13 +0200

On Wed, Jul 22, 2009 at 5:39 AM, Steve Yegge<address@hidden> wrote:
> I have a minor mode that wishes to disable itself when the buffer
> becomes writable, but I do not see a way to do it.

Don't you have to define "when" a bit closer here?


> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]