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.

5
  • 1
    Here is a link to a related thread regarding org-anniversary -- perhaps something in there can guide you towards a proper setup. emacs.stackexchange.com/q/7869/2287
    – lawlist
    Apr 22, 2015 at 14:35
  • Where is the entry? Is it in the diary or in .org file?
    – and
    Apr 28, 2015 at 18:45
  • In a .org file.
    – SabreWolfy
    Apr 28, 2015 at 19:14
  • Well if you want to use org-anniversary in org-mode, you don't need org-agenda-include-diary anyways, right? That's only if you wanted to use org-diary-file Apr 11, 2016 at 4:51
  • @lawlist: Thanks, but nothing there solved this.
    – SabreWolfy
    Mar 9, 2017 at 11:28

3 Answers 3

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)
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).

-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

2
  • Can you provide a demonstration of this working and give the relevant version info? Aug 3, 2018 at 8:12
  • GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian
    – 539f
    Aug 3, 2018 at 8:43

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.