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.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 10275 <at> debbugs.gnu.org
Subject: 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




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

Previous Next


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