Use smart-tab to finally get TAB to do the right thing

This commit is contained in:
Vedang Manerikar 2024-12-18 15:07:24 +05:30
parent ae68d77b97
commit e53b122c0a
3 changed files with 37 additions and 7 deletions

View file

@ -2090,9 +2090,7 @@ Hippie uses Dabbrev as one of the expansion sources, so all the dabbrev settings
:END:
#+begin_quote
I generally do not rely on in-buffer text completion. I feel it slows
me down and distracts me. When I do, however, need to rely on it, I
have the ~corfu~ package by Daniel Mendler: it handles the task
... the ~corfu~ package by Daniel Mendler: it handles the task
splendidly as it works with Emacs' underlying infrastructure for
~completion-at-point-functions~.
@ -2116,7 +2114,7 @@ Also see [[#h:567bb00f-1d82-4746-93e5-e0f60721728a][the =unravel-completion.el=
(setq corfu-preview-current nil)
(setq corfu-min-width 20)
(setq corfu-popupinfo-delay '(1.25 . 0.5))
(setq corfu-popupinfo-delay '(2.0 . 1.0))
(corfu-popupinfo-mode 1) ; shows documentation after `corfu-popupinfo-delay'
;; Sort by input history (no need to modify `corfu-sort-function').
@ -2138,6 +2136,28 @@ Also see [[#h:567bb00f-1d82-4746-93e5-e0f60721728a][the =unravel-completion.el=
(completion-at-point-functions . cape-file))
#+end_src
** The =unravel-completion.el= for in-buffer completion using TAB (~smart-tab~)
:PROPERTIES:
:CUSTOM_ID: h:240488D1-B225-4877-86EE-40D5318B0A7E
:CREATED: [2024-12-18 Wed 14:59]
:END:
~smart-tab~ is an old but extremely reliable package that gets TAB to
"do the right thing". Other packages somehow fail to replicate this
functionality correctly.
#+begin_src emacs-lisp :tangle "unravel-modules/unravel-completion.el"
;;; smart-tab (TAB to do completion reliably)
(use-package smart-tab
:ensure (:repo "https://git.genehack.net/genehack/smart-tab.git" :branch "main")
:after corfu
:config
(setq smart-tab-using-hippie-expand t)
(setq smart-tab-expand-eolp nil)
(setq smart-tab-user-provided-completion-function 'corfu-complete)
(global-smart-tab-mode 1))
#+end_src
** The =unravel-completion.el= settings for ~consult~
:PROPERTIES:
:CUSTOM_ID: h:22e97b4c-d88d-4deb-9ab3-f80631f9ff1d
@ -4902,7 +4922,7 @@ is primarily by marking files in Dired and running =!=
:demand t
:config
(setq tab-always-indent 'complete)
(setq tab-first-completion 'word-or-paren-or-punct) ; Emacs 27
(setq tab-first-completion nil)
(setq-default tab-width 4
indent-tabs-mode nil))
#+end_src

View file

@ -199,7 +199,7 @@
(setq corfu-preview-current nil)
(setq corfu-min-width 20)
(setq corfu-popupinfo-delay '(1.25 . 0.5))
(setq corfu-popupinfo-delay '(2.0 . 1.0))
(corfu-popupinfo-mode 1) ; shows documentation after `corfu-popupinfo-delay'
;; Sort by input history (no need to modify `corfu-sort-function').
@ -220,6 +220,16 @@
(completion-at-point-functions . cape-emoji)
(completion-at-point-functions . cape-file))
;;; smart-tab (TAB to do completion reliably)
(use-package smart-tab
:ensure (:repo "https://git.genehack.net/genehack/smart-tab.git" :branch "main")
:after corfu
:config
(setq smart-tab-using-hippie-expand t)
(setq smart-tab-expand-eolp nil)
(setq smart-tab-user-provided-completion-function 'corfu-complete)
(global-smart-tab-mode 1))
;;; Enhanced minibuffer commands (consult.el)
(use-package consult
:ensure t

View file

@ -4,7 +4,7 @@
:demand t
:config
(setq tab-always-indent 'complete)
(setq tab-first-completion 'word-or-paren-or-punct) ; Emacs 27
(setq tab-first-completion nil)
(setq-default tab-width 4
indent-tabs-mode nil))