From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Query for tags, and bring results into headline? Date: Mon, 16 May 2011 13:07:18 -0400 Message-ID: <87hb8uk20p.fsf@fastmail.fm> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:48795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM1GL-0007fP-Ue for emacs-orgmode@gnu.org; Mon, 16 May 2011 13:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QM1GK-0005p9-Uy for emacs-orgmode@gnu.org; Mon, 16 May 2011 13:07:21 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:48596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM1GK-0005ol-Sf for emacs-orgmode@gnu.org; Mon, 16 May 2011 13:07:20 -0400 In-Reply-To: (Nathan Neff's message of "Thu, 12 May 2011 09:29:33 -0500") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nathan Neff Cc: emacs-orgmode Nathan Neff writes: > I keep a lot of headlines tagged "question" that I > want to review before a daily meeting. > > Currently I keep questions tagged with "question", and can > easily do an agenda search for them. No problem. > > Before a daily meeting, I create a daily meeting headline > like this: > > * Daily Mtg 05/11/2011 > > Then, I do an agenda search for questions. > > What I'm looking for is a way to query for > headlines tagged "question", and bring the results of that query into > the Daily Mtg 05/11/2011 headline -- preferably with > links to the questions to easily jump to them. > > This way, I have a record that I asked certain questions, > and I can easily stay within my Daily Mtg headine, and not jump > to / from agenda and back to the daily mtg headline, which tends > to break my concentration. > > Essentially, it would be a clock report, with links, except > it would not need to filter by any time/clocking information. > > I just found that I can copy the results of the agenda > into my headline, and simply surround the headings with [[ and ]], which > turns them into links. This will work for the time being. > > I suspect that another answer is a dynamic block. Anyone > else doing something similar? Here's one implementation: --8<---------------cut here---------------start------------->8--- (defun org-dblock-write:insert-links (params) "Dblock function to insert links to headlines that match tags/properties search string specified by :match." (let ((match (plist-get params :match)) links) (unless match (error "Must specify :match parameter")) (org-map-entries (lambda () (let ((heading (nth 4 (org-heading-components)))) (add-to-list 'links (format "- [[file:%s::*%s][%s]]\n" (abbreviate-file-name (buffer-file-name)) heading heading)))) match 'agenda) (apply #'insert links))) --8<---------------cut here---------------end--------------->8--- You could then create a dblock by typing C-c C-c on the following #+begin: insert-links :match questions #+end: This would still need to be refined, as there are problems when a headline contains a link, but it's meant to provide a quick proof of concept. Best, Matt