'(academic-phrases avy ace-window alert
all-the-icons all-the-icons-completion anzu
auctex-latexmk bbdb benchmark-init browse-at-remote
- browse-kill-ring cape corfu command-log-mode dabbrev define-word
+ browse-kill-ring corfu command-log-mode dabbrev define-word
diff-hl diminish disable-mouse dockerfile-mode elfeed
embark-consult erlang exec-path-from-shell
flymake-swi-prolog ggtags git-blamed
:END:
#+begin_src emacs-lisp
+ (defun esy/dabbrev-capf ()
+ "Workaround for issue with `dabbrev-capf'."
+ (dabbrev--reset-global-variables)
+ (setq dabbrev-case-fold-search nil)
+ (dabbrev-capf))
+
+ (defun esy/file-capf ()
+ "File completion at point function."
+ (let ((bs (bounds-of-thing-at-point 'filename)))
+ (when bs
+ (let* ((start (car bs))
+ (end (cdr bs))
+ (file (buffer-substring-no-properties start end)))
+ `(,start ,end completion--file-name-table . (:exclusive no))))))
+
(defun esy/setup-completions ()
"Setup completions related-package."
(require 'corfu)
(require 'dabbrev)
- (require 'cape)
(require 'marginalia)
(require 'orderless)
(require 'all-the-icons)
completion-auto-select nil
completion-styles '(basic orderless)
completion-show-help nil
- completions-header-format (propertize "%s candidates:\n" 'face 'shadow)
+ completions-header-format (propertize "%s candidates:\n"
+ 'face 'shadow)
completion-auto-help 'visual
completions-max-height 16
completion-wrap-movement t)
#'minibuffer-next-completion)
(global-corfu-mode)
(marginalia-mode)
- (add-to-list 'completion-at-point-functions #'cape-file)
- (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
+ (add-to-list 'completion-at-point-functions #'esy/dabbrev-capf)
+ (add-to-list 'completion-at-point-functions #'esy/file-capf)
+ (add-hook 'marginalia-mode-hook
+ #'all-the-icons-completion-marginalia-setup)
(add-to-list 'display-buffer-alist
'("*Completions*"
(display-buffer-reuse-window display-buffer-at-bottom)