GNU bug report logs - #5370
M-x hexl-mode M-x hexl-mode leaves unwanted ruler

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Wed, 13 Jan 2010 04:53:01 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 5370 in the body.
You can then email your comments to 5370 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#5370; Package emacs. (Wed, 13 Jan 2010 04:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 13 Jan 2010 04:53:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
Date: Wed, 13 Jan 2010 05:52:12 +0100
  emacs -Q
  M-x hexl-mode <RET>
  y              ; to the question about discarding undo
  M-x hexl-mode <RET>
  C-c C-c

now *scratch* has a ruler, thanks to `header-line-format' containing

   (:eval (funcall ruler-mode-ruler-function))

while `ruler-mode' is nil (so M-x ruler-mode doesn't remove it).

The second call to hexl-mode bypasses most of the hexl-mode
initialization, but runs `hexl-mode-hook', which by default contains
`hexl-activate-ruler', so the ruler is initialized again. `ruler-mode'
already has code to save header-line-format, but it seems like it
isn't dealing too well with reentering.

So, I think the bug is in ruler-mode. But, what to do? Create a stack
of previous header-line-format's? At some point the thing turns
ridiculous. In the case above, however, it is a real bug (though
harmless) because the unwary user will have a hard time removing the
ruler.

Still, shouldn't hexl-activate-ruler be a noop when the buffer is
already in hexl-mode? It is certainly possible to do

  M-x hexl-mode  ; you have a hexl ruler
  M-x ruler-mode  ; to turn it off
  M-x hexl-mode  ; you get it back

but I can't really say whether the user would expect at that point to
have a hexl ruler or not in the buffer :-)

    Juanma





Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Wed, 30 Jun 2010 22:47:02 GMT) Full text and rfc822 format available.

Notification sent to Juanma Barranquero <lekktu <at> gmail.com>:
bug acknowledged by developer. (Wed, 30 Jun 2010 22:47:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 5370-done <at> debbugs.gnu.org
Subject: Re: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
Date: Wed, 30 Jun 2010 18:46:52 -0400
> The second call to hexl-mode bypasses most of the hexl-mode
> initialization, but runs `hexl-mode-hook', which by default contains
> `hexl-activate-ruler', so the ruler is initialized again. `ruler-mode'
> already has code to save header-line-format, but it seems like it
> isn't dealing too well with reentering.
>
> So, I think the bug is in ruler-mode. But, what to do? Create a stack
> of previous header-line-format's?

The solution is to avoid saving the old header-line-format if Ruler mode
is already on.  I've checked in a fix.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5370; Package emacs. (Thu, 01 Jul 2010 00:22:01 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: cyd <at> stupidchicken.com
Cc: 5370 <at> debbugs.gnu.org
Subject: Re: bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
Date: Thu, 1 Jul 2010 02:21:03 +0200
On Thu, Jul 1, 2010 at 00:46, Chong Yidong <cyd <at> stupidchicken.com> wrote:

> The solution is to avoid saving the old header-line-format if Ruler mode
> is already on.  I've checked in a fix.

OK, thanks.

A couple questions:

Why do you need "(when enable" in ruler--save-header-line-format,
which causes this warning

  ruler-mode.el:562:9:Warning: reference to free variable `enable'

when ruler--save-header-line-format is only called once, like so

  (when enable
     (ruler--save-header-line-format))

?

Also, the docstring for r--s-h-l-f says

"Install the header line format for Ruler mode.
Unless if Ruler mode is already enabled, save the old header line
format first."

Shouldn't that be s/Unless if/Unless/?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5370; Package emacs. (Thu, 01 Jul 2010 05:33:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 5370 <at> debbugs.gnu.org
Subject: Re: bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
Date: Thu, 01 Jul 2010 01:31:53 -0400
Juanma Barranquero <lekktu <at> gmail.com> writes:

> Why do you need "(when enable" in ruler--save-header-line-format,
>
> Also, the docstring for r--s-h-l-f says
>
> "Install the header line format for Ruler mode.
> Unless if Ruler mode is already enabled, save the old header line
> format first."

Typos, sorry.  Fixed.  Thanks for checking.




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

This bug report was last modified 15 years and 24 days ago.

Previous Next


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