9

I am using Emacs with org mode. When asking for agenda view (C-c a), each todo line item is started with the name of the org file the item belongs to, or possibly, the category defined for the todo. This visibility consumes horisontal space, and I do not need this info. How can I turn that visiblity off?

2 Answers 2

13

The category and file-name that displays in the agenda view can be controlled with the variable org-agenda-prefix-format. For more information about customizing this variable, type: M-x describe-variable RET org-agenda-prefix-format RET

For example, I decided that I wanted a dot to precede each item and I commented out the more detailed option:

(require 'org-agenda)

(setq org-agenda-prefix-format '(
  ;; (agenda  . " %i %-12:c%?-12t% s") ;; file name + org-agenda-entry-type
  (agenda  . "  • ")
  (timeline  . "  % s")
  (todo  . " %i %-12:c")
  (tags  . " %i %-12:c")
  (search . " %i %-12:c")))
9
  • Thanks! but when I add this to my init.el file, the resulting agenda will be totally empty for todo's. This happens also if I exchange the (agenda . " . ") line in your code with the line you have commentetd out.
    – myotis
    Commented Nov 4, 2015 at 10:30
  • Then you'll need to add back one or more of the variables -- there are four (4) variables in the default format -- i, c, t, and s. Read through the doc-string to learn more about those four variables and then add back the ones you need. Pay particular attention to the section of the doc-string that begins with: "The default value for the agenda sublist is " %-12:c%?-12t% s", which means: . . ."
    – lawlist
    Commented Nov 4, 2015 at 16:02
  • When I add all four of them back, as in the line you have commented out, the agenda view is still empty for todo's.
    – myotis
    Commented Nov 4, 2015 at 16:07
  • Should the code be first or last in the init file?
    – myotis
    Commented Nov 4, 2015 at 16:09
  • You could try adding (require 'org-agenda) before the snippet in the answer, then save and restart Emacs. Since the variable org-agenda-prefix-format is defined within the org-agenda.el library, the library should be loaded before changing the default value of a variable defined within the library.
    – lawlist
    Commented Nov 4, 2015 at 16:13
1

Alternatively use org-agenda-custom-commands to apply org-agenda-prefix-format to a specific search. For example to have C-x a A display items with Active tag without the filename with which they were found:

(setq org-agenda-custom-commands
      '(("A" "Active Tags" tags "Active"
         ((org-agenda-overriding-header "My Active items")
          (org-tags-match-list-sublevels t)
          (org-agenda-prefix-format "  %?-12t% s")))))

Your Answer

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

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