aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChong Yidong2012-07-13 15:06:09 +0800
committerChong Yidong2012-07-13 15:06:09 +0800
commitb68b33375caeb82a4b3418d43c75bc8ccd43633a (patch)
tree2e14569d03369d1de85cfd81bb5a404373ec1245 /doc
parent1a95276708930fe579fff152c590df875c29570e (diff)
downloademacs-b68b33375caeb82a4b3418d43c75bc8ccd43633a.tar.gz
emacs-b68b33375caeb82a4b3418d43c75bc8ccd43633a.zip
Don't warn on toggle-read-only calls.
Clarify the documentation of toggle-read-only, and audit the code tree for uses of toggle-read-only; where appropriate, switch to setting the variable buffer-read-only or calling toggle-read-only with a (new) second arg. * lisp/files.el (toggle-read-only): Doc fix and code cleanup. New arg to allow printing the message when called from Lisp. * lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions): Remove toggle-read-only. * lisp/bindings.el (mode-line-toggle-read-only): * lisp/dired.el (dired-toggle-read-only): * lisp/ibuffer.el (ibuffer-do-toggle-read-only): Call toggle-read-only with non-nil second arg. * lisp/bs.el (bs-toggle-readonly): * lisp/buff-menu.el (Buffer-menu-toggle-read-only): Remove with-no-warnings around toggle-read-only. * lisp/ffap.el (ffap--toggle-read-only): Accept a list of buffers. Remove with-no-warnings around toggle-read-only. (ffap-read-only, ffap-read-only-other-window) (ffap-read-only-other-frame): Callers changed. * lisp/help-mode.el: Don't require view package. (help-mode-finish): Set buffer-read-only instead of calling toggle-read-only. * lisp/emacs-lisp/eieio-custom.el (eieio-customize-object): * lisp/vc/ediff.el (ediff-set-read-only-in-buf-A): Set buffer-read-only directly. * lisp/gnus/smime.el (smime-certificate-info): Set buffer-read-only directly, instead of calling toggle-read-only with a (bogus) argument. * doc/emacs/buffers.texi (Misc Buffer): Document view-read-only. * doc/lispref/buffers.texi (Read Only Buffers): Document toggle-read-only changes. Reword to account for the fact that read-only is currently not supported in overlay properties.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/buffers.texi5
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/buffers.texi45
4 files changed, 42 insertions, 18 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 311a28a3e39..fc2b7fe073a 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12012-07-13 Chong Yidong <cyd@gnu.org>
2
3 * buffers.texi (Misc Buffer): Document view-read-only.
4
12012-07-07 Chong Yidong <cyd@gnu.org> 52012-07-07 Chong Yidong <cyd@gnu.org>
2 6
3 * custom.texi (Init File): Index site-lisp (Bug#11435). 7 * custom.texi (Init File): Index site-lisp (Bug#11435).
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 159bf894834..24bb0e83778 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -232,11 +232,14 @@ have special commands to operate on the text; also by visiting a file
232whose access control says you cannot write it. 232whose access control says you cannot write it.
233 233
234@findex toggle-read-only 234@findex toggle-read-only
235@vindex view-read-only
235 The command @kbd{C-x C-q} (@code{toggle-read-only}) makes a read-only 236 The command @kbd{C-x C-q} (@code{toggle-read-only}) makes a read-only
236buffer writable, and makes a writable buffer read-only. This works by 237buffer writable, and makes a writable buffer read-only. This works by
237setting the variable @code{buffer-read-only}, which has a local value 238setting the variable @code{buffer-read-only}, which has a local value
238in each buffer and makes the buffer read-only if its value is 239in each buffer and makes the buffer read-only if its value is
239non-@code{nil}. 240non-@code{nil}. If you change the option @code{view-read-only} to a
241non-@code{nil} value, making the buffer read-only with @kbd{C-x C-q}
242also enables View mode in the buffer (@pxref{View Mode}).
240 243
241@findex rename-buffer 244@findex rename-buffer
242 @kbd{M-x rename-buffer} changes the name of the current buffer. You 245 @kbd{M-x rename-buffer} changes the name of the current buffer. You
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 1faf9e04ec1..d7875a7de90 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12012-07-13 Chong Yidong <cyd@gnu.org>
2
3 * buffers.texi (Read Only Buffers): Document toggle-read-only
4 changes. Reword to account for the fact that read-only is
5 currently not supported in overlay properties.
6
12012-07-07 Chong Yidong <cyd@gnu.org> 72012-07-07 Chong Yidong <cyd@gnu.org>
2 8
3 * loading.texi (Library Search): Index site-lisp directories. 9 * loading.texi (Library Search): Index site-lisp directories.
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 072ffeb4321..6ad329f3a30 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -730,11 +730,9 @@ The buffer is read-only if this variable is non-@code{nil}.
730@defvar inhibit-read-only 730@defvar inhibit-read-only
731If this variable is non-@code{nil}, then read-only buffers and, 731If this variable is non-@code{nil}, then read-only buffers and,
732depending on the actual value, some or all read-only characters may be 732depending on the actual value, some or all read-only characters may be
733modified. Read-only characters in a buffer are those that have 733modified. Read-only characters in a buffer are those that have a
734non-@code{nil} @code{read-only} properties (either text properties or 734non-@code{nil} @code{read-only} text property. @xref{Special
735overlay properties). @xref{Special Properties}, for more information 735Properties}, for more information about text properties.
736about text properties. @xref{Overlays}, for more information about
737overlays and their properties.
738 736
739If @code{inhibit-read-only} is @code{t}, all @code{read-only} character 737If @code{inhibit-read-only} is @code{t}, all @code{read-only} character
740properties have no effect. If @code{inhibit-read-only} is a list, then 738properties have no effect. If @code{inhibit-read-only} is a list, then
@@ -742,18 +740,31 @@ properties have no effect. If @code{inhibit-read-only} is a list, then
742of the list (comparison is done with @code{eq}). 740of the list (comparison is done with @code{eq}).
743@end defvar 741@end defvar
744 742
745@deffn Command toggle-read-only &optional arg 743@deffn Command toggle-read-only &optional arg message
746This command toggles whether the current buffer is read-only. It is 744This command toggles whether the current buffer is read-only, by
747intended for interactive use; do not use it in programs (it may have 745setting the variable @code{buffer-read-only}. If @var{arg} is
748side-effects, such as enabling View mode, and does not affect 746non-@code{nil}, it should be a raw prefix argument; the command then
749read-only text properties). To change the read-only state of a buffer in 747makes the buffer read-only if the numeric value of that prefix
750a program, explicitly set @code{buffer-read-only} to the proper value. 748argument is positive, and makes the buffer writable otherwise.
751To temporarily ignore a read-only state, bind @code{inhibit-read-only}. 749@xref{Prefix Command Arguments}.
752 750
753If @var{arg} is non-@code{nil}, it should be a raw prefix argument. 751If called interactively, or if called from Lisp with @var{message} is
754@code{toggle-read-only} sets @code{buffer-read-only} to @code{t} if 752non-@code{nil}, the command prints a message reporting the buffer's
755the numeric value of that prefix argument is positive and to 753new read-only status.
756@code{nil} otherwise. @xref{Prefix Command Arguments}. 754
755When making the buffer read-only, this command also enables View mode
756if the option @code{view-read-only} is non-@code{nil}. @xref{Misc
757Buffer,,Miscellaneous Buffer Operations, emacs, The GNU Emacs Manual}.
758When making the buffer writable, it disables View mode if View mode
759was enabled.
760
761Lisp programs should only call @code{toggle-read-only} if they really
762intend to do the same thing as the user command, including possibly
763enabling or disabling View mode. Note also that this command works by
764setting @code{buffer-read-only}, so even if you make the buffer
765writable, characters with non-@code{nil} @code{read-only} text
766properties will remain read-only. To temporarily ignore all read-only
767states, bind @code{inhibit-read-only}, as described above.
757@end deffn 768@end deffn
758 769
759@defun barf-if-buffer-read-only 770@defun barf-if-buffer-read-only