From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Riel Newsgroups: gmane.emacs.help Subject: Re: use-package: load package on key prefix Date: Tue, 10 May 2016 12:00:52 -0700 Message-ID: <20160510120052.54d9b461@gauss> References: <20160507140453.2ccfcc44@gauss> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1462906897 1123 80.91.229.3 (10 May 2016 19:01:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 May 2016 19:01:37 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 10 21:01:30 2016 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 1b0CuP-0007Ps-Oy for geh-help-gnu-emacs@m.gmane.org; Tue, 10 May 2016 21:01:29 +0200 Original-Received: from localhost ([::1]:48273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0CuP-0002Ao-1Q for geh-help-gnu-emacs@m.gmane.org; Tue, 10 May 2016 15:01:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Cty-0001OI-2m for help-gnu-emacs@gnu.org; Tue, 10 May 2016 15:01:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0Cts-0002aN-Fh for help-gnu-emacs@gnu.org; Tue, 10 May 2016 15:01:00 -0400 Original-Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.232]:44491 helo=cdptpa-oedge-vip.email.rr.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Ctr-0002Z7-RC for help-gnu-emacs@gnu.org; Tue, 10 May 2016 15:00:56 -0400 Original-Received: from [75.80.191.41] ([75.80.191.41:36611] helo=gauss) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id D7/4D-09203-5EF22375; Tue, 10 May 2016 19:00:53 +0000 In-Reply-To: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 107.14.166.232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:109921 Archived-At: On Mon, 09 May 2016 08:28:41 -0400 Stefan Monnier 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