GNU bug report logs - #7292
Inappropriate uses of toggle-read-only?

Previous Next

Package: emacs;

Reported by: Ryan Twitchell <metatheorem <at> gmail.com>

Date: Thu, 28 Oct 2010 00:12:01 UTC

Severity: minor

Fixed in version 24.0.92

Done: Glenn Morris <rgm <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 7292 in the body.
You can then email your comments to 7292 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7292; Package emacs. (Thu, 28 Oct 2010 00:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ryan Twitchell <metatheorem <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 28 Oct 2010 00:12:01 GMT) Full text and rfc822 format available.

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

From: Ryan Twitchell <metatheorem <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: view-mode clobbers speedbar bindings
Date: Wed, 27 Oct 2010 20:03:10 -0400
Hi,

A number of speedbar's bindings, such as 'n' and 'p', do not work with
view-mode enabled in the speedbar buffer (which makes no sense anyway). 
This is relevant when view-read-only is set, causing speedbar-mode to
implicitly enable view-mode.

For my part, I have redefined speedbar-mode in my .emacs file as follows:

(require 'speedbar)
(defvar real-speedbar-mode #'speedbar-mode)
(defun speedbar-mode ()
  (let ((view-read-only nil))
    (funcall #'real-speedbar-mode)))


This appears to solve the problem.  speedbar-mode calls
toggle-read-only; binding view-read-only to nil around that call should
be a more permanent fix.

M-x emacs-version
GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of
2010-09-26 on falconsrevenge

Thanks,
Ryan Twitchell





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7292; Package emacs. (Thu, 28 Oct 2010 02:58:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Ryan Twitchell <metatheorem <at> gmail.com>
Cc: 7292 <at> debbugs.gnu.org
Subject: Re: bug#7292: view-mode clobbers speedbar bindings
Date: Wed, 27 Oct 2010 23:01:53 -0400
Ryan Twitchell wrote:

> speedbar-mode calls toggle-read-only;

Why does it do this, as opposed to `(setq buffer-read-only t)'?

(I notice a few other files call toggle-read-only as well. Seems odd.)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7292; Package emacs. (Thu, 28 Oct 2010 03:08:02 GMT) Full text and rfc822 format available.

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

From: Ryan Twitchell <metatheorem <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 7292 <at> debbugs.gnu.org
Subject: Re: bug#7292: view-mode clobbers speedbar bindings
Date: Wed, 27 Oct 2010 23:11:37 -0400
On 10/27/2010 11:01 PM, Glenn Morris wrote:
> Ryan Twitchell wrote:
>
>> speedbar-mode calls toggle-read-only;
> Why does it do this, as opposed to `(setq buffer-read-only t)'?
>
> (I notice a few other files call toggle-read-only as well. Seems odd.)

A fair question.  I suppose this is just caution: toggle-read-only will
always "do the right thing" to make sure the buffer is read-only, though
setting buffer-read-only should be sufficient.

Ryan Twitchell





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7292; Package emacs. (Fri, 29 Oct 2010 07:46:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Ryan Twitchell <metatheorem <at> gmail.com>
Cc: 7292 <at> debbugs.gnu.org
Subject: Re: bug#7292: view-mode clobbers speedbar bindings
Date: Fri, 29 Oct 2010 03:49:29 -0400
Ryan Twitchell wrote:

>> (I notice a few other files call toggle-read-only as well. Seems odd.)
>
> A fair question.  I suppose this is just caution: toggle-read-only will
> always "do the right thing" to make sure the buffer is read-only, though
> setting buffer-read-only should be sufficient.

That doesn't make sense to me. I replace several inappropriate uses,
including the speedbar one.

I wonder if toggle-read-only should even be added to
byte-compile-interactive-only-functions.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7292; Package emacs. (Fri, 29 Oct 2010 15:57:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 7292 <at> debbugs.gnu.org, Ryan Twitchell <metatheorem <at> gmail.com>
Subject: Re: bug#7292: view-mode clobbers speedbar bindings
Date: Fri, 29 Oct 2010 12:00:30 -0400
>>> (I notice a few other files call toggle-read-only as well. Seems odd.)
>> A fair question.  I suppose this is just caution: toggle-read-only will
>> always "do the right thing" to make sure the buffer is read-only, though
>> setting buffer-read-only should be sufficient.
> That doesn't make sense to me. I replace several inappropriate uses,
> including the speedbar one.
> I wonder if toggle-read-only should even be added to
> byte-compile-interactive-only-functions.

I wonder as well.  I know I'm to blame for some of the calls to
toggle-read-only, because I thought it might be better to use the
higher-level function.  But indeed it seems that was a mistake.

So let's add it to byte-compile-interactive-only-functions (with
a comment about why); and if it turns out that there are many cases
where calling it from Elisp makes sense, then we'll get to learn which
are the cases where it makes sense.


        Stefan




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 10 Nov 2011 02:20:02 GMT) Full text and rfc822 format available.

Notification sent to Ryan Twitchell <metatheorem <at> gmail.com>:
bug acknowledged by developer. (Thu, 10 Nov 2011 02:20:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 7292-done <at> debbugs.gnu.org
Subject: Re: bug#7292: view-mode clobbers speedbar bindings
Date: Wed, 09 Nov 2011 21:19:48 -0500
Version: 24.0.92

Stefan Monnier wrote:

> So let's add it to byte-compile-interactive-only-functions (with
> a comment about why); and if it turns out that there are many cases
> where calling it from Elisp makes sense, then we'll get to learn which
> are the cases where it makes sense.

Done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 08 Dec 2011 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 195 days ago.

Previous Next


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