all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: use-package: load package on key prefix
Date: Mon, 09 May 2016 02:36:05 +0200	[thread overview]
Message-ID: <87a8k0kqyy.fsf@debian.uxu> (raw)
In-Reply-To: 20160507140453.2ccfcc44@gauss

Joe Riel <joer@san.rr.com> 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 -                   




  reply	other threads:[~2016-05-09  0:36 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 [this message]
2016-05-09 12:28 ` Stefan Monnier
2016-05-09 14:26   ` Marcin Borkowski
2016-05-10 19:00   ` Joe Riel
     [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

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

  git send-email \
    --in-reply-to=87a8k0kqyy.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.