From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Glenn Morris <rgm@gnu.org>
Cc: Bastien Guerry <bzg@gnu.org>, 11726@debbugs.gnu.org
Subject: bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
Date: Wed, 27 Jun 2012 10:06:51 -0400 [thread overview]
Message-ID: <jwva9zo7tgp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <so62ad1c4t.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 27 Jun 2012 02:50:58 -0400")
>> I added a message after `C-x C-q' -- thanks.
> This is an annoyance.
> emacs -Q
> M-x custom TAB
> -> "Read-only enabled for this buffer" in the echo area
define-minor-mode only outputs such messages when the function is
called interactively, so we should do the same for toggle-read-only.
Or rather we should probably use something like the patch below.
But it's also the case that toggle-read-only should not be called from
Elisp, so another bug is to call toggle-read-only rather than to set
buffer-read-only.
Stefan
=== modified file 'lisp/files.el'
--- lisp/files.el 2012-06-26 16:23:01 +0000
+++ lisp/files.el 2012-06-27 14:02:59 +0000
@@ -4842,7 +4842,7 @@
"Modification-flag cleared"))
(set-buffer-modified-p arg))
-(defun toggle-read-only (&optional arg)
+(define-minor-mode toggle-read-only
"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
@@ -4855,27 +4855,17 @@
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
- (not buffer-read-only))) ; If buffer-read-only is set correctly,
- nil ; do nothing.
- ;; Toggle.
- (progn
+ :variable buffer-read-only
(cond
- ((and buffer-read-only view-mode)
+ ((and (not buffer-read-only) view-mode)
(View-exit-and-edit)
(make-local-variable 'view-read-only)
(setq view-read-only t)) ; Must leave view mode.
- ((and (not buffer-read-only) view-read-only
+ ((and buffer-read-only view-read-only
;; If view-mode is already active, `view-mode-enter' is a nop.
(not view-mode)
(not (eq (get major-mode 'mode-class) 'special)))
- (view-mode-enter))
- (t (setq buffer-read-only (not buffer-read-only))
- (force-mode-line-update))))
- (message "Read-only %s for this buffer"
- (if buffer-read-only "enabled" "disabled"))))
+ (view-mode-enter))))
(defun insert-file (filename)
"Insert contents of file FILENAME into buffer after point.
next prev parent reply other threads:[~2012-06-27 14:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-16 23:07 bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable Drew Adams
2012-06-22 14:14 ` Bastien
[not found] ` <handler.11726.D11726.134037464432067.notifdone@debbugs.gnu.org>
2012-06-27 6:50 ` bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable) Glenn Morris
2012-06-27 8:36 ` Bastien
2012-06-27 9:27 ` Andreas Schwab
2012-06-27 13:32 ` Drew Adams
2012-06-27 14:06 ` Stefan Monnier [this message]
2012-06-28 8:41 ` Bastien
2012-06-28 15:15 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwva9zo7tgp.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=11726@debbugs.gnu.org \
--cc=bzg@gnu.org \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.