emacs-devel
[Top][All Lists]
Advanced

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

Re: toggle-read-only should not give compilation warnings


From: Chong Yidong
Subject: Re: toggle-read-only should not give compilation warnings
Date: Fri, 13 Jul 2012 13:22:45 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Glenn Morris <address@hidden> writes:

> IMO, it would be better to factor out the view mode enabling piece to
> a separate function to be explicitly called when necessary after
> setting buffer-read-only.  This would then remove the ambiguity.
>
> Some issues caused by inappropriate use of toggle-read-only are: 7292,
> 10006.

toggle-read-only does two View mode related things: (i) if the buffer is
in View mode, making it writable disables View mode; and (ii) if
`view-read-only' is non-nil, making the buffer read-only enables View
mode.

As far as I can tell, (i) is generally desirable, even in Lisp calls;
otherwise the buffer ends up in an unsatisfactory state where most
self-inserting keys do the usual thing but SPC scrolls.  Bug#7292 is a
case where the Lisp caller is not set up to handle (ii) properly, and in
that case setting `buffer-read-only' is the right thing to do.  But
there are many other cases where Lisp callers really want to do the same
as C-x C-q, including obeying `view-read-only'.

As for Bug#10006, that is a plain misunderstanding about the
`buffer-read-only' variable; the reporter could have filed the same bug
with respect to an interactive invocation of `C-x C-q'.  So it doesn't
seem relevant.

> Maybe on average it's right to use it as often as it is wrong. A
> warning at least might make people thunk about whether they do want to
> use it.

A prevalance of spurious warnings tend to mask real ones, by teaching
people to ignore warnings.  So I'd like to get rid of these one way or
another---but preferably without sprinking with-no-warnings all over the
place.



reply via email to

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