Function: just-src-edit--find-task-bounds
just-src-edit--find-task-bounds is a natively compiled function
defined in just-ts-mode.el.
Signature
(just-src-edit--find-task-bounds)
Documentation
Find the bounds of the task at point.
Returns (task-name body-start body-end) or nil if not in a task.
Source Code
;; Defined in /nix/store/1vmf8s52d6vniw28ckf3szxslimhfphb-emacs-packages-deps/share/emacs/site-lisp/elpa/just-ts-mode-20260319.1513/just-ts-mode.el
(defun just-src-edit--find-task-bounds ()
"Find the bounds of the task at point.
Returns (task-name body-start body-end) or nil if not in a task."
(save-excursion
(let ((start-pos (point))
(task-regexp "^@?\\([A-Z_a-z][0-9A-Z_a-z-]*\\).*:[^=]")
task-name body-start body-end)
;; Find the task we're currently in using the same regex as imenu
;; Go back to find a task line
(while (and (not (bobp))
(not (looking-at task-regexp)))
(forward-line -1))
;; Task line found
(when (looking-at task-regexp)
(setq task-name (match-string 1))
(setq body-start (line-beginning-position 2))
;; Find the next line with no indentation (column 0)
(forward-line 1)
(while (and (not (eobp))
(not (and (not (looking-at "^\\s-*$")) ; not empty line
(looking-at "^[^ \t\n]")))) ; starts at column 0
(forward-line 1))
;; Go back to find the last non-empty line before the unindented line
(forward-line -1)
(while (and (> (point) body-start)
(looking-at "^\\s-*$"))
(forward-line -1))
(setq body-end (line-end-position))
;; Ensure body-end is at least at body-start
(when (<= body-end body-start)
(setq body-end (save-excursion
(goto-char body-start)
(line-end-position))))
;; Check if original point was within the task body
(when (and (>= start-pos body-start)
(<= start-pos body-end))
(list task-name body-start body-end))))))