um--tag-first-in-buffer
This commit is contained in:
parent
34d1789ac2
commit
1bbf31520a
1 changed files with 5 additions and 12 deletions
17
um.el
17
um.el
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue