help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs 21.2 : Can you set it up so the cursor is focused in complet


From: Marco Baringer
Subject: Re: Emacs 21.2 : Can you set it up so the cursor is focused in completeion buffers when they happen?
Date: 07 Sep 2002 21:16:58 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.30

stevesusenet@yahoo.com (Steve) writes:

> I would like emacs to put the cursor there automatically in those
> situations so I do not have to hit C-x o to put it there before I can
> scroll the results.

so, you want to run some code (other-window 1) after emacs has
finishing runing occur (or whatever). sounds like a job for defadvice
to me, what do you say robin? "holy-crazy-elisp-code batman! you may
be on to something!" :)

try something along the lines of:

(defadvice occur (after occur-switch-to-window)
  (other-window 1))
(ad-activate 'occur)

now, since you want to do it for quite a few functions (grep comes to
mind), it'd be nice to wrap it up in a macro like this one:

(defmacro add-switch-to-window-advice (function)
  `(progn
     (defadvice ,function (after ,(intern (concat (symbol-name function) 
"-switch-to-window")))
       (other-window 1))
     (ad-activate ',function)))

and use it like this:

(add-switch-to-window-advice occur)
(add-switch-to-window-advice grep)
...

or some such madness.

i would not suggest using it for the help functions as you can't do
anything in thoses buffers, only read them so you'd have to opposite
annoyance of having to switch out of those buffers, this is unlike
grep and occur where having the point in thoses buffers is usefull.

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen

p.s. - i had been happily living with this annoyance for quite a
while. thanks for pointing it out to me.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]