Changeset 279dc2a in dotfiles


Ignore:
Timestamp:
Oct 28, 2022, 3:57:25 PM (2 years ago)
Author:
w96k <w96k@…>
Branches:
master
Children:
8e15ad4
Parents:
a438ed9
Message:

Make corfu work in eshell/shell buffers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emacs/.emacs.d/.emacs-config.org

    ra438ed9 r279dc2a  
    856856      (corfu-mode 1)
    857857      (defun show-default-completion-buffer ()
    858           (interactive)
    859           (corfu-quit)
    860           (corfu-mode -1)
    861           (completion-at-point)
    862           (corfu-mode 1))
     858        (interactive)
     859        (corfu-quit)
     860        (corfu-mode -1)
     861        (completion-at-point)
     862        (corfu-mode 1))
    863863      (define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
    864864      (define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
     
    866866      (corfu-mode -1)
    867867      (add-hook 'prog-mode-hook 'corfu-mode)
     868
     869      (defun corfu-send-shell (&rest _)
     870        "Send completion candidate when inside comint/eshell."
     871        (cond
     872         ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
     873          (eshell-send-input))
     874         ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
     875          (comint-send-input))))
     876
     877      (advice-add #'corfu-insert :after #'corfu-send-shell)
     878     
    868879      (add-hook 'eshell-mode-hook 'corfu-mode)))
    869880
Note: See TracChangeset for help on using the changeset viewer.