Skip to content

Commit a5df51c

Browse files
committed
fix(citre): add a way to ignore enabling citre-mode in some modes
This is used to fix the too slow `bash-ts-mode`/`sh-mode` in large code bases
1 parent 5af1032 commit a5df51c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

modules/me-tags.el

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
;; Author: Abdelhak Bougouffa (rot13 "nobhtbhssn@srqbencebwrpg.bet")
66
;; Created: 2024-05-21
7-
;; Last modified: 2025-05-09
7+
;; Last modified: 2025-05-26
88

99
;;; Commentary:
1010

@@ -55,6 +55,12 @@
5555
"List of directories to be ignored when creating the file list using `+citre-gtags-find-files-command'."
5656
:type '(repeat string)
5757
:group 'minemacs-prog)
58+
59+
(defcustom +citre-auto-enable-ignore-modes '(bash-ts-mode sh-mode)
60+
"Don't auto-enable `citre-mode' in these modes.
61+
This complements `citre-auto-enable-citre-mode-modes'."
62+
:type '(repeat symbol)
63+
:group 'minemacs-prog)
5864
:config
5965
(defvar-keymap +citre-navigation-map
6066
:doc "Citre navigation commands." :name "citre-navigation"
@@ -68,6 +74,14 @@
6874
"Q" #'citre-query-jump)
6975
(keymap-set citre-mode-map "C-c C-p" `("citre-navigation" . ,+citre-navigation-map))
7076

77+
;; HACK: Don't enable `citre-mode' in some modes, this fixes the too slow
78+
;; `bash-ts-mode' in large code bases
79+
(advice-add
80+
'citre-auto-enable-citre-mode :around
81+
(satch-defun +citre--auto-enable-ignore-modes (fn)
82+
(unless (and +citre-auto-enable-ignore-modes (derived-mode-p +citre-auto-enable-ignore-modes))
83+
(funcall fn))))
84+
7185
;; BUG: The tilde "~" character cannot be expanded in some Tramp methods (like
7286
;; sshfs), causing `citre' to trigger an error when calling
7387
;; `citre--tags-file-in-global-cache'. This happens when openning any file of

0 commit comments

Comments
 (0)