emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106342: toggle-read-only fixes for b


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106342: toggle-read-only fixes for bugs#7292, 10006.
Date: Wed, 09 Nov 2011 21:17:45 -0500
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106342
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2011-11-09 21:17:45 -0500
message:
  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.
modified:
  doc/lispref/ChangeLog
  doc/lispref/buffers.texi
  lisp/ChangeLog
  lisp/emacs-lisp/bytecomp.el
  lisp/files.el
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2011-11-09 16:18:33 +0000
+++ b/doc/lispref/ChangeLog     2011-11-10 02:17:45 +0000
@@ -1,3 +1,8 @@
+2011-11-10  Glenn Morris  <address@hidden>
+
+       * 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  <address@hidden>
 
        * windows.texi (Window Sizes): Document window-pixel-edges,

=== modified file 'doc/lispref/buffers.texi'
--- a/doc/lispref/buffers.texi  2011-10-09 12:26:29 +0000
+++ b/doc/lispref/buffers.texi  2011-11-10 02:17:45 +0000
@@ -748,10 +748,11 @@
 
 @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 address@hidden, it should be a raw prefix argument.
 @code{toggle-read-only} sets @code{buffer-read-only} to @code{t} if

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-11-09 16:18:33 +0000
+++ b/lisp/ChangeLog    2011-11-10 02:17:45 +0000
@@ -1,3 +1,10 @@
+2011-11-10  Glenn Morris  <address@hidden>
+
+       * 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  <address@hidden>
 
        * progmodes/compile.el (compilation-error-regexp-alist-alist):

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2011-09-17 09:29:01 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2011-11-10 02:17:45 +0000
@@ -355,7 +355,7 @@
 (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

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2011-11-07 14:34:02 +0000
+++ b/lisp/files.el     2011-11-10 02:17:45 +0000
@@ -4686,7 +4686,15 @@
   "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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]