joern
joern

Reputation: 11

How can I insert empty lines into my org-mode agenda?

I am using org-mode to organize my tasks. I use standard priorities.

Is it possible to insert empty lines into the standard agenda view? I have many tasks per day, and usually sort them by priority. The #A are shown on top, #B in the middle, #C at the bottom.

I would like to have an empty line as a separator after each priority class (one empty line after all the #A tasks, one empty line after all #B tasks, one empty line after the #C tasks). This would make my agenda much more readable.

I do find help about how to insert dividers after blocks, but I do not use blocks.

Thank you!

Upvotes: 1

Views: 1350

Answers (1)

Dodgie
Dodgie

Reputation: 663

Here's a working solution from the code @lawlist provided in the comments. It will visually delimit the current day's tasks based on priority

  (defun my-custom-agenda-fn ()
    (save-excursion
     (let ((delimit "------------------------"))
      (org-agenda-goto-today)
      (dolist
          (priority '("\\[#A\\]" "\\[#B\\]" "\\[#C\\]" "\\[#D\\]" "\\[#E\\]"))
        (when (re-search-forward priority nil t)
          (goto-char (point-at-bol)) (insert (concat delimit "\n"))))
      (org-agenda-goto-today)
      (when (re-search-forward delimit nil t)
        (delete-region
         (progn (forward-visible-line 0) (point))
         (progn (forward-visible-line 1) (point))))
      ))
   )

(add-hook 'org-agenda-finalize-hook 'my-custom-agenda-fn)

Upvotes: 1

Related Questions