diff options
| author | Chong Yidong | 2012-07-13 15:06:09 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-07-13 15:06:09 +0800 |
| commit | b68b33375caeb82a4b3418d43c75bc8ccd43633a (patch) | |
| tree | 2e14569d03369d1de85cfd81bb5a404373ec1245 /doc | |
| parent | 1a95276708930fe579fff152c590df875c29570e (diff) | |
| download | emacs-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/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/emacs/buffers.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/buffers.texi | 45 |
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 @@ | |||
| 1 | 2012-07-13 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * buffers.texi (Misc Buffer): Document view-read-only. | ||
| 4 | |||
| 1 | 2012-07-07 Chong Yidong <cyd@gnu.org> | 5 | 2012-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 | |||
| 232 | whose access control says you cannot write it. | 232 | whose 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 |
| 236 | buffer writable, and makes a writable buffer read-only. This works by | 237 | buffer writable, and makes a writable buffer read-only. This works by |
| 237 | setting the variable @code{buffer-read-only}, which has a local value | 238 | setting the variable @code{buffer-read-only}, which has a local value |
| 238 | in each buffer and makes the buffer read-only if its value is | 239 | in each buffer and makes the buffer read-only if its value is |
| 239 | non-@code{nil}. | 240 | non-@code{nil}. If you change the option @code{view-read-only} to a |
| 241 | non-@code{nil} value, making the buffer read-only with @kbd{C-x C-q} | ||
| 242 | also 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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-07-07 Chong Yidong <cyd@gnu.org> | 7 | 2012-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 |
| 731 | If this variable is non-@code{nil}, then read-only buffers and, | 731 | If this variable is non-@code{nil}, then read-only buffers and, |
| 732 | depending on the actual value, some or all read-only characters may be | 732 | depending on the actual value, some or all read-only characters may be |
| 733 | modified. Read-only characters in a buffer are those that have | 733 | modified. Read-only characters in a buffer are those that have a |
| 734 | non-@code{nil} @code{read-only} properties (either text properties or | 734 | non-@code{nil} @code{read-only} text property. @xref{Special |
| 735 | overlay properties). @xref{Special Properties}, for more information | 735 | Properties}, for more information about text properties. |
| 736 | about text properties. @xref{Overlays}, for more information about | ||
| 737 | overlays and their properties. | ||
| 738 | 736 | ||
| 739 | If @code{inhibit-read-only} is @code{t}, all @code{read-only} character | 737 | If @code{inhibit-read-only} is @code{t}, all @code{read-only} character |
| 740 | properties have no effect. If @code{inhibit-read-only} is a list, then | 738 | properties 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 | |||
| 742 | of the list (comparison is done with @code{eq}). | 740 | of 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 |
| 746 | This command toggles whether the current buffer is read-only. It is | 744 | This command toggles whether the current buffer is read-only, by |
| 747 | intended for interactive use; do not use it in programs (it may have | 745 | setting the variable @code{buffer-read-only}. If @var{arg} is |
| 748 | side-effects, such as enabling View mode, and does not affect | 746 | non-@code{nil}, it should be a raw prefix argument; the command then |
| 749 | read-only text properties). To change the read-only state of a buffer in | 747 | makes the buffer read-only if the numeric value of that prefix |
| 750 | a program, explicitly set @code{buffer-read-only} to the proper value. | 748 | argument is positive, and makes the buffer writable otherwise. |
| 751 | To temporarily ignore a read-only state, bind @code{inhibit-read-only}. | 749 | @xref{Prefix Command Arguments}. |
| 752 | 750 | ||
| 753 | If @var{arg} is non-@code{nil}, it should be a raw prefix argument. | 751 | If 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 | 752 | non-@code{nil}, the command prints a message reporting the buffer's |
| 755 | the numeric value of that prefix argument is positive and to | 753 | new read-only status. |
| 756 | @code{nil} otherwise. @xref{Prefix Command Arguments}. | 754 | |
| 755 | When making the buffer read-only, this command also enables View mode | ||
| 756 | if the option @code{view-read-only} is non-@code{nil}. @xref{Misc | ||
| 757 | Buffer,,Miscellaneous Buffer Operations, emacs, The GNU Emacs Manual}. | ||
| 758 | When making the buffer writable, it disables View mode if View mode | ||
| 759 | was enabled. | ||
| 760 | |||
| 761 | Lisp programs should only call @code{toggle-read-only} if they really | ||
| 762 | intend to do the same thing as the user command, including possibly | ||
| 763 | enabling or disabling View mode. Note also that this command works by | ||
| 764 | setting @code{buffer-read-only}, so even if you make the buffer | ||
| 765 | writable, characters with non-@code{nil} @code{read-only} text | ||
| 766 | properties will remain read-only. To temporarily ignore all read-only | ||
| 767 | states, 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 |