From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: custom keyboard layout? howto redefine keys? Date: Fri, 10 Apr 2009 11:22:05 -0500 Message-ID: References: <84995d58-0858-4762-b317-8935fdfafcf9@f19g2000yqo.googlegroups.com> <95ednf9KOIEejULUnZ2dnUVZ_r-dnZ2d@sysmatrix.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1239381878 2342 80.91.229.12 (10 Apr 2009 16:44:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Apr 2009 16:44:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 10 18:45:57 2009 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 1LsJrR-000734-Dy for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Apr 2009 18:45:49 +0200 Original-Received: from localhost ([127.0.0.1]:33881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LsJq3-000415-17 for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Apr 2009 12:44:23 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!newshub.sdsu.edu!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!backlog2.nntp.dca.giganews.com!nntp.sysmatrix.net!news.sysmatrix.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Fri, 10 Apr 2009 11:22:05 -0500 User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) Original-Newsgroups: gnu.emacs.help In-Reply-To: Original-Lines: 60 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 12.73.129.177 Original-X-Trace: sv3-6Yuvkk7dR132His4VmDbEtDvnhGhEyrrgHwoKOGjpuETDSiJZbDGeQ5V9xYYtBnbvK5twfyf3Qj+bo7!Out0Hgjd8hvwYmxWaLOcAdy6Cqn/LRWnext3X7I4+jGbQSC1a8zoa2aBs/FiR0iH4x2YrEhVQZxe!iMydngEtfADLVk1eqSKYY36vT9aO728= Original-X-Complaints-To: abuse@sysmatrix.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 X-Original-Bytes: 3843 Original-Xref: news.stanford.edu gnu.emacs.help:168360 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:63641 Archived-At: nic.d.m.1@googlemail.com wrote: > Thank you very much! I "mixed" your solutions and it worked: > > (global-set-key "b" (lambda () (interactive) (ucs-insert "61"))) > (global-set-key "a" (lambda () (interactive) (ucs-insert "62"))) Aren't you worried about having the keyboard work one way in Emacs and another in other programs. Here is an explanation of the danger inherent in such a strategy: http://en.wikipedia.org/wiki/Muscle_memory > > Any idea *why* this works? I don't understand it. What is the meaning > of "interactive" here? I think it makes the anonymous lambda function act like a command. > > By the way: Is there a possibility to reload the .emacs file without > restarting emacs? Not with it's full initialization functionality, but many things (as in your example above) can be set up by pressing C-x C-e with the cursor after the last parenthesis of the lisp expression. The expression doesn't even have to be in .emacs but if it isn't saved saved there it won't be set the next time you start Emacs. > > I tried: M-x load-file .emacs but it doesn't work. > > On 10 Apr., 11:25, "B. T. Raven" wrote: >> nic.d....@googlemail.com wrote: >>> Is there a way to customize the keyboard layout within emacs? For >>> example if I want "the key on my keyboard labeled 'a' behave like >>> that labeled 'b' I think the code for my .emacs file should be >>> something like this: >>> (global-set-key ["Key labeled 'a' on my keyboard"] 'ucs-insert0062) >>> I am new to emacs and don't know what the correct syntax for "Key >>> labeled 'a' on my keyboard' could be. >>> So I tried to make f5instead behave like b: >>> (global-set-key [f5] 'ucs-insert0062) >>> Then I get an error message: "Wrong type argument: commandp, (ucs- >>> insert62)" if I restart emacs and press f5. >>> (For example (global-set-key [f1] 'ucs-insert) works, but then it >>> asks which UTF-8character I want to insert, that's not what I want) >>> Any ideas? >> (global-set-key [f5] (lambda () (interactive) (ucs-insert "62"))) >> >> ucs-insert seems to want a string; >> >> for your original question you could also do this: >> >> (global-set-key "a" "b") >> >> but you will immediately regret it, since now you won't be able to type >> the letter a, for example to assign it to another key. At least I >> couldn't figure out how to undo the damage and I had to re-start Emacs. >>