From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Binding same command to two separte keys?? Date: 13 Apr 2007 21:55:38 GMT Message-ID: References: <1176490954.3065.75.camel@CASE> <1176491561.32280.9.camel@oaktree.karlheg.lan> <461FD736.2080709@gatech.edu> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1176503792 22942 80.91.229.12 (13 Apr 2007 22:36:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 Apr 2007 22:36:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 14 00:36:29 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HcUNZ-0005fh-HL for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Apr 2007 00:36:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HcURt-00056I-3b for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Apr 2007 18:40:57 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 106 Original-X-Trace: individual.net fkmi/SJU0CaUYMesOj6cWwWp4abP77EY+iZB6U1CevPDN9vf0x Mail-Copies-To: nobody X-Editor: Emacs of course! User-Agent: slrn/0.9.8.1 (Linux) Original-Xref: shelby.stanford.edu gnu.emacs.help:147054 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42660 Archived-At: William Case wrote: > 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 ? no. the question mark is a shortcut for the lisp reader: it indicates characters. that is: a is the symbol `a', while ?a is the character `a'. the backslash is the escape character. e.g.: ?n is the character `n', while ?\n is the character newline. kbd is a function that returns an emacs key representation. > Does [ ] replace ( ) ? no. () indicates lists, [] indicates a sequence. > Are the " " necessary or not necessary ? the double quotes indicate strings (which are a kind of sequence). key sequences can be represented as strings. > Does the # have a special meaning or is it always used now? it has special meaning. the apostrophe ' is a lisp reader shortcut for the function `quote', while #' is a shortcut for the function `function'. the latter is preferred for quoting functions. see the documentation for quote and function. > Where do I find the kbd documentation that I already haven't looked at? dunno... (not ever sure what you mean...) > Do symbols like F3 still require < > ? AFAIK yes. > What syntax would work for both standard emacs functions and my own user > functions? emacs makes no difference between "standard emacs functions" and "your own user functions". > Emacs 22 is going to show up when I upgrade to Fedora 7. Is keybinding > going to be different again? nope. i'm running a cvs-version of emacs 22, and things are still the same. > 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. i'm not entirely sure what all the options are, myself. i use the string syntax mostly: "\M-s" "\C-ce" IIUC these are equivalent to: [(meta s)] [(control c) ?e] but i've also had success with something like [C-up] for control plus cursor up. if you use kbd, you can use (kbd "C-s"). > 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. i've also searched a couple of times for some documentation on the subject of writing key sequences, and have always come up empty-handed. all i know for sure is that there are several methods and i have no idea which one is preferred or dispreferred... -- Joost Kremers joostkremers@yahoo.com Selbst in die Unterwelt dringt durch Spalten Licht EN:SiS(9)