From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: F2 Date: Tue, 01 Mar 2011 18:14:42 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <87d3mb1fdp.fsf@puma.rapttech.com.au> References: <577f8a29-95e7-4168-abb6-0e2b1820bda1@r4g2000prm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1298965383 15878 80.91.229.12 (1 Mar 2011 07:43:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 Mar 2011 07:43:03 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 01 08:42:59 2011 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.69) (envelope-from ) id 1PuKES-0008Cs-LE for geh-help-gnu-emacs@m.gmane.org; Tue, 01 Mar 2011 08:42:57 +0100 Original-Received: from localhost ([127.0.0.1]:39747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PuKEO-0002gx-UR for geh-help-gnu-emacs@m.gmane.org; Tue, 01 Mar 2011 02:42:53 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news-xfer.nntp.sonic.net!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:PvBC2XFJ6Feu0ZI0BpMRuHCpjRk= Original-Lines: 72 Original-NNTP-Posting-Host: c384c8a4.news.astraweb.com Original-X-Trace: DXC=3NU?HN2n1K]>mgaITZn1@QL?0kYOcDh@Z7^o:UA4R?cUS`HWH2Uf3?Y]G; 2>V^?kWSCAkl5c@Xgk^aNJWkChkAS[:mQIg?N?UHS Original-Xref: usenet.stanford.edu gnu.emacs.help:185462 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:79615 Archived-At: PJ Weisberg writes: > On 2/28/11, TheFlyingDutchman wrote: >> I was using >> (global-set-key (kbd "") 'my-elisp-command) >> >> I don't know if that works differently than define-key. > > For the record, > > (global-set-key (kbd "") (lambda() (interactive) (message "Hello, world!"))) > > works perfectly well over here (Emacs 23.2.1 via Debian). > Note that you can see if a key is 'free' by using C-h b to list all current key bindings. ,----[ C-h k control h b ] | control h b runs the command describe-bindings, which is an interactive | compiled Lisp function in `help.el'. | | It is bound to control h b , b , b , | . | | (describe-bindings &optional PREFIX BUFFER) | | Show a list of all defined keys, and their definitions. | We put that list in a buffer, and display the buffer. | | The optional argument PREFIX, if non-nil, should be a key sequence; | then we display only bindings that start with that prefix. | The optional argument BUFFER specifies which buffer's bindings | to display (default, the current buffer). BUFFER can be a buffer | or a buffer name. | | [back] `---- If I do this in now, on my system I see help-command menu-bar-open kmacro-start-macro-or-insert-counter kmacro-end-or-call-macro clipboard-kill-ring-save clipboard-yank 2C-command clipboard-kill-region kmacro-start-macro-or-insert-counter kmacro-end-or-call-macro tempo-template-generic-header If you find, after defining a key using either define-key global-map or global-set-key, that the key doesn't seem to work, it is likely that your global key binding is being over shadowed by a local key binding. Using C-h b can help to show what maybe going on. It is important to remember that key maps work in aa sort of hierarchy and that global definitions can be overridden (including cleared) by local key maps. This could also explain why the definition works for some and not others. Unless everyone is defining and testing the binding from wihtin the same mode, with the same global and local key maps, you may see what appears to be inconsistent results. It can also explain what is going on if you define a global key definition, test it and find it works and then later, try to use it while in a different mode and find it doesn' work. Tim -- tcross (at) rapttech dot com dot au