vfclists · 2022-06-22 21:43
nv-elisp · 2022-06-22 22:11
You can expand the use-package macro to see exactly what it does.
vfclists · 2022-06-22 23:55
I've already done that and it displays a `bind-key` command with a `map`
The use-package for marginalia expands to the progn below
(use-package marginalia
;; Either bind `marginalia-cycle` globally or only in the minibuffer
:bind (("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle))
;; The :init configuration is always executed (Not lazy!)
:init
;; Must be in the :init section of use-package such that the mode gets
;; enabled right away. Note that this forces loading the package.
(marginalia-mode))
The bind expands to this. Does the `bind-keys :package` make it global?
(bind-keys :package marginalia
("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle))
---
macrostep expanded
---
(progn
(use-package-ensure-elpa 'marginalia
'(t)
'nil)
(defvar use-package--warning107
(function
(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'marginalia keyword
(error-message-string err))))
(display-warning 'use-package msg :error)))))
(condition-case-unless-debug err
(progn
(unless
(fboundp 'marginalia-cycle)
(autoload
(function marginalia-cycle)
"marginalia" nil t))
(condition-case-unless-debug err
(marginalia-mode)
(error
(funcall use-package--warning107 :init err)))
(bind-keys :package marginalia
("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle)))
(error
(funcall use-package--warning107 :catch err))))
janoc · 2022-06-23 06:56
Yes. It will put the keybindings into the global key map unless you specify otherwise.
organic-bookworm · 2022-06-23 07:15
You need to go deeper. The `bind-keys` is also a macro.
Try [macrostep](https://github.com/joddie/macrostep) to interactively expand these nested macros.
Or dig the answer out of the [man](https://github.com/jwiegley/use-package#binding-within-local-keymaps):
> Any binding occurring before the first use of `:map` are applied to the global keymap
FatFingerHelperBot · 2022-06-23 07:15
It seems that your comment contains 1 or more links that are hard to tap for mobile users.
I will extend those so they're easier for our sausage fingers to click!
[Here is link number 1 - Previous text "man"](https://github.com/jwiegley/use-package#binding-within-local-keymaps)
----
^Please ^PM ^[\/u\/eganwall](http://reddit.com/user/eganwall) ^with ^issues ^or ^feedback! ^| ^[Code](https://github.com/eganwall/FatFingerHelperBot) ^| ^[Delete](https://reddit.com/message/compose/?to=FatFingerHelperBot&subject=delete&message=delete%20idekarg)