GNU bug report logs - #10275
speedbar highlights first selected item in speedbar-highlight-face

Previous Next

Package: emacs;

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

Date: Sun, 11 Dec 2011 14:09:02 UTC

Severity: minor

Done: Chong Yidong <cyd <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 10275 in the body.
You can then email your comments to 10275 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#10275; Package emacs. (Sun, 11 Dec 2011 14:09:02 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. (Sun, 11 Dec 2011 14:09: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: speedbar highlights first selected item in speedbar-highlight-face
Date: Sun, 11 Dec 2011 15:06:20 +0100
[Message part 1 (text/plain, inline)]
Package: emacs
Severity: minor

emacs -Q -f speedbar
;; then select any source file in speedbar, click to unfold it, and
click over any variable or function.

What happens:
- The file is highlighted in the Speedbar frame, with `speedbar-highlight-face'.
- The file is loaded into a buffer and displayed in a window.
- The selected variable or function is shown, and also highlighted
with `speedbar-highlight-face'.

Clicking into another subitem (or even the same one) of the same file
does not bring back the highlighting. But clicking it into another
file's subitem does. It happens every time a new file is selected,
even if previously selected.

I'm not sure this is a bug, because the behavior already happens in
22.1, but certainly is unexpected, and the docstring of
`speedbar-highlight-face' talks only about buttons, not the source
file.
[bug.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Wed, 14 Dec 2011 17:26:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 10275 <at> debbugs.gnu.org
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Wed, 14 Dec 2011 18:23:34 +0100
> emacs -Q -f speedbar
> ;; then select any source file in speedbar, click to unfold it, and
> click over any variable or function.
>
> What happens:
> - The file is highlighted in the Speedbar frame, with `speedbar-highlight-face'.
> - The file is loaded into a buffer and displayed in a window.
> - The selected variable or function is shown, and also highlighted
> with `speedbar-highlight-face'.
>
> Clicking into another subitem (or even the same one) of the same file
> does not bring back the highlighting. But clicking it into another
> file's subitem does. It happens every time a new file is selected,
> even if previously selected.
>
> I'm not sure this is a bug, because the behavior already happens in
> 22.1, but certainly is unexpected, and the docstring of
> `speedbar-highlight-face' talks only about buttons, not the source
> file.

What happens is that after the mouse click speedbar does highlight the
line via `speedbar-highlight-one-tag-line' which installs in
`pre-command-hook' the function `speedbar-unhighlight-one-tag-line'.
Next comes a switch-frame event to select the frame of the buffer where
the highlight is and executing the corresponding `handle-switch-frame'
command triggers the `pre-command-hook' which swallows the highlight
immediately.

An easy work-around is

