all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 7381@debbugs.gnu.org
Subject: bug#7381: 24.0.50; Provide a hook run when a window is selected
Date: Fri, 12 Nov 2010 18:09:36 +0100	[thread overview]
Message-ID: <8739r6foz3.fsf@gmail.com> (raw)
In-Reply-To: <4CDD6BDC.4010305@gmx.at> (martin rudalics's message of "Fri, 12 Nov 2010 17:31:24 +0100")

martin rudalics <rudalics@gmx.at> writes:

>>> Can't you use `window-configuration-change-hook'?
>>
>> I don't see how that would help, as the hook is not run when a window is
>> selected.
>
> Well, we _could_ run it when another window gets selected.  But at the
> time we'd run it the identity of the old selected window would not be
> available anywhere. [...]

Right, but I don't consider that too much of a problem -- I could always
save the last two windows instead of just the last one, for instance.

But I really don't think extending `w-c-c-hook' is the right
solution. I don't see why just selecting another window should be
considered a window configuration change... 

> Basically, we could keep the old window configuration around from one
> "change" to the next but it's not clear whether we want to save the
> configuration before the last command or before the last configuration
> change.  In the latter case, your code would hardly know whether it runs
> within one and the same command or within different commands.
>
> Note in this context that a single command like setting up a GDB frame
> may entail a couple of configuration changes and you would have to keep
> track of all of them.  And the hook would trigger within each and every
> instance of `with-selected-window' or `save-window-excursion' no matter
> how silly these macros are occasionally used.

...and these caveats seem only to confirm such doubts (although some of
them would apply to lesser extent to the hypothetical
`select-window'-specific hook as well).

What's wrong with a separate `window-selected-hook' or perhaps
`select-window-hook'?

[On a related note, it would be nice if there were some clean and simple
way to define custom hooks attached to arbitrary functions; that would
solve problems similar to this one, preventing discussions whether adding
yet another hook is worth it or not. Something like:

  (define-function-hook 'select-window)
  => select-window-hook

  (add-hook 'select-window-hook ...)

Dream on...]

  Štěpán





  reply	other threads:[~2010-11-12 17:09 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12  0:14 bug#7381: 24.0.50; Provide a hook run when a window is selected Štěpán Němec
2010-11-12  0:53 ` Lennart Borgman
2010-11-12 11:26   ` Štěpán Němec
2010-11-12  8:16 ` martin rudalics
2010-11-12 11:31   ` Štěpán Němec
2010-11-12 13:05     ` martin rudalics
2010-11-12 14:53       ` Štěpán Němec
2010-11-12 16:31         ` martin rudalics
2010-11-12 17:09           ` Štěpán Němec [this message]
2010-11-12 18:09             ` martin rudalics
2010-11-12 18:40               ` Štěpán Němec
2010-11-13  8:32                 ` martin rudalics
2010-11-13 12:13                   ` Štěpán Němec
2010-11-13 13:57                     ` martin rudalics
2010-11-13 15:23                       ` Štěpán Němec
2010-11-13 16:02                         ` martin rudalics
2010-11-14 12:51                           ` The window-pub branch (was Re: bug#7381: 24.0.50; Provide a hook run when a window is selected) Štěpán Němec
2010-11-14 18:59                             ` martin rudalics
2010-11-14 20:55                               ` The window-pub branch Štěpán Němec
2010-11-15  8:00                                 ` martin rudalics
2010-11-15 12:14                                   ` Štěpán Němec
2010-11-15 13:42                                     ` martin rudalics
2010-11-15 15:44                                       ` Štěpán Němec
2010-11-15 17:01                                         ` martin rudalics
2010-11-15 19:46                                           ` Štěpán Němec
2010-11-16 16:56                                             ` martin rudalics
2010-11-16 21:13                                               ` Štěpán Němec
2010-11-17  8:00                                                 ` martin rudalics
2010-11-17 12:05                                                   ` Štěpán Němec
2010-11-13 16:03                         ` bug#7381: 24.0.50; Provide a hook run when a window is selected martin rudalics
2010-11-13 18:49                           ` Chong Yidong
2010-12-23 17:07                             ` Štěpán Němec
2010-12-24  9:31                               ` martin rudalics
2010-12-29 11:21                               ` Chong Yidong
2010-12-30 16:06                                 ` Richard Stallman
2010-11-12 20:55 ` Stefan Monnier
2019-01-12  9:15 ` martin rudalics
2019-01-12 11:46   ` Štěpán Němec
2019-01-12 14:12     ` martin rudalics
2019-01-12 14:58       ` Štěpán Němec

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

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

  git send-email \
    --in-reply-to=8739r6foz3.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=7381@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /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 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.