I confirm that...
What is your question?Hey there! I'm trying to create a module with custom prefix + keybindings. It lives under Contents: ;;; os/qubes/config.el -*- lexical-binding: t; -*-
;; FUNCTIONS
(defun +qubes/qvm-copy-current-file ()
"Copy the current file via qvm-copy."
(interactive)
(if buffer-file-name
(progn
(shell-command (format "qvm-copy %s"
(shell-quote-argument buffer-file-name)))
(message "Copied %s via qvm-copy." buffer-file-name))
(message "No file is associated with this buffer.")))
(defun +qubes/qvm-copy-prompt-file ()
"Prompt for a file and copy it via qvm-copy."
(interactive)
(let ((file (read-file-name "File to copy: ")))
(if (and (file-exists-p file))
(progn
(shell-command (format "qvm-copy %s" (shell-quote-argument (expand-file-name file))))
(message "Copied %s via qvm-copy." file))
(message "Invalid file selected."))))
;; KEYBINDINGS
;; q prefix map
(map! :leader
:desc "qubes"
"f q" '(:ignore t :which-key "QubesOS commands")
:desc "qvm-copy a file"
"f q c" #'+qubes/qvm-copy-prompt-file
:desc "qvm-copy this file"
"f q C" #'+qubes/qvm-copy-current-file)
I registered the module in What really makes me scratch my head is that the module seems to be loaded as expected (the functions are available via M-x), but the prefix and keybindings only become available after doing either:
after startup. Then everything works like a charm. This is my first time messing with keybindings so I hope I'm not missing something terribly obvious. Thoughts/input/help greatly appreciated! System informationNo response |
Replies: 2 comments
|
It's this leader binding is resetting the To get around that you could load |
|
Thank you soo much! That would've taken me days if not weeks to figure out on my own. I took the latter approach as I don't want to clutter the Here's the updated keybinding/mapping part for anyone interested: (add-hook 'doom-after-modules-config-hook
(lambda ()
(map! :leader
:desc "qubes"
"f q" '(:ignore t :which-key "QubesOS commands")
:desc "qvm-copy a file"
"f q c" #'+qubes/qvm-copy-prompt-file
:desc "qvm-copy this file"
"f q C" #'+qubes/qvm-copy-current-file)))Now works exactly as desired! Thank you! For your lightning fast answer but also for doing DOOM Emacs in general! |
It's this leader binding is resetting the
fprefix. Modules aren't meant to bind leader keys (only localleader keys).To get around that you could load
:os qubesafter:config defaultin yourdoom!block, or bind those leader keys in adoom-after-modules-config-hookhook.