[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: following .txt link point at eob
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Mon, 16 Aug 2010 14:18:57 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11303
- References: <87aaovqpxm.fsf@xxxxxxxxx> <b4md3trs0o1.fsf@xxxxxxx> <87mxsod594.fsf@xxxxxxxxx>
In [emacs-w3m : No.11302] Kevin Ryde wrote:
> Incidentally, in that func
I.e. `w3m-create-text-page' that modifies contents of a w3m-mode
buffer which is normally kept read-only.
> is there more virtue in let-binding
> buffer-read-only, as opposed to inhibit-read-only? I had
> buffer-read-only in some of my own code too and then wondered if it was
> wise to let-bind a buffer-local variable. The elisp manual doesn't seem
> to have much guidance, and even reads like maybe it doesn't matter.
What `inhibit-read-only' was first introduced in was Emacs 19.13
(by RMS), so to bind `buffer-read-only' may be a trace of
the Emacs 18 era. In Gnus, Stefan Monnier seems to have changed
`buffer-read-only' to `inhibit-read-only' though it's not been
egrep '\(buffer-read-only( nil|\))' *.el| wc -l
grep '(inhibit-read-only t)' *.el| wc -l
In emacs-w3m and shimbun, those are 24 and 2 respectively. Wow!
I guess Emacs sees `inhibit-read-only' first and then
`buffer-read-only' (iff the former is nil) to check if the buffer
is writable. So, the code that uses `inhibit-read-only' may be
faster than the one using `buffer-read-only'. I feel the use of
`inhibit-read-only' reasonable if it is used for overriding the
read-only'ness of a buffer temporarily.