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: Wed, 11 May 2016 04:04:36 -0700 (PDT) Message-ID: <4e7b344c-f030-4c74-8dd2-a4f9e15b8b4e@googlegroups.com> References: <20160507140453.2ccfcc44@gauss> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1464882601 1415 80.91.229.3 (2 Jun 2016 15:50:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 15:50:01 +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:50:01 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 1b8Use-0000Rc-Ks for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 17:49:56 +0200 Original-Received: from localhost ([::1]:48135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Usd-0003Ei-OY for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 11:49:55 -0400 X-Received: by 10.31.134.8 with SMTP id i8mr1692031vkd.9.1462964676970; Wed, 11 May 2016 04:04:36 -0700 (PDT) X-Received: by 10.50.11.132 with SMTP id q4mr52348igb.0.1462964676789; Wed, 11 May 2016 04:04:36 -0700 (PDT) Original-Path: usenet.stanford.edu!11no3742894qgt.0!news-out.google.com!z2ni552itc.0!nntp.google.com!i5no7419210ige.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.61.134; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui Original-NNTP-Posting-Host: 117.195.61.134 User-Agent: G2/1.0 Injection-Date: Wed, 11 May 2016 11:04:36 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:217671 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:110211 Archived-At: On Wednesday, May 11, 2016 at 4:30:00 PM UTC+5:30, Phil Lord wrote: > Joe Riel writes: > > > 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? > > You could bind C-x p to a command that loads p4 when pressed, and then > unbinds itself. > > Something like this (untested!)... > > (use-package p4 > :defer t > :ensure t > :bind ("C-x p" . my-p4-load)) > > (defun my-p4-load() > (require 'p4) > (unbind-keys "C-x p")) Why all that when OP finds that following works? (use-package p4 :bind-keymap (("C-x p" . p4-prefix-map)) :config (setq p4-use-p4config-exclusively t p4-do-find-file nil ) ;; and whatever else config is desired )