.emacs.d

the most bloated Emacs config on this planet
git clone https://git.trogloxene.org/.emacs.d.git
Log | Files | Refs

commit e7111ed9b4e992cd678f921b4a1b4523e4b3299e
parent e1fb1ebbc41f973f6915b82b5b8335724d0b6cef
Author: andsy10 <andsy1016@gmail.com>
Date:   Sun,  9 Aug 2026 08:44:57 +0800

Optimize org-mode completion and cape setup

Diffstat:
Mlisp/init-completion.el | 22+++++++++++++++-------
Mlisp/init-org.el | 8++++++++
2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/lisp/init-completion.el b/lisp/init-completion.el @@ -159,12 +159,13 @@ targets." (after-init . corfu-popupinfo-mode) (after-init . corfu-history-mode) :config - ;;Quit completion before saving (add-hook 'before-save-hook #'corfu-quit) (add-hook 'eshell-mode-hook (lambda () (setq-local corfu-auto nil) - (local-set-key (kbd "TAB") #'completion-at-point)))) + (local-set-key (kbd "TAB") #'completion-at-point))) + (add-hook 'org-mode-hook + (lambda () (setq-local corfu-auto nil)))) (if (not (and (display-graphic-p) (>= emacs-major-version 31))) @@ -175,20 +176,27 @@ targets." ;; cape (use-package cape :commands (cape-file cape-elisp-block cape-keyword) - :autoload (cape-wrap-noninterruptible cape-wrap-nonexclusive cape-wrap-buster) + :autoload (cape-wrap-nonexclusive cape-wrap-buster) :autoload (cape-wrap-silent) :init - ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev) + (add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-file) (add-to-list 'completion-at-point-functions #'cape-elisp-block) (add-to-list 'completion-at-point-functions #'cape-keyword) - ;; (add-to-list 'completion-at-point-functions #'cape-abbrev) + (add-to-list 'completion-at-point-functions #'cape-abbrev) - ;; Make these capfs composable. (advice-add 'comint-completion-at-point :around #'cape-wrap-nonexclusive) (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) (advice-add 'eglot-completion-at-point :around #'cape-wrap-nonexclusive) - (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive)) + (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-nonexclusive) + + (defun my-org-completion-setup () + (add-hook 'completion-at-point-functions #'cape-file nil t) + (add-hook 'completion-at-point-functions #'cape-elisp-symbol nil t)) + (add-hook 'org-mode-hook #'my-org-completion-setup) + + :config + (setf (alist-get 'org-mode cape-elisp-symbol-wrapper) '(?= ?=))) (provide 'init-completion) ;;; init-completion.el ends here diff --git a/lisp/init-org.el b/lisp/init-org.el @@ -19,6 +19,14 @@ (*is-android* "~/storage/shared/my-org-note"))) :config + (defun my-org-tab-complete-on-keyword-line () + (when (save-excursion + (beginning-of-line) + (looking-at-p "[ \t]*#\\+")) + (let ((completion-at-point-functions '(pcomplete-completions-at-point t))) + (completion-at-point)))) + (add-hook 'org-cycle-tab-first-hook #'my-org-tab-complete-on-keyword-line) + (defvar org-hide-space-keywords '(("\\cc\\( \\)[*/_=~+]\\cc.*?[*/_=~+]" (0 (prog1 () (add-text-properties (match-beginning 1) (match-end 1) '(invisible t)))))