1

I'd like to use the default prefix for "time grids" in org agenda, but set a custom prefix for other tasks.

One approach could be to use a block agenda, with one block being just a time grid, and another block other just having non time-grid items. Is this possible?

The goal is to not have duplicate items in the block with the time grid, and the block with the custom prefix agenda.

Alternatively, if there was a way to just get the default time-grid prefix when using a custom prefix for normal agenda items that would mean I wouldn't even need a block agenda.

  • Not an answer to your exact question as to creating a custom prefix for the standard time-grid feature (which would probably be a feature request), but have you already looked at the org-agenda column view, which places overlays in the form of a grid on top of the regular agenda buffer underneath?: orgmode.org/manual/Agenda-column-view.html – lawlist Sep 4 '15 at 1:35
  • Hmm, yeah, I have seen that. It's interesting, but I don't think it helps with either solution (custom grid prefix, or agenda with just time grid)? – avv Sep 5 '15 at 2:24
3

You can set the prefix for different kinds of agenda view separately:

org-agenda-prefix-format is a variable defined in `org-agenda.el'.

Its value is

((agenda . " %i %-12:c%?-12t% s") (timeline . " % s") (todo . " %i %-12:c") (tags . " %i %-12:c") (search . " %i %-12:c"))

Documentation: Format specifications for the prefix of items in the agenda views. An alist with five entries, each for the different agenda types. The keys of the sublists are agenda',timeline', todo',search' and `tags'. The values are format strings.

But you are not limited to setq'ing this. Custom agenda views let you set variables on a per-block basis. For example:

(setq org-agenda-custom-commands
      '(("c" . "My Custom Agendas")
        ("co" "Agenda Overview"
         ((agenda ""
                  ((org-agenda-overriding-header "Today, Tomorrow (and Yesterday)")
                   (org-agenda-files (nconc (org-agenda-files) '("~/org/sunrise.org")))
                   (org-agenda-start-day "-1d")
                   (org-agenda-span 3)
                   (org-agenda-start-on-weekday nil)
                   (org-agenda-show-all-dates t)
                   (org-agenda-use-time-grid t)))
          (tags-todo "projectx"
                  ((org-agenda-overriding-header "\nProject Tasks")
                   (org-agenda-prefix-format "%(my-project-agenda-prefix)"))))
         ((org-agenda-compact-blocks nil)
          (org-agenda-block-separator nil)
          (org-agenda-show-all-dates nil)
          (org-agenda-repeating-timestamp-show-all t)
          (org-agenda-start-with-clock-report-mode nil)
          (org-agenda-use-time-grid nil)
          (org-agenda-prefix-format ((agenda . " %i %-12:c%?-12t% s")
                                     (timeline . "  % s")
                                     (todo . " %i %-12:c")
                                     (tags . " %i %-12:c")
                                     (search . " %i %-12:c"))))   ;; settings for both above blocks
         nil)                                                     ;; exports blocks to this file with C-c a e
        ))

The org-agenda-prefix-format at the bottom overrides the global setting for both blocks in this custom agenda view, and the org-agenda-prefix-format in the top block overrides that for just this block.

You can switch on or off the time grid with org-agenda-use-time-grid.

  • Thanks for the detailed response, but unless I'm misunderstanding, I don't think it addresses my question. I modified the question to hopefully be a little clearer. – avv Sep 6 '15 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.