From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Visher Newsgroups: gmane.emacs.help Subject: Re: create new key prefix Date: Wed, 20 Feb 2013 12:44:34 -0500 Message-ID: References: <51240A2C.7070206@mousecar.com> <512428A9.6010003@mousecar.com> <512498CC.3070009@mousecar.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1361382332 11737 80.91.229.3 (20 Feb 2013 17:45:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Feb 2013 17:45:32 +0000 (UTC) Cc: GNU Emacs List To: gebser@mousecar.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 20 18:45:54 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U8Djq-0005e1-C1 for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Feb 2013 18:45:50 +0100 Original-Received: from localhost ([::1]:60384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8DjW-0003yT-50 for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Feb 2013 12:45:30 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8DjJ-0003xB-QL for help-gnu-emacs@gnu.org; Wed, 20 Feb 2013 12:45:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8Dj8-0005oW-G4 for help-gnu-emacs@gnu.org; Wed, 20 Feb 2013 12:45:17 -0500 Original-Received: from mail-vb0-f49.google.com ([209.85.212.49]:35035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Dj8-0005nr-5D for help-gnu-emacs@gnu.org; Wed, 20 Feb 2013 12:45:06 -0500 Original-Received: by mail-vb0-f49.google.com with SMTP id s24so5143184vbi.36 for ; Wed, 20 Feb 2013 09:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=SIAjddsaosBsA3y+rfM603oax+eHMCPrMxqiV6vzuWI=; b=WwlXR7ISZdEmZ+feMEwi2ati/LbM6QLiOFpjXI3KhOn8UesS/pW+IUxrGOOrF7jaAs ySiZ20GT0FS5kogfcccB0Y1zlH+mekb3DFjnH8oD6X3hRhAYg+YaV03zf1mtskPQmDDY v5duEf9V8Cl7ZLMKQdw0ktv77uqcrBABLuBD5XUPJgJXTC2ABSkteVqyFe3HL60L1nE6 VP3EF63BVssM68Fq4o8QNXxr++I8zhAfUPV6SVLUPC2ryFtHrYuVe7XBbt/gIbiLIZ83 qQhnQOuHXQPL7ba2JnPcmGsSX/N2emUrhETaD4pFIVgAdp/LGzX8tWyDx+3ukhlGFsa+ MgHw== X-Received: by 10.52.176.38 with SMTP id cf6mr3430196vdc.132.1361382305514; Wed, 20 Feb 2013 09:45:05 -0800 (PST) Original-Received: by 10.220.215.209 with HTTP; Wed, 20 Feb 2013 09:44:34 -0800 (PST) In-Reply-To: <512498CC.3070009@mousecar.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.212.49 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89193 Archived-At: On Wed, Feb 20, 2013 at 4:35 AM, ken wrote: > On 02/19/2013 08:41 PM Tim Visher wrote: >> On Tue, Feb 19, 2013 at 8:36 PM, ken wrote: >>> On 02/19/2013 08:20 PM Tim Visher wrote: >>>> On Tue, Feb 19, 2013 at 6:26 PM, ken wrote: >>>>> I've defined quite a few new keys over the years and so would like to >>>>> create >>>>> a new key prefix. I.e., I want to be able to define keys such as "C-= c >>>>> p >>>>> s", >>>>> "C-c p m", etc. So how do I tell emacs that (for all possible modes)= I >>>>> want >>>>> "C-c p" to look for the new key definitions. >>>>> >>>>> From what I've read so far, how this is done depends a lot on the >>>>> particular >>>>> emacs version. Mine's 22.1.1. >>>> >>>> `(global-set-key (kbd "C-c p m") 'func-name)` doesn't work for you? >>>> The caveat to that is that modes down the line can possible shadow the >>>> binding. But that's easy enough to solve with `(eval-after-load=E2=80= =A6` >>>> forms. >>> >>> Thanks much for the reply. I have almost no idea what you said, but it >>> got >>> me to try the code which I already wrote (which I didn't do before >>> because I >>> didn't think it would work, thought sure there was something missing). >>> The >>> code I already wrote and left sitting there untested for a couple-three >>> hours... it works!! >>> >>> Well that's a completely new experience for me. B^D >> >> >> LOL. Good to know. >> >> As an aside, what are you confused about regarding what I said? Maybe >> I can help clear some things up for you? > > What I read in several docs on the web implied that a command was needed > first to create a sparse map (i.e., define-prefix-command) and then to > assign it to a key prefix, in my case, "C-c p". So when you wrote/asked, > "`(global-set-key... doesn't work for you?", it didn't compute with me at > all at first because it seemed like you were ignoring/forgetting all that= . > But then 1% of me thought, maybe this guy is one of the 0.02% who knows w= hat > he's talking about, prompting me to try running my own code (which was > likewise ignoring/forgoing sparse map creation etc.). My crap not only r= an > without error, but it also worked perfectly! Generally you use sparse maps, etc. when you're defining a keymap for a mode that you're writing or when you want to activate a group of keys all at once. In your case you probably aren't intending to do that. > The other part is the reference to "(eval-after-load..."; from your conte= xt > I gather that it's meant to remedy some other code stepping on my > keybindings (and perhaps too other definitions). But how, when, and wher= e > to actually implement that function gribbles the laft whicher bonkhaft. `eval-after-load` is just a way to evaluate a function after a library is loaded. In other words, if I wanted to have `C-c p p` do something but `mode-x` defined `C-c p p` to do something else, the easiest way I've found to step on the mode's definition is to do an `(eval-after-load 'mode-x '(local-set-key (kbd "C-c p p") 'func-name))`. That will reset they key in that mode back to what you want it to be. -- In Christ, Timmy V. http://blog.twonegatives.com/ http://five.sentenc.es/ -- Spend less time on mail