emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Can I ask "Which day is it?" when filtering org-agenda views?


From: Trevor Murphy
Subject: [O] Can I ask "Which day is it?" when filtering org-agenda views?
Date: Tue, 10 Sep 2013 11:12:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

As preface, I'm aware that I may have gone too far down the rabbit hole. I'm inserting many time grid lines (one per half hour) into my agenda views so I have a visual sense of my free / busy time. But I want time grid lines that have already passed to disappear, freeing up screen real estate for later lines.

This was pretty easy. I customized `org-agenda-time-grid' to give me a line at every half-hour interval. Then I set `org-agenda-before-sorting-filter-function' to return nil for time grid lines where the "time-of-day" text property is in the past. In case that description isn't clear, I'm using (apologies for Gmail formatting):

(defun my:org-agenda-before-sorting-filter-function (org-agenda-item)
 (unless (and
(string= (nth 1 org-agenda-time-grid) (get-text-property 0 'txt org-agenda-item)) (< (get-text-property 0 'time-of-day org-agenda-item)
                 (string-to-number (format-time-string "%H%M"))))
   org-agenda-item))

As an unanticipated side effect, my function also throws out time grid lines when I view tomorrow (and other days) in the agenda view. Is there an additional check I can throw into my function to only filter if the "day" of the time grid line is today? I tried the obvious (get-text-property 0 'day org-agenda-item) but it seems that the "day" text property isn't put into the item until /after/ the filter-function gets a chance to process it.

Alternatively, if my attempted solution is brain-damaged please let me know a better way to manage the time grid lines.

--
Trevor Murphy GnuPG Key: 0xCB06EAAF



reply via email to

[Prev in Thread] Current Thread [Next in Thread]