From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: agenda view help - viewing all time entries for a tag Date: Sat, 12 Jan 2019 18:19:55 -0500 Message-ID: <87bm4lwjj8.fsf@kyleam.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:54300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giSmx-00084l-TQ for emacs-orgmode@gnu.org; Sat, 12 Jan 2019 18:34:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1giSZO-00063m-E8 for emacs-orgmode@gnu.org; Sat, 12 Jan 2019 18:20:03 -0500 Received: from pb-smtp20.pobox.com ([173.228.157.52]:55396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1giSZN-00061L-Td for emacs-orgmode@gnu.org; Sat, 12 Jan 2019 18:20:02 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Jeff Filipovits , emacs-orgmode@gnu.org [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 t= he > associated dates > > [...] >=20 > It seems like this should be relatively easy to accomplish. Hmm, I might be missing something obvious, but here=E2=80=99s 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-ti= mestamp) ")) With the example you gave---but changing 2018-11-1 to 2018-11-01 to make a valid timestamp---=E2=80=98C-c a m client1=E2=80=99 gives me: Headlines with TAGS match: client1 Press =E2=80=98C-u r=E2=80=99 to search again 2018-10-28 Tue description of deadline = :client1: 2018-11-01 Thu 10:00 a meeting = :client1: --=20 Kyle