unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joe Riel <joer@san.rr.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: use-package: load package on key prefix
Date: Tue, 10 May 2016 12:00:52 -0700	[thread overview]
Message-ID: <20160510120052.54d9b461@gauss> (raw)
In-Reply-To: <jwvbn4fa097.fsf-monnier+gmane.emacs.help@gnu.org>

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




  parent reply	other threads:[~2016-05-10 19:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-07 21:04 use-package: load package on key prefix Joe Riel
2016-05-09  0:36 ` Emanuel Berg
2016-05-09 12:28 ` Stefan Monnier
2016-05-09 14:26   ` Marcin Borkowski
2016-05-10 19:00   ` Joe Riel [this message]
     [not found] ` <mailman.2487.1462797966.7477.help-gnu-emacs@gnu.org>
2016-05-09 12:53   ` Rusi
2016-05-10  9:26 ` Phillip Lord
     [not found] ` <mailman.2627.1462964398.7477.help-gnu-emacs@gnu.org>
2016-05-11 11:04   ` Rusi
     [not found] <mailman.2408.1462655105.7477.help-gnu-emacs@gnu.org>
2016-05-09 13:03 ` Rusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160510120052.54d9b461@gauss \
    --to=joer@san.rr.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).