help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use-package: load package on key prefix


From: Rusi
Subject: Re: use-package: load package on key prefix
Date: Thu, 02 Jun 2016 15:21:11 -0000
User-agent: G2/1.0

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
)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]