From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rusi Newsgroups: gmane.emacs.help Subject: Re: use-package: load package on key prefix Date: Mon, 9 May 2016 06:03:22 -0700 (PDT) Message-ID: <6396f3e3-b7c3-4d29-984e-aff126df1da9@googlegroups.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1464882462 31489 80.91.229.3 (2 Jun 2016 15:47:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 15:47:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 17:47:42 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 1b8UqS-0007AZ-NU for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 17:47:40 +0200 Original-Received: from localhost ([::1]:48125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8UqR-0001Fp-UX for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 11:47:39 -0400 X-Received: by 10.129.52.69 with SMTP id b66mr21938188ywa.28.1462799003284; Mon, 09 May 2016 06:03:23 -0700 (PDT) X-Received: by 10.50.224.179 with SMTP id rd19mr120697igc.10.1462799003162; Mon, 09 May 2016 06:03:23 -0700 (PDT) Original-Path: usenet.stanford.edu!11no3031634qgt.0!news-out.google.com!k10ni329igv.0!nntp.google.com!i5no6144403ige.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=117.195.63.46; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui Original-NNTP-Posting-Host: 117.195.63.46 User-Agent: G2/1.0 Injection-Date: Mon, 09 May 2016 13:03:23 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:217648 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:110208 Archived-At: 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.