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

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

Re: use-package: load package on key prefix


From: Rusi
Subject: Re: use-package: load package on key prefix
Date: Thu, 02 Jun 2016 15:21:06 -0000
User-agent: G2/1.0

On Sunday, May 8, 2016 at 2:35:08 AM UTC+5:30, Joe Riel wrote:
> I use the p4 (perforce) package which uses C-x p as a prefix for its
> bound keys.  Can use-package be configured so that it loads the
> package (which presumably assigns the key-bindings) when C-x p is pressed?

I do see this para in use-package readme:


Binding to keymaps
-----------------

Normally :bind expects that commands are functions that will be autoloaded from
the given package. However, this does not work if one of those commands is 
actually a keymap, since keymaps are not functions, and cannot be autoloaded 
using Emacs' autoload mechanism.

To handle this case, use-package offers a special, limited variant of :bind 
called :bind-keymap. The only difference is that the "commands" bound to by 
:bind-keymap must be keymaps defined in the package, rather than command 
functions. This is handled behind the scenes by generating custom code that 
loads the package containing the keymap, and then re-executes your keypress 
after the first load, to reinterpret that keypress as a prefix key.


reply via email to

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