unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: 10275@debbugs.gnu.org
Subject: bug#10275: speedbar highlights first selected item in speedbar-highlight-face
Date: Wed, 14 Dec 2011 18:23:34 +0100	[thread overview]
Message-ID: <4EE8DB96.9020500@gmx.at> (raw)
In-Reply-To: <CAAeL0ST4Un3c_-E1H+2jniAHOoWQkcub=+KLdVsxtCLDK=PFtQ@mail.gmail.com>

 > 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





  reply	other threads:[~2011-12-14 17:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-11 14:06 bug#10275: speedbar highlights first selected item in speedbar-highlight-face Juanma Barranquero
2011-12-14 17:23 ` martin rudalics [this message]
2011-12-14 17:40   ` Juanma Barranquero
2011-12-14 18:20     ` martin rudalics
2011-12-14 23:06       ` Eric M. Ludlam
2011-12-14 23:18         ` Juanma Barranquero
2011-12-16  9:58         ` Martin Rudalics
2012-03-10  7:59   ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE8DB96.9020500@gmx.at \
    --to=rudalics@gmx.at \
    --cc=10275@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).