toggle-read-only fixes for bugs#7292, 10006.
* doc/lispref/buffers.texi (Read Only Buffers): Expand a bit on why toggle-read-only should only be used interactively. * lisp/files.el (toggle-read-only): Mention that it should only be used interactively. * lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions): Add toggle-read-only.
This commit is contained in:
parent
c4e7c63af1
commit
b2621720c3
5 changed files with 27 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-11-10 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* buffers.texi (Read Only Buffers): Expand a bit on why
|
||||
toggle-read-only should only be used interactively. (Bug#7292)
|
||||
|
||||
2011-11-09 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* windows.texi (Window Sizes): Document window-pixel-edges,
|
||||
|
|
|
@ -748,10 +748,11 @@ of the list (comparison is done with @code{eq}).
|
|||
|
||||
@deffn Command toggle-read-only &optional arg
|
||||
This command toggles whether the current buffer is read-only. It is
|
||||
intended for interactive use; do not use it in programs. At any given
|
||||
point in a program, you should know whether you want the read-only flag
|
||||
on or off; so you can set @code{buffer-read-only} explicitly to the
|
||||
proper value, @code{t} or @code{nil}.
|
||||
intended for interactive use; do not use it in programs (it may have
|
||||
side-effects, such as enabling View mode, and does not affect
|
||||
read-only text properties). To change the read-only state of a buffer in
|
||||
a program, explicitly set @code{buffer-read-only} to the proper value.
|
||||
To temporarily ignore a read-only state, bind @code{inhibit-read-only}.
|
||||
|
||||
If @var{arg} is non-@code{nil}, it should be a raw prefix argument.
|
||||
@code{toggle-read-only} sets @code{buffer-read-only} to @code{t} if
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2011-11-10 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
|
||||
Add toggle-read-only. (Bug#7292)
|
||||
* files.el (toggle-read-only): Mention that it should only
|
||||
be used interactively. (Bug#10006)
|
||||
|
||||
2011-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* progmodes/compile.el (compilation-error-regexp-alist-alist):
|
||||
|
|
|
@ -355,7 +355,7 @@ else the global value will be modified."
|
|||
(defvar byte-compile-interactive-only-functions
|
||||
'(beginning-of-buffer end-of-buffer replace-string replace-regexp
|
||||
insert-file insert-buffer insert-file-literally previous-line next-line
|
||||
goto-line comint-run delete-backward-char)
|
||||
goto-line comint-run delete-backward-char toggle-read-only)
|
||||
"List of commands that are not meant to be called from Lisp.")
|
||||
|
||||
(defvar byte-compile-not-obsolete-vars nil
|
||||
|
|
|
@ -4686,7 +4686,15 @@ prints a message in the minibuffer. Instead, use `set-buffer-modified-p'."
|
|||
"Change whether this buffer is read-only.
|
||||
With prefix argument ARG, make the buffer read-only if ARG is
|
||||
positive, otherwise make it writable. If buffer is read-only
|
||||
and `view-read-only' is non-nil, enter view mode."
|
||||
and `view-read-only' is non-nil, enter view mode.
|
||||
|
||||
This function is usually the wrong thing to use in a Lisp program.
|
||||
It can have side-effects beyond changing the read-only status of a buffer
|
||||
\(e.g., enabling view mode), and does not affect read-only regions that
|
||||
are caused by text properties. To make a buffer read-only in Lisp code,
|
||||
set `buffer-read-only'. To ignore read-only status (whether due to text
|
||||
properties or buffer state) and make changes, temporarily bind
|
||||
`inhibit-read-only'."
|
||||
(interactive "P")
|
||||
(if (and arg
|
||||
(if (> (prefix-numeric-value arg) 0) buffer-read-only
|
||||
|
|
Loading…
Add table
Reference in a new issue