~w96k/dotfiles

d881dae09e97e17abec467bf352225d2c58912f7 — w96k 7 months ago 3600aa2
Add corfu documentation mode
1 files changed, 28 insertions(+), 26 deletions(-)

M emacs/.emacs.d/.emacs-config.org
M emacs/.emacs.d/.emacs-config.org => emacs/.emacs.d/.emacs-config.org +28 -26
@@ 903,33 903,35 @@ I use built-in project.el
*** Автодополнение кода и документация
По большей части я использую дефолтный Completion Buffer и Corfu
#+begin_src elisp :tangle init.el
  (when (package-loaded? "corfu")
    (progn
      (setq corfu-preview-current 'nil)
      (corfu-mode 1)
      (defun show-default-completion-buffer ()
	(interactive)
	(corfu-quit)
    (when (package-loaded? "corfu")
      (progn
	(setq corfu-preview-current 'nil
	      corfu-popupinfo-delay t)
	(corfu-mode 1)
	(defun show-default-completion-buffer ()
	  (interactive)
	  (corfu-quit)
	  (corfu-mode -1)
	  (completion-at-point)
	  (corfu-mode 1)
	  (corfu-popupinfo-mode 1))
	(define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
	(define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
	(define-key corfu-map (kbd "C-M-i") 'show-default-completion-buffer)      
	(corfu-mode -1)
	(completion-at-point)
	(corfu-mode 1))
      (define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
      (define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
      (define-key corfu-map (kbd "C-M-i") 'show-default-completion-buffer)      
      (corfu-mode -1)
      (add-hook 'prog-mode-hook 'corfu-mode)

      (defun corfu-send-shell (&rest _)
	"Send completion candidate when inside comint/eshell."
	(cond
	 ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
	  (eshell-send-input))
	 ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
	  (comint-send-input))))

      (advice-add #'corfu-insert :after #'corfu-send-shell)
      
      (add-hook 'eshell-mode-hook 'corfu-mode)))
	(add-hook 'prog-mode-hook 'corfu-mode)

	(defun corfu-send-shell (&rest _)
	  "Send completion candidate when inside comint/eshell."
	  (cond
	   ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
	    (eshell-send-input))
	   ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
	    (comint-send-input))))

	(advice-add #'corfu-insert :after #'corfu-send-shell)

	(add-hook 'eshell-mode-hook 'corfu-mode)))
#+end_src
*** Модификация дефолта
#+BEGIN_SRC emacs-lisp :tangle init.el