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

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

Re: Binding same command to two separte keys??


From: William Case
Subject: Re: Binding same command to two separte keys??
Date: Fri, 13 Apr 2007 16:17:32 -0400

Ok guys, now I am really totally confused.

I have been using emacs for 2 years.  I have read the Wiki, printed out
the tiny-tools site and read and re-read the info pages.

Over the last 2 years I have written about 10 keybinding functions, that
are in my .emacs, and that I use all the time.  They have always been in
the form of (global-set-key [(M-s)] 'shell-command).  Now 'kbd' shows
up, and '?\' to replace it. And, whats a #' for, that replaces the
single '.

I just want to get consistent.  I plan to do a fair amount of work with
emacs shortly.  Up to now I haven't worried much because I used my emacs
21.4 only for trivial text editing.  

So ... in (global-set-key (kbd "M-s") #'shell-command)

Does ?\ = kbd ?
Does [  ] replace (  ) ?
Are the "   " necessary or not necessary ?
Does the # have a special meaning or is it always used now?
Where do I find the kbd documentation that I already haven't looked at? 
Do symbols like F3 still require < > ?
What syntax would work for both standard emacs functions and my own user
functions?
Emacs 22 is going to show up when I upgrade to Fedora 7.  Is keybinding
going to be different again?

On Fri, 2007-04-13 at 15:17 -0400, Matthew Flaschen wrote:
> Karl Hegbloom wrote:
> > On Fri, 2007-04-13 at 15:02 -0400, William Case wrote:
> >> I have set (global-set-key [(M-s)] 'shell-command) in my .emacs.
> >> I also want to keep the M-! shell-command binding
> >>
> >> Nothing happens when I use M-s, nor do I get an error message.
> > 
> > I think that the syntax of the expression describing the key is
> > incorrect.
> 
> The correct syntax is:
> 
> [?\M-s]
It works.

>   Try looking at the documentation of the `kbd' macro (F1 f
> > kbd).  You can use it there, like:
> >  (global-set-key (kbd "M-s") #'shell-command)
It also works.

> There's no need for kbd here.  It's unnecessary overhead.
> 

I know there are several ways to do this -- but I need to know, for me,
some way that is consistent.  I am partial to ?\ unless it has lots of
exceptions (i.e ?\C, ?\S, ?\s ??) -- if so, I'll use 'kbd' throughout. 

Sorry if I sound a little grouchy, but right now my emacs frustration
knows no bounds and I am unable to make sense of anything that I read.
It is like day one, two years ago, all over again.  I thought I had this
simple task -- binding functions to keys worked out.

> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
-- 
Regards Bill





reply via email to

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