branch: externals/gtags-mode commit a9f6acbaba36103c7fc2be1e6a10adc31e2547da Author: Jimmy Aguilar Mena <kratsbinov...@gmail.com> Commit: Jimmy Aguilar Mena <kratsbinov...@gmail.com>
List GTAGS buffers. global-xref--buffers-in-root : New function returning the list of buffers opened in root. --- global-xref.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/global-xref.el b/global-xref.el index c6215969a7..3939dd3709 100644 --- a/global-xref.el +++ b/global-xref.el @@ -225,6 +225,15 @@ one of them." (when (global-xref--has-open-root buffer-file-name) (global-xref-mode 1))) +(defun global-xref--buffers-in-root (root) + "Return a list of buffers which variable `buffer-file-name' is inside ROOT." + (mapcan (lambda (buf) + (when-let* ((bname (buffer-local-value 'buffer-file-name buf)) + (tname (file-truename bname)) + ((string-prefix-p root tname))) + (list buf))) + (buffer-list))) + ;; xref integration ================================================== (defun global-xref--find-symbol (args symbol) "Run GNU Global to create xref input list with ARGS on SYMBOL.