2

I am trying to create a weekly agenda that I can print out and use without having to be at the computer

To best explain my problem I will use some screenshots

This is the normal org file that I will export as an agenda

enter image description here

These are the settings I have in for exporting my agenda

(setq org-agenda-exporter-settings
       '((ps-number-of-columns 1)
         (ps-landscape-mode nil)
         (org-agenda-add-entry-text-maxlines 5)
         ))   

(setq org-agenda-prefix-format "[ ] %t ")
(setq org-agenda-entry-text-mode t)
(setq org-agenda-entry-text-maxlines 5)
(setq org-agenda-skip-additional-timestamps-same-entry nil)
(setq org-agenda-use-time-grid nil)
(setq org-agenda-with-colors t)
(setq org-agenda-remove-tags nil)
(setq ps-print-header nil)

And a screen shot below shows the result of the export (as a pdf file) enter image description here

The problem here is that I am interested in displaying extra information under each headline (for example ring exercise has a sub list of different exercises to do) however when I do this I am forced to print out the whole time stamp and its syntax as well.

But I don't need this since I already formatted the prefix to display the time. This time stamp also takes up to much space.

I was wondering if there was any way that I can get rid of just the timestamp line but preserve the rest of the text under each headline?

I tried searching for ways to do this but to avail. I just continually found ways to edit, filter and organize specific agenda headings but not edit the info underneath.

If there is no function or variable that I can use, how can I structure my org file to avoid this problem?

  • does my answer below work for you? – gregoryg Jul 13 at 16:44
  • 1
    yeah it does sorry for the delay – user3145648 Jul 14 at 8:23
1

Just to make it clear, this is not a problem with exporting, but of showing entry text in the agenda.

Turns out there is a variable to exclude text that matches a list of regular expressions.

You can exclude anything that looks like an active timestamp (there is also the variable org-element--timestamp-regexp but that did not work in my tests):

(setq org-agenda-entry-text-exclude-regexps 
      '("<[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^>]*>"))

That does not exclude the whole line, so you will still have an indicator showing an empty line, like this

Day-agenda (W30):
2020-07-24 Fri _________________________________________________________________
[ ]  7:00- 8:30 TODO Ring exercise
    >      
    > - [ ] angled pullups (for back)
    > - [ ] angled pushups (for chest)
    > - [ ] squats (for legs)
    > - [ ] lunges (for legs)
[ ] 12:00-13:00 TODO Check weight and record it on calendar

To get rid of the now-empty lines, you can add a finalizer hook

(defun gg/entry-text-nix-empty-line ()
  "Delete empty entry text lines in agenda"
  (goto-char (point-min))
  (replace-regexp (concat "^ *" org-agenda-entry-text-leaders " *\n") ""))

(add-hook 'org-agenda-finalize-hook 'gg/entry-text-nix-empty-line)
| improve this answer | |
  • 1
    thank you so much for the response, I never realized that there was a variable that can modify the text under the heading – user3145648 Jul 14 at 8:23
  • 1
    Also another point that I would like to add is that for getting rid the empty lines, I tried your function but it didn't work, HOWEVER when I put the time stamp at the bottom of the text (i.e. the underneath the sub lists) then the empty line automatically disappears anyway. Convenient! – user3145648 Jul 14 at 8:26

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.