From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marco Baringer Newsgroups: gmane.emacs.help 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 Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <6f8cb8c9.0209061231.3d2b5206@posting.google.com> <3D792A4E.8040006@ihs.com> <6f8cb8c9.0209061955.44e22b24@posting.google.com> <6f8cb8c9.0209070835.6c78d074@posting.google.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1031426177 23053 127.0.0.1 (7 Sep 2002 19:16:17 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 7 Sep 2002 19:16:17 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17nl42-0005zY-00 for ; Sat, 07 Sep 2002 21:16:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17nl43-00074L-00; Sat, 07 Sep 2002 15:16:15 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17nl3m-000719-00 for help-gnu-emacs@gnu.org; Sat, 07 Sep 2002 15:15:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17nl3k-00070x-00 for help-gnu-emacs@gnu.org; Sat, 07 Sep 2002 15:15:58 -0400 Original-Received: from mail-8.tiscali.it ([195.130.225.154] helo=mail.tiscali.it) by monty-python.gnu.org with esmtp (Exim 4.10) id 17nl3k-00070s-00 for help-gnu-emacs@gnu.org; Sat, 07 Sep 2002 15:15:56 -0400 Original-Received: from localhost (62.10.91.199) by mail.tiscali.it (6.5.026) id 3D6DC7B4004D3DF3 for help-gnu-emacs@gnu.org; Sat, 7 Sep 2002 21:15:50 +0200 Original-To: help-gnu-emacs@gnu.org In-Reply-To: <6f8cb8c9.0209070835.6c78d074@posting.google.com> Original-Lines: 49 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.30 Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1130 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1130 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.