diff options
| author | Adrian Kummerlaender | 2026-01-07 13:17:05 +0100 |
|---|---|---|
| committer | Adrian Kummerlaender | 2026-01-07 13:17:05 +0100 |
| commit | d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8 (patch) | |
| tree | bb32a5c2cce9f2bd004eb7526003479a70e342c0 | |
| parent | f40e97a7b131975f88a6c520eefe8f9a125b23b2 (diff) | |
| download | nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.tar nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.tar.gz nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.tar.bz2 nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.tar.lz nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.tar.xz nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.tar.zst nixos_home-d9faf9fbdeb44b5be0d8dfea3bb4b5f400d588c8.zip | |
Emacs tweakswayland
| -rw-r--r-- | gui/conf/init.el | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/gui/conf/init.el b/gui/conf/init.el index 567b1cf..d69e77b 100644 --- a/gui/conf/init.el +++ b/gui/conf/init.el @@ -323,6 +323,25 @@ (use-package ob-async :ensure t) +(defun custom/gptel-menu-org-fix (orig-fun &rest args) + "Temporarily unbind <return> in Evil-Org normal state so Transient can catch it." + (if (not (eq major-mode 'org-mode)) + (apply orig-fun args) + ;; 1. Get the specific Evil keymap for Org Normal state + (let* ((aux-map (evil-get-auxiliary-keymap org-mode-map 'normal)) + (old-binding (lookup-key aux-map (kbd "<return>")))) + ;; 2. Unbind <return> immediately + (define-key aux-map (kbd "<return>") nil) + ;; 3. Define restoration logic + (defun custom/gptel-restore-binding () + "Restore the original binding and remove hook." + (when (bound-and-true-p aux-map) + (define-key aux-map (kbd "<return>") old-binding)) + (remove-hook 'transient-exit-hook #'custom/gptel-restore-binding)) + ;; 4. Add hook and run the menu + (add-hook 'transient-exit-hook #'custom/gptel-restore-binding) + (apply orig-fun args)))) + (use-package gptel :ensure t :config @@ -352,6 +371,7 @@ :key (lambda () (gptel--read-key-file "~/.kit-ai-key")) :models '("azure.gpt-5"))) (setq gptel-default-model "Google:gemini-flash-latest")) + (advice-add 'gptel-menu :around #'custom/gptel-menu-org-fix)) (use-package ob-gptel :ensure t @@ -429,10 +449,12 @@ "m" 'hydra-org-mode-local/body (kbd "<return>") (lambda () (interactive) - (if current-prefix-arg - (let ((browse-url-browser-function browse-url-secondary-browser-function)) - (call-interactively 'org-open-at-point)) - (call-interactively 'org-open-at-point)))) + (if (eq transient-current-command 'gptel-menu) + (gptel-send) + (if current-prefix-arg + (let ((browse-url-browser-function browse-url-secondary-browser-function)) + (call-interactively 'org-open-at-point)) + (call-interactively 'org-open-at-point))))) (use-package helm :ensure t |
