branch: externals/gtags-mode
commit a3b99b9aa612a792a6f2a7d05b88a8b8e7436cf1
Author: Jimmy Aguilar Mena <kratsbinov...@gmail.com>
Commit: Jimmy Aguilar Mena <kratsbinov...@gmail.com>

    Enable the mode in all the already opened buffers sharing root.
    
    This happens only when called interactively and complements
    global-xref--find-file-hook.
---
 global-xref.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/global-xref.el b/global-xref.el
index 71f54376ab..5f3e3b02b8 100644
--- a/global-xref.el
+++ b/global-xref.el
@@ -322,7 +322,14 @@ any additional command line arguments to pass to GNU 
Global."
     (add-hook 'xref-backend-functions #'global-xref-xref-backend nil t)
     (add-hook 'after-save-hook #'global-xref--after-save-hook nil t)
     (setq global-xref--imenu-default-function imenu-create-index-function)
-    (setq imenu-create-index-function 
#'global-xref-imenu-create-index-function))
+    (setq imenu-create-index-function 
#'global-xref-imenu-create-index-function)
+    ;; Enable the mode in all the files inside `global-xref--project-root'
+    (when (called-interactively-p 'all)
+      (mapc (lambda (buff)
+             (with-current-buffer buff
+               (unless global-xref-mode
+                 (global-xref-mode 1))))
+           (global-xref--buffers-in-root global-xref--project-root))))
    (t
     (setq global-xref--project-root nil)
     (remove-hook 'find-file-hook #'global-xref--find-file-hook)

Reply via email to