3

What would prevent org-anniversary entries from appearing in the Agenda? Entries such as:

%%(org-anniversary 2015 01 01) New Year's Day

fail to show in the Agenda. I have toggled org-agenda-include-diary FWIW.

Update: Using Org 9.0.4:

  • I have ensured that the %% starts flush on the left margin.
  • I have tested the anniversary entry under a * and ** headline.
  • I have included the PROPERTIES drawer, as included in some example.
  • I have replaced the leading 0 characters in the dates with a space.

None of the above solved this -- the anniverary does still not appear in the agenda.

Starting Emacs with -Q and then evaluating only setq org-agenda-files ... to set my agenda file also doesn't result in the anniverary appearing in the agenda.

Including %%(org-calendar-holiday) results in those holidays appearing in the agenda.

SabreWolfy
  • 1,378
  • 1
  • 13
  • 26

3 Answers3

0

I'm not sure why diary entries in agenda files don't work as indicated in the info page (by my reading).

I'm using this to regenerate a temporary diary-file before each viewing of the agenda.

(defun read-lines (filePath)
  "Return a list of lines of a file at filePath."
  (with-temp-buffer
    (insert-file-contents filePath)
    (split-string (buffer-string) "\n" t)))

(defun agenda-diary-entries ()
  "List the lines from org-agenda-files that belong in
diary-files."
  (let ((agenda-files 
     (if (stringp org-agenda-files)
         (read-lines org-agenda-files)
       org-agenda-files)))
    (seq-filter
     (lambda (s) (string-match "^[%][%]" s))
     (apply #'append
            (mapcar #'read-lines agenda-files)))))

(defun string-list-to-file (string-list filePath)
  "Save a list of strings as the lines in filePath."
  (with-temp-file filePath
    (mapcar (lambda (s) (insert s "\n")) string-list)))

(defun update-diary-from-agenda ()
  "Update (overwrite) the diary-file with lines from
org-agenda-files."
  (string-list-to-file (agenda-diary-entries) diary-file))

(add-hook 'diary-hook #'update-diary-from-agenda)
Stefan
  • 26,154
  • 3
  • 46
  • 84
unDeadHerbs
  • 101
  • 4
0

You should provide your agenda file(s) as a list.

(setq org-agenda-files '("path-to-agenda-file.org"))

(see docstring of org-agenda-files).

dalanicolai
  • 6,108
  • 7
  • 23
-1

The org-anniversary seems to have been abandoned. Please try to do this: %%(org-date 2015 01 01) New Year's Day

@andrew-swann

* Birthdays
  :PROPERTIES:
  :CATEGORY: Ann
  :END:
%%(org-date 2018 8 3)Arthur Dent is %d years old

C-c [

C-c a a

enter image description here

GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian

539f
  • 1
  • 1