Search code examples
emacsorg-mode

Org-mode: Output Weekly agenda using -batch and -eval


I am trying to display my org agenda on the background of my desktop even when Emacs is closed or minimized. I have made some progress using this command:

emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' 2> /dev/null

It outputs:

  Global list of TODO items of type: ALL
Available with `N r': (0)[ALL]
  remind:     TODO Garbage
  remind:     TODO Garbage and Recycling
  remind:     TODO Refill Prescription
  remind:     TODO Vitamins
  remind:     TODO Water Indoor Plants
  remind:     TODO Wake up!
  remind:     TODO Go to Sleep!

My .emacs contains the following relevant lines:

;; org-agenda
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb) 

(setq org-agenda-files (list "~/Code/remind.org"
                             "~/Code/todo.org"
                         ))
;; show org-agenda each time Emacs is opened
(add-hook 'after-init-hook 'org-agenda-list)

My question is this. How do I customize this output to not display the following?

  Global list of TODO items of type: ALL
Available with `N r': (0)[ALL]

Solution

  • Use a different command key argument in the call to org-batch-agenda, e.g.:

    (org-batch-agenda "a")

    The doc string for org-batch-agenda says:

    If CMD-KEY is a string of length 1, it is used as a key in ‘org-agenda-custom-commands’ and triggers this command.

    If you don't like any of the existing ones, you can always define your own agenda custom command and attach a key to it; then you can call org-batch-agenda with that key.