all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
@ 2010-01-13  4:52 Juanma Barranquero
  2010-06-30 22:46 ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2010-01-13  4:52 UTC (permalink / raw)
  To: Bug-Gnu-Emacs

  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







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

* bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
  2010-01-13  4:52 bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler Juanma Barranquero
@ 2010-06-30 22:46 ` Chong Yidong
  2010-07-01  0:21   ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2010-06-30 22:46 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 5370-done

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





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

* bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
  2010-06-30 22:46 ` Chong Yidong
@ 2010-07-01  0:21   ` Juanma Barranquero
  2010-07-01  5:31     ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2010-07-01  0:21 UTC (permalink / raw)
  To: cyd; +Cc: 5370

On Thu, Jul 1, 2010 at 00:46, Chong Yidong <cyd@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





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

* bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler
  2010-07-01  0:21   ` Juanma Barranquero
@ 2010-07-01  5:31     ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2010-07-01  5:31 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 5370

Juanma Barranquero <lekktu@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.





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

end of thread, other threads:[~2010-07-01  5:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13  4:52 bug#5370: M-x hexl-mode M-x hexl-mode leaves unwanted ruler Juanma Barranquero
2010-06-30 22:46 ` Chong Yidong
2010-07-01  0:21   ` Juanma Barranquero
2010-07-01  5:31     ` Chong Yidong

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.