From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: use-package: load package on key prefix Date: Mon, 09 May 2016 02:36:05 +0200 Message-ID: <87a8k0kqyy.fsf@debian.uxu> References: <20160507140453.2ccfcc44@gauss> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462754226 26786 80.91.229.3 (9 May 2016 00:37:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 May 2016 00:37:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 09 02:36:57 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 1azZBu-0002Xe-Bo for geh-help-gnu-emacs@m.gmane.org; Mon, 09 May 2016 02:36:54 +0200 Original-Received: from localhost ([::1]:38550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azZBl-0002Z2-7K for geh-help-gnu-emacs@m.gmane.org; Sun, 08 May 2016 20:36:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azZBb-0002VT-NY for help-gnu-emacs@gnu.org; Sun, 08 May 2016 20:36:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azZBX-0003i1-Dr for help-gnu-emacs@gnu.org; Sun, 08 May 2016 20:36:34 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:41170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azZBX-0003hv-2x for help-gnu-emacs@gnu.org; Sun, 08 May 2016 20:36:31 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1azZBT-0002Az-RP for help-gnu-emacs@gnu.org; Mon, 09 May 2016 02:36:27 +0200 Original-Received: from 131.207.216.81.static.u.siw.siwnet.net ([81.216.207.131]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 May 2016 02:36:27 +0200 Original-Received: from embe8573 by 131.207.216.81.static.u.siw.siwnet.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 May 2016 02:36:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 47 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 131.207.216.81.static.u.siw.siwnet.net Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:7/dwNll8TYy7BP9C+gKt0xu7qGI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:109902 Archived-At: 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? It can, but unless you load the package somehow else, the keybinding won't be in effect and if you load it somehow else, there is no reason for such a keybinding, is it, as the package is already loaded? And - why do you want a keyboard shortcut to load a package anyway? Shortcuts are there to "optimize the common case", to quote the paleo-sacred scrolls of techno-techno-science. In this "case" that means you are benefited from assigning commands to shortcuts, which are invoked repeatedly and/or frequently! Perhaps you can describe your situation in human terms instead? E.g., do you "refresh" some state associated with the package by reloading the entire package? If so, in nine times out of ten, there are better ways to do that. Take your time to examine the situation and analyze what part needs to be reset (or set). You are not on K2 so there is no need to muscle up the thrice-accursed tent! But if you still want it, to answer your question, as you describe the circularity, no, instead you would want to put the load shortcut in the global keymap: (defun load-gnus () "Load probably the best piece of software in the world. (But we will have to verify that.)" (interactive) (load "gnus") ) (global-set-key "\C-xp" #'load-gnus) -- underground experts united .... http://user.it.uu.se/~embe8573 Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic - so far: 26 Blogomatic articles -