Re: [O] agenda view help - viewing all time entries for a tag

2019-01-12 Thread Kyle Meyer
[sorry for the slow response]

Jeff Filipovits  writes:

> Say I have a calendar file which is in the following format:
>
> * description of deadline:client1:
> DEADLINE: <2018-10-28 Tue>
>
> * a meeting :client1:
> <2018-11-1 Thu 10:00>
>
>  I would like to be able to view all headlines and time entries associated
> with a particular tag, and to have that information visible in an agenda
> buffer, and for the entries to appear in chronological order along with the
> associated dates
>
> [...]
> 
> It seems like this should be relatively easy to accomplish.

Hmm, I might be missing something obvious, but here’s the best I can
come up with.

First, specify that you want the tag search to sort based on timestamp,
earliest first:

  (add-to-list 'org-agenda-sorting-strategy '(tags timestamp-up))

Then make a custom function that when called on a heading returns the
first timestamp:

  (defun my/org-get-first-timestamp ()
(save-excursion
  (or (and (re-search-forward org-ts-regexp
  (save-excursion (outline-next-heading)
  (point))
  t)
   (match-string 1))
  "")))

(Org might already have a function that would do that, but that seems to
work.)

Now use that function in the agenda prefix for tag searches:

  (add-to-list 'org-agenda-prefix-format '(tags . 
"%-21(my/org-get-first-timestamp) "))

With the example you gave---but changing 2018-11-1 to 2018-11-01 to make
a valid timestamp---‘C-c a m client1’ gives me:

  Headlines with TAGS match: client1
  Press ‘C-u r’ to search again
  2018-10-28 Tuedescription of deadline 
 :client1:
  2018-11-01 Thu 10:00  a meeting   
 :client1:

-- 
Kyle



[O] agenda view help - viewing all time entries for a tag

2018-10-26 Thread Jeff Filipovits
Say I have a calendar file which is in the following format:

* description of deadline:client1:
DEADLINE: <2018-10-28 Tue>

* a meeting :client1:
<2018-11-1 Thu 10:00>

 I would like to be able to view all headlines and time entries associated
with a particular tag, and to have that information visible in an agenda
buffer, and for the entries to appear in chronological order along with the
associated dates

If I do C-c a m [tag], the dates do not appear

Seems the best I can do to get dates associated with the headline and
appear in chronological order is C-c a a, then filter by tag, then M-x
org-agenda-year-view. This is ugly and slow. Say I filter for :client1: and
put into year view, it looks something like:

Tuesday 30 October 2018
   Deadline: description of deadline :client1:
Wednesday 31 October 2018 *[unnecessary date with no entry -- why is this
here?]*
Thursday 1 November 2018
   10:00... a meeting :client1:

Is there something obvious I am missing? I just want something like the
above command, but without all of the dates shown that fall between time
entries. This way I can get a view of all deadlines associated with a
client, where those deadlines may exist months or even a year+ in advance
(i.e., I don't want to be limited to a year view).

Hope this makes sense. I am an orgmode newb. Was very excited at first but
the learning curve is really starting to hit me lately. It seems like this
should be relatively easy to accomplish.