summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-11-09 21:17:45 -0500
committerGlenn Morris <rgm@gnu.org>2011-11-09 21:17:45 -0500
commitb2621720c318257be0d4100d695b62986db88b4f (patch)
treeea4147a75f38b69ff7abb4ee550433e562ecaac3 /lisp/files.el
parentc4e7c63af11781a1c79c119ef4a2b8c2b74637d6 (diff)
downloademacs-b2621720c318257be0d4100d695b62986db88b4f.tar.gz
emacs-b2621720c318257be0d4100d695b62986db88b4f.tar.bz2
emacs-b2621720c318257be0d4100d695b62986db88b4f.zip
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.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/files.el b/lisp/files.el
index acff3395019..aac415c1a96 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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