feat: org-agenda cursor at task name (after TODO + priority)
This commit is contained in:
33
templates/org-agenda-cursor.el
Normal file
33
templates/org-agenda-cursor.el
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
;; Org agenda: kurzor na název úkolu (za TODO keyword a prioritou)
|
||||||
|
;; Přidat do ~/.config/doom/config.el
|
||||||
|
|
||||||
|
(defun my/org-agenda-goto-task-name (&rest _)
|
||||||
|
"Přesune kurzor na název úkolu na aktuálním řádku agendy.
|
||||||
|
Přeskočí TODO keyword (TODO, DONE, WAIT…) a prioritu [#A]."
|
||||||
|
(when (get-text-property (line-beginning-position) 'org-hd-marker)
|
||||||
|
(beginning-of-line)
|
||||||
|
(let* ((bol (point))
|
||||||
|
(eol (line-end-position))
|
||||||
|
(todo-end nil)
|
||||||
|
(pos bol))
|
||||||
|
;; Najdi konec TODO keyword podle face (org-todo nebo org-agenda-done)
|
||||||
|
(while (< pos eol)
|
||||||
|
(let* ((face (get-text-property pos 'face))
|
||||||
|
(next (or (next-single-property-change pos 'face nil eol) eol)))
|
||||||
|
(when (and face
|
||||||
|
(or (and (symbolp face)
|
||||||
|
(memq face '(org-todo org-agenda-done)))
|
||||||
|
(and (listp face)
|
||||||
|
(cl-intersection face '(org-todo org-agenda-done)))))
|
||||||
|
(setq todo-end next))
|
||||||
|
(setq pos next)))
|
||||||
|
;; Přesuň se za TODO keyword a volitelnou prioritu
|
||||||
|
(when todo-end
|
||||||
|
(goto-char todo-end)
|
||||||
|
(skip-chars-forward " \t")
|
||||||
|
;; Přeskočit prioritu [#A] pokud je přítomna
|
||||||
|
(when (looking-at "\\[#.\\][ \t]+")
|
||||||
|
(goto-char (match-end 0)))))))
|
||||||
|
|
||||||
|
(advice-add 'org-agenda-next-line :after #'my/org-agenda-goto-task-name)
|
||||||
|
(advice-add 'org-agenda-previous-line :after #'my/org-agenda-goto-task-name)
|
||||||
Reference in New Issue
Block a user