From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-goto-local-search-headings usage? Date: Wed, 16 May 2012 16:56:45 +0200 Message-ID: <87txzgjhsi.fsf@gmail.com> References: <87obpp31ln.fsf@ed.ac.uk> <4409.1337096935@alphaville> <87havhp2w9.fsf@gmail.com> <8801.1337117593@alphaville> <8896.1337118269@alphaville> <877gwcl8oe.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUfha-0003wa-U3 for emacs-orgmode@gnu.org; Wed, 16 May 2012 10:59:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUfhU-0004PO-Lz for emacs-orgmode@gnu.org; Wed, 16 May 2012 10:59:46 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:49857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUfhU-0004Of-D3 for emacs-orgmode@gnu.org; Wed, 16 May 2012 10:59:40 -0400 Received: by wibhm14 with SMTP id hm14so626638wib.12 for ; Wed, 16 May 2012 07:59:38 -0700 (PDT) In-Reply-To: <877gwcl8oe.fsf@gmail.com> (Myles English's message of "Wed, 16 May 2012 11:30:41 +0100") 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: emacs-orgmode Mode Cc: Myles English , nicholas.dokos@hp.com Hello, Myles English writes: > Thanks for the advice, I ended up using bit of org-element.el instead of > org-goto-local-search-headings and doing this: > > #+BEGIN_SRC elisp > (defun gotoWF(hl) > (let ((title (car (org-element-property :title hl)))) > (if (and (stringp title) > (string= title "My workflow")) > (progn (goto-char (org-element-property :begin hl)) > (org-show-entry) > (org-show-subtree)) > nil))) > > (require 'org-element) > (defun gtd() > (interactive) > (org-element-map (org-element-parse-buffer) 'headline 'gotoWF nil t) > (org-agenda-list)) > #+END_SRC I highly suggest to use (org-element-parse-buffer 'headline) instead of plain (org-element-parse-buffer), since you really don't need to spend time parsing the buffer down to the smallest object. Also, you should check :raw-value property instead of :title, since the latter is a secondary string (a list containing strings and objects) which, as such, will never match a string. :raw-value, on the other hand, is always a string and doesn't require the (stringp title) test. Regards, -- Nicolas Goaziou