emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-goto-local-search-headings usage?


From: Nicolas Goaziou
Subject: Re: [O] org-goto-local-search-headings usage?
Date: Wed, 16 May 2012 16:56:45 +0200

Hello,

Myles English <address@hidden> 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



reply via email to

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