Function: hsys-consult--org-grep-tags-string

hsys-consult--org-grep-tags-string is a byte-compiled function defined in hsys-consult.el.

Signature

(hsys-consult--org-grep-tags-string)

Documentation

When on or between Org tags, return a consult-grep match string for them.

If on a colon, match to headlines with all tags around point, in any order. e.g. ":tag1: :tag2: :tag3: ". Otherwise, just match to the single tag around point.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hsys-consult.el
(defun hsys-consult--org-grep-tags-string ()
  "When on or between Org tags, return a `consult-grep' match string for them.
If on a colon, match to headlines with all tags around point, in any order.
e.g. \":tag1: :tag2: :tag3: \".  Otherwise, just match to the single
tag around point."
  (let (range
	tags)
    (if (equal (char-after) ?:)
	;;  On colon, search for HyWiki headings with all tags on line
	(setq range (hproperty:char-property-range nil 'face 'org-tag)
	      tags (when range (buffer-substring-no-properties (car range) (cdr range))))
      ;;   Else on a specific tag, search for HyWiki headings with that tag only
      (setq range (hargs:delimited ":" ":" nil nil t)
	    tags (nth 0 range)
	    range (cons (nth 1 range) (nth 2 range))))
    (when (and tags range)
      (ibut:label-set tags (car range) (cdr range))
      (concat ".*" (string-join (mapcar (lambda (tag)
					  (concat ":" (regexp-quote tag) ":"))
					(split-string tags ":" t))
				" ")))))