unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable
@ 2012-06-16 23:07 Drew Adams
  2012-06-22 14:14 ` Bastien
       [not found] ` <handler.11726.D11726.134037464432067.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Drew Adams @ 2012-06-16 23:07 UTC (permalink / raw)
  To: 11726

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'
 






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable
  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>
  1 sibling, 0 replies; 9+ messages in thread
From: Bastien @ 2012-06-22 14:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11726-done

Hi Drew,

"Drew Adams" <drew.adams@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
       [not found] ` <handler.11726.D11726.134037464432067.notifdone@debbugs.gnu.org>
@ 2012-06-27  6:50   ` Glenn Morris
  2012-06-27  8:36     ` Bastien
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Glenn Morris @ 2012-06-27  6:50 UTC (permalink / raw)
  To: 11726; +Cc: Bastien Guerry


> 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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
  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 14:06     ` Stefan Monnier
  2 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2012-06-27  8:36 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 11726

Glenn Morris <rgm@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
  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
  2 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2012-06-27  9:27 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Bastien Guerry, 11726

Glenn Morris <rgm@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
  2012-06-27  9:27     ` Andreas Schwab
@ 2012-06-27 13:32       ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2012-06-27 13:32 UTC (permalink / raw)
  To: 'Andreas Schwab', 'Glenn Morris'
  Cc: 'Bastien Guerry', 11726

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






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
  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 14:06     ` Stefan Monnier
  2012-06-28  8:41       ` Bastien
  2 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2012-06-27 14:06 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Bastien Guerry, 11726

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






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
  2012-06-27 14:06     ` Stefan Monnier
@ 2012-06-28  8:41       ` Bastien
  2012-06-28 15:15         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2012-06-28  8:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11726

Hi Stefan,

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable)
  2012-06-28  8:41       ` Bastien
@ 2012-06-28 15:15         ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2012-06-28 15:15 UTC (permalink / raw)
  To: Bastien; +Cc: 11726

>> === modified file 'lisp/files.el'
> This patch has not been applied to the trunk, right?

No.


        Stefan





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-28 15:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-06-28  8:41       ` Bastien
2012-06-28 15:15         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).