um--tag-first-in-buffer

This commit is contained in:
bth 2026-06-07 10:12:03 -07:00
commit 1bbf31520a

17
um.el
View file

@ -173,21 +173,15 @@
(defvar um-tags-history nil "History of inserted or searched for tags. Populates (defvar um-tags-history nil "History of inserted or searched for tags. Populates
`completing-read'.") `completing-read'.")
(defun um--header-current-buffer ()
(car (split-string (buffer-substring-no-properties (point-min) (point-max))
"\n\n" t
)))
(defun um--header-end-pos () (defun um--header-end-pos ()
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(search-forward "\n\n"))) (search-forward "\n\n")))
(defun um--tag-first-in-current-buffer () (defun um--tag-first-in-buffer ()
(let ((header (um--header-current-buffer))) (save-excursion
(string-match um--tag-regexp header) (when (search-forward um--tag-regexp (um--header-end-pos) t)
(match-string 1 header) (match-string 1))))
))
;;;###autoload ;;;###autoload
(defun um-tag-grep () (defun um-tag-grep ()
@ -211,8 +205,7 @@ Ultimately this relies on `xref-matches-in-files', which calls
;; NOTE: this means searches ;; NOTE: this means searches
;; will add to the history: ;; will add to the history:
'um-tags-history 'um-tags-history
(um--tag-first-in-current-buffer) (um--tag-first-in-buffer))
)
"$"))) "$")))
(defun um--extract-tags (files) (defun um--extract-tags (files)