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

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

Re: HELP: One Bindkey for Two Different Commands


From: Stefan Monnier
Subject: Re: HELP: One Bindkey for Two Different Commands
Date: Fri, 30 Nov 2007 11:39:06 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> Unfortunately,  this very simple idea doesn't seem to work for me.
> Here's what I have in my .emacs so far:

> (defun ya-ya ()
>   (if (cdr (window-list))
>       'other-window
>     'switch-to-buffer))

> (global-set-key "\M-o" (ya-ya))

> Any ideas how this might be accomplished?


How 'bout some neat hack like:

  (global-set-key "\M-o" '(menu-item "Foo" bar
                           :filter (lambda (x) (if (cdr (window-list))
                                                   'other-window
                                                 'switch-to-buffer))))

-- Stefan ;-)


reply via email to

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