GNU bug report logs - #11726
24.1; `C-x C-q' should say that the buffer is now read only or writable

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sat, 16 Jun 2012 23:12:02 UTC

Severity: normal

Found in version 24.1

Done: Bastien <bzg <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11726 in the body.
You can then email your comments to 11726 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Sat, 16 Jun 2012 23:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 16 Jun 2012 23:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.1;
	`C-x C-q' should say that the buffer is now read only or writable
Date: Sat, 16 Jun 2012 16:07:42 -0700
Subject line says it all.  Yes, the mode line tells you the new status,
but it is common courtesy for a mode toggle to announce the new state
with a message.  Newbies, in particular, can benefit from such a
message, not necessarily noticing or understanding the mode-line symbol
change.

In GNU Emacs 24.1.1 (i386-mingw-nt5.1.2600)
 of 2012-06-10 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'
 





Reply sent to Bastien <bzg <at> gnu.org>:
You have taken responsibility. (Fri, 22 Jun 2012 14:18:02 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Fri, 22 Jun 2012 14:18:03 GMT) Full text and rfc822 format available.

Message #10 received at 11726-done <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> gnu.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11726-done <at> debbugs.gnu.org
Subject: Re: bug#11726: 24.1;
	`C-x C-q' should say that the buffer is now read only or writable
Date: Fri, 22 Jun 2012 16:14:32 +0200
Hi Drew,

"Drew Adams" <drew.adams <at> oracle.com> writes:

> Subject line says it all.  Yes, the mode line tells you the new status,
> but it is common courtesy for a mode toggle to announce the new state
> with a message.  Newbies, in particular, can benefit from such a
> message, not necessarily noticing or understanding the mode-line symbol
> change.

I added a message after `C-x C-q' -- thanks.

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Wed, 27 Jun 2012 06:56:02 GMT) Full text and rfc822 format available.

Message #13 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 11726 <at> debbugs.gnu.org
Cc: Bastien Guerry <bzg <at> gnu.org>
Subject: Re: 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 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Wed, 27 Jun 2012 08:41:01 GMT) Full text and rfc822 format available.

Message #16 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 11726 <at> debbugs.gnu.org
Subject: Re: 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:36:39 +0200
Glenn Morris <rgm <at> gnu.org> writes:

>> I added a message after `C-x C-q' -- thanks.
>
> This is an annoyance.

Is this an annoyance for toggle-* commands in general or 
just for this one?

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Wed, 27 Jun 2012 09:32:02 GMT) Full text and rfc822 format available.

Message #19 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Bastien Guerry <bzg <at> gnu.org>, 11726 <at> debbugs.gnu.org
Subject: Re: 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 11:27:06 +0200
Glenn Morris <rgm <at> gnu.org> writes:

>> 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

I think the uses of toggle-read-only in help-mode-finish and
completion-list-mode-finish should be eliminated.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Wed, 27 Jun 2012 13:38:02 GMT) Full text and rfc822 format available.

Message #22 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Andreas Schwab'" <schwab <at> linux-m68k.org>, "'Glenn Morris'" <rgm <at> gnu.org>
Cc: 'Bastien Guerry' <bzg <at> gnu.org>, 11726 <at> debbugs.gnu.org
Subject: RE: 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 06:32:50 -0700
> I think the uses of toggle-read-only in help-mode-finish and
> completion-list-mode-finish should be eliminated.

I think I'm OK with that.

Probably if there is some programmatic double toggling we should suppress the
messages.  But the message should definitely be there for interactive toggling.

In between (programmatic, only off or only on), it is more of a judgment call,
and maybe should be handled case by case.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Wed, 27 Jun 2012 14:12:02 GMT) Full text and rfc822 format available.

Message #25 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Bastien Guerry <bzg <at> gnu.org>, 11726 <at> debbugs.gnu.org
Subject: Re: 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
>> 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Thu, 28 Jun 2012 08:45:02 GMT) Full text and rfc822 format available.

Message #28 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, 11726 <at> debbugs.gnu.org
Subject: Re: bug#11726: closed (Re: bug#11726: 24.1;
	`C-x C-q' should say that the buffer is now read only or writable)
Date: Thu, 28 Jun 2012 10:41:12 +0200
Hi Stefan,

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> === modified file 'lisp/files.el'

This patch has not been applied to the trunk, right?

Sorry for closing the bug too hastily with a half-backed solution.

Best,

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11726; Package emacs. (Thu, 28 Jun 2012 15:20:02 GMT) Full text and rfc822 format available.

Message #31 received at 11726 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Bastien <bzg <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 11726 <at> debbugs.gnu.org
Subject: Re: bug#11726: closed (Re: bug#11726: 24.1;
	`C-x C-q' should say that the buffer is now read only or writable)
Date: Thu, 28 Jun 2012 11:15:45 -0400
>> === modified file 'lisp/files.el'
> This patch has not been applied to the trunk, right?

No.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 27 Jul 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 324 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.