3

I've been writing my own custom org-agenda views lately, and I've had good luck playing around with org-agenda-prefix-format for customizing the format for my different tasks. I occasionally would like to include extra information, typically via my own added property tags. However, while I've been adding this extra information /before/ the task of interest, I'd prefer to include it /after/ the task.

For example, I currently display calendar events as:

Serenity:    18:00-19:00
              Location: Jaynestown
              Scheduled: TODO Help the Mudders

However, I'd like for this information to appear in the following order:

Serenity:    18:00-19:00 
              Scheduled: TODO Help the Mudders
              Location: Jaynestown

Notice that this cannot be done with org-agenda-prefix-format since some of the added text occurs after TODO Help the Mudders.

===

Edit: Here's the code I used to generate the above:

(defun gs/org-agenda-add-location-string ()
  "Gets the value of the LOCATION property"
  (let ((loc (org-entry-get (point) "LOCATION")))
    (if (> (length loc) 0)
    (concat "\n" (make-string 15 ?\s) "Location: " loc
        "\n" (make-string 15 ?\s))
      "")))

And then use this custom function as follows (within org-agenda-custom-commands):

(org-agenda-prefix-format '((agenda . "  %-12:c%?-12t %(gs/org-agenda-add-location-string)% s") ...
3
  • What does your original task look like before the org-agenda buffer gets created, and what code are you using to create your first example? How about modifying org-agenda-format-item? By tweaking org-agenda-format-item, you can change any entry that is gathered prior to the creation of the org-agenda buffer.
    – lawlist
    Aug 13, 2016 at 20:43
  • @lawlist I've added my source above at you're request. I'd like to avoid modifying org-agenda-format-item if possible, but if no built-in solution exists, I'm willing to give it a try.
    – GJStein
    Aug 13, 2016 at 23:03
  • You could use the org-agenda-finalize-hook to comb the buffer and modify text after it has already been inserted, but that is not as ideal as modifying the text before it gets inserted. Here is a link to an example of gathering the raw data in the event you want to go crazy and create your own custom org-agenda view: emacs.stackexchange.com/a/12563/2287
    – lawlist
    Aug 14, 2016 at 3:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.