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: Joe Riel
Subject: Re: use-package: load package on key prefix
Date: Tue, 10 May 2016 12:00:52 -0700

On Mon, 09 May 2016 08:28:41 -0400
Stefan Monnier <monnier@iro.umontreal.ca> 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 don't know if use-package supports it, but Emacs can definitely do
> that (it's called "autoloaded keymaps"), and if it makes sense for
> p4.el, than I'd argue that you should report a bug against p4.el saying
> that p4.el should do that (rather than dump that responsability on the user).
> 
> This said, this feature of Emacs is mostly never used: when a package
> has a dedicated prefix key, it typically also has a menu-bar (sub)menu
> and that one can't be autoloaded (well, technically it can be
> autoloaded, but in practice the automatic load will happen much too
> early, i.e. the first time you look at any part of the menu).

Thanks, that pointed me in the right direction.
The following :bind-keymap assignment solved the problem:

(use-package p4
  :bind-keymap (("C-x p" . p4-prefix-map))
  :config
  (setq p4-use-p4config-exclusively t
        p4-do-find-file nil ))

Now typing, say, "C-x p f" load the p4 minor mode 
and runs p4-mode-filelog, exactly what I wanted.

I don't use a menu, so don't worry about a menu-bar issue.


-- 
Joe Riel




reply via email to

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