(defun speedbar-unhighlight-one-tag-line ()
  "Unhighlight the currently highlighted line."
  (when (and speedbar-highlight-one-tag-line
	     (not (eq this-command 'handle-switch-frame)))
    (speedbar-delete-overlay speedbar-highlight-one-tag-line)
    (setq speedbar-highlight-one-tag-line nil)
    (remove-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line)))

but I have no idea what Eric intended to accomplish in the first place
and delving into the code of speedbar or dframe is no fun at all.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Wed, 14 Dec 2011 17:43:01 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 10275 <at> debbugs.gnu.org, "Eric M. Ludlam" <zappo <at> gnu.org>
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Wed, 14 Dec 2011 18:40:15 +0100
On Wed, Dec 14, 2011 at 18:23, martin rudalics <rudalics <at> gmx.at> wrote:

> What happens is that after the mouse click speedbar does highlight the
> line via `speedbar-highlight-one-tag-line' which installs in
> `pre-command-hook' the function `speedbar-unhighlight-one-tag-line'.
> Next comes a switch-frame event to select the frame of the buffer where
> the highlight is and executing the corresponding `handle-switch-frame'
> command triggers the `pre-command-hook' which swallows the highlight
> immediately.

IOW, the bug is in removing the highlight when selecting subsequent items.

> but I have no idea what Eric intended to accomplish in the first place

I'm Cc:ing him.

Thanks,

    Juanma




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Wed, 14 Dec 2011 18:23:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 10275 <at> debbugs.gnu.org, "Eric M. Ludlam" <zappo <at> gnu.org>
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Wed, 14 Dec 2011 19:20:47 +0100
> IOW, the bug is in removing the highlight when selecting subsequent items.

Not really.  FWIW the bug happens because `handle-switch-frame' runs
`pre-command-hook', something Eric probably didn't expect.  Switching
the frame is needed because the mouse click selects the speedbar frame
and we immediately want to return to the frame where the source file is
shown.  But I don't understand why de-highlighting doesn't occur when
hitting RET in the speedbar or switching to another buffer with the
mouse.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Wed, 14 Dec 2011 23:21:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: "Eric M. Ludlam" <ericludlam <at> gmail.com>
Cc: 10275 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>,
	"Eric M. Ludlam" <zappo <at> gnu.org>
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Thu, 15 Dec 2011 00:18:24 +0100
On Thu, Dec 15, 2011 at 00:06, Eric M. Ludlam <ericludlam <at> gmail.com> wrote:

> I wrote that bit of code a long time ago.  The idea is to just show the line
> of interest in an easy to identify way, but have the highlight go away on
> the next keypress.

Aha. I was a bit confused because the highlighting is done with
speedbar-highlight-face, but the face's docstring does not suggest
that.

> It seems like all the frame switching running the hook is defeating the
> mechanism it was using.

So it seems, yes.

> Such a patch should be sent to the Emacs maintainers, as I haven't been
> maintaining speedbar directly lately.

OK. Thanks for your help.

    Juanma




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Thu, 15 Dec 2011 00:46:03 GMT) Full text and rfc822 format available.

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

From: "Eric M. Ludlam" <ericludlam <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 10275 <at> debbugs.gnu.org, Juanma Barranquero <lekktu <at> gmail.com>,
	"Eric M. Ludlam" <zappo <at> gnu.org>
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Wed, 14 Dec 2011 18:06:18 -0500
On 12/14/2011 01:20 PM, martin rudalics wrote:
>  > IOW, the bug is in removing the highlight when selecting subsequent
> items.
>
> Not really. FWIW the bug happens because `handle-switch-frame' runs
> `pre-command-hook', something Eric probably didn't expect. Switching
> the frame is needed because the mouse click selects the speedbar frame
> and we immediately want to return to the frame where the source file is
> shown. But I don't understand why de-highlighting doesn't occur when
> hitting RET in the speedbar or switching to another buffer with the
> mouse.

I wrote that bit of code a long time ago.  The idea is to just show the 
line of interest in an easy to identify way, but have the highlight go 
away on the next keypress.

It seems like all the frame switching running the hook is defeating the 
mechanism it was using.

It could be that in speedbar-tag-find just swapping the last two lines 
is sufficient to move the post-command-hook execution to the right time.

Such a patch should be sent to the Emacs maintainers, as I haven't been 
maintaining speedbar directly lately.

Eric




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Fri, 16 Dec 2011 10:00:02 GMT) Full text and rfc822 format available.

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

From: "Martin Rudalics" <rudalics <at> gmx.at>
To: "Eric M. Ludlam" <ericludlam <at> gmail.com>
Cc: 10275 <at> debbugs.gnu.org, lekktu <at> gmail.com, zappo <at> gnu.org
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Fri, 16 Dec 2011 10:58:21 +0100
> It could be that in speedbar-tag-find just swapping the last two lines
> is sufficient to move the post-command-hook execution to the right time.

Doesn't work here.

martin

-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10275; Package emacs. (Sat, 10 Mar 2012 08:30:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 10275 <at> debbugs.gnu.org, Juanma Barranquero <lekktu <at> gmail.com>
Subject: Re: bug#10275: speedbar highlights first selected item in
	speedbar-highlight-face
Date: Sat, 10 Mar 2012 15:59:36 +0800
martin rudalics <rudalics <at> gmx.at> writes:

> An easy work-around is
>
> (defun speedbar-unhighlight-one-tag-line ()
>   "Unhighlight the currently highlighted line."
>   (when (and speedbar-highlight-one-tag-line
> 	     (not (eq this-command 'handle-switch-frame)))
>     (speedbar-delete-overlay speedbar-highlight-one-tag-line)
>     (setq speedbar-highlight-one-tag-line nil)
>     (remove-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line)))

Since no one else has proposed anything better, I've committed this into
trunk for you.




bug closed, send any further explanations to 10275 <at> debbugs.gnu.org and Juanma Barranquero <lekktu <at> gmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 10 Mar 2012 08:30:03 GMT) Full text and rfc822 format available.

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

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

Previous Next


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