1
votes

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!

1
Although the following link is far beyond what most people will ever use, it is a method of creating a custom agenda view for those items normally created with the org-agenda-list function. It is possible to examine the text-properties of the data that is gathered and then alter one or more elements of the list and/or insert new lines (based on select criteria) into the buffer as it is being populated. emacs.stackexchange.com/a/12563/2287 I have been using a custom agenda view for the past couple of years and have grown quite fond of it. - lawlist
Another option would be to use something like the org-agenda-mode-hook and alter the data in the stock/regular/normal agenda buffer (with a custom function) at the tail end of the population process. Let's say for example that the buffer is sorted so that groups of priorities are together -- the custom function can search for the first priority of the group and insert a \n before the first heading in that group. - lawlist
Here is a simple example of how to modify the agenda buffer at the tail end of the creation process using the org-agenda-finalize-hook -- just add the snippet to the .emacs file, save and restart Emacs. (require 'org-agenda) (defun my-custom-agenda-fn () (save-excursion (goto-char (point-min)) (dolist (priority '("\\[#A\\]" "\\[#B\\]" "\\[#C\\]" "\\[#D\\]" "\\[#E\\]")) (when (re-search-forward priority nil t) (goto-char (point-at-bol)) (insert "\n"))))) (add-hook 'org-agenda-finalize-hook 'my-custom-agenda-fn) - lawlist
If you wouldn't mind editing your question to include detailed examples of before and proposed after, then I'd be happy to take a stab at an answer later on in the day. Please use just text in your detailed examples so that I can block/copy the test data without retyping everything based on an image/picture. You can create a verbatim block in your question by placing at least four (4) spaces at the beginning of each line. - lawlist
If you'd like to post an answer after you get everything working, then that will show this question as having been resolved -- I believe the waiting period is something like 36 to 48 hours (after posting the question) before you can accept your own answer, so you can check back later on in the week to place a check-mark next to your own answer. - lawlist

1 Answers

1
votes

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)