From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: Configure Helm Source from org-tags-view Date: Thu, 8 Aug 2019 15:23:19 -0500 Message-ID: References: <20190808191313.GW23122@protected.rcdrun.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003c3802058fa0d5c3" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:59277) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvown-0005Hb-L1 for emacs-orgmode@gnu.org; Thu, 08 Aug 2019 16:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvowm-0007Pu-2C for emacs-orgmode@gnu.org; Thu, 08 Aug 2019 16:23:41 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:41312) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hvowl-0007PN-TP for emacs-orgmode@gnu.org; Thu, 08 Aug 2019 16:23:40 -0400 Received: by mail-ot1-x32f.google.com with SMTP id o101so123866779ota.8 for ; Thu, 08 Aug 2019 13:23:39 -0700 (PDT) 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: Jean Louis Cc: emacs-orgmode --0000000000003c3802058fa0d5c3 Content-Type: text/plain; charset="UTF-8" Okay, I got this to work in org-babel in a file foo.org that has headlines like this: * Foo.org :bar: #+BEGIN_SRC emacs-lisp (org-scan-tags 'agenda ;; Action '(lambda (todo tags-list level) ;; Matcher (progn (setq org-cached-props nil) (member "bar" tags-list))) ;; End Matcher org--matcher-tags-todo-only) ;; Todo-only #+END_SRC I removed the "staff" from the beginning of the function call, and changed staff to "bar" I also removed the (or (and)) conditions :-) Now, I need to see how to make this function search all agenda files - it seems to work only on the headlines in Foo.org Thanks, --Nate On Thu, Aug 8, 2019 at 3:03 PM Nathan Neff wrote: > Hi Jean, > > Thank you - however, I can't get this function to return anything. > > org-scan-tags accepts an action, a matcher and a todo-only. > > Code: > > (org-scan-tags 'agenda ;; Action > '(staff lambda (todo tags-list level) ;; Matcher > (progn > (setq org-cached-props nil) > (or (and (member staff tags-list))))) > ;; End Matcher > org--matcher-tags-todo-only) ;; Todo-only > > * To my knowledge, the 'agenda is the action, and the list starting with > `(staff ) is the matcher. > * Why does the tag I'm searching for ("staff") appear as the first "atom" > in the > "matcher" parameter? Why isn't it just a lambda? > * I don't quite understand what the "or" and "and" are doing. It seems > like > I don't need either of them. > > My org-agenda-files contains files and I have a headline with the tag > "staff" > - no quotes, and the function's not returning anything. > > Thanks, > --Nate > > > On Thu, Aug 8, 2019 at 2:13 PM Jean Louis wrote: > >> * Nathan Neff [2019-08-08 18:50]: >> > Hello all, >> > >> > Has anyone created a Helm source from the results of org-agenda? >> > >> > Specifically org-tags-view I think would be a cool Helm source to >> > configure where the headings that have certain tags could be displayed >> > by Helm. >> > >> > I looked @ the code for org-tags-view and it's fairly straight >> > forward - however, I think that the function itself is tightly >> > coupled between finding the results and displaying the results. In >> > other words, there's no easy function that I see which would provide >> > headings that match a tags search that I could use as a Helm source. >> >> If tag is 'staff, this below will give structure out: >> >> (org-scan-tags 'agenda '(staff lambda (todo tags-list level) (progn >> (setq org-cached-props nil) (or (and (member staff tags-list))))) >> org--matcher-tags-todo-only) >> >> Now `org-scan-tags` could be inspected if it constructs some lists, >> alist, that are somewhat nicer than such output. >> >> But that output can be converted to HELM completion. >> >> Jean >> > --0000000000003c3802058fa0d5c3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Okay, I got this to work in org-babel in a file foo.org
that has headlines like this:

* Foo.org=C2=A0=C2=A0=C2=A0=C2=A0 :bar:
<= br>
#+BEGIN_SRC emacs-lisp

(org-scan-tags 'agen= da ;; Action
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 '(lambda (todo tags-list level) =C2=A0;; Matcher
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (setq org-cached-props nil)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (member "bar" tags-list))) ;; = End Matcher
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0org--matcher-tags-todo-only) ;; Todo-only
#+END_SRC

I removed the "staff" fro= m the beginning of the function call, and changed
staff to "= bar"=C2=A0 I also removed the (or (and)) conditions :-)
=
Now, I need to see how to make this function search all agen= da files - it seems
to work only on the headlines in Foo.org
<= /div>

Thanks,
--Nate

On Th= u, Aug 8, 2019 at 3:03 PM Nathan Neff <nathan.neff@gmail.com> wrote:
Hi Jean,

<= /div>
Thank you - however, I can't get this function to return anyt= hing.

org-scan-tags accepts an action, a matcher a= nd a todo-only.

Code:

(org-scan-tags 'agenda ;; Action
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '(staff lambda (todo tags-list level)=C2= =A0 ;; Matcher
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (progn
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq org-cached-props nil)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (or (and (member staff tags-list))))) ;; End= Matcher
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 org--matcher-tags-todo-only) ;; Todo-only

* To= my knowledge, the 'agenda is the action, and the list starting with
`(staff <snip>) is the matcher.=C2=A0
* Why do= es the tag I'm searching for ("staff") appear as the first &q= uot;atom" in the
"matcher" parameter?=C2=A0 W= hy isn't it just a lambda?
* I don't quite understand= what the "or" and "and" are doing.=C2=A0 It seems like=
I don't need either of them.

My org-agen= da-files contains files and I have a headline with the tag "staff"= ;
- no quotes, and the function's not returning anything.

Thanks,
--Nate


On Thu, Aug 8, 2019 at 2:13 PM Jean Louis <bugs@gnu.support> w= rote:
* Nathan N= eff <nathan.n= eff@gmail.com> [2019-08-08 18:50]:
> Hello all,
>
> Has anyone created a Helm source from the results of org-agenda?
>
> Specifically org-tags-view I think would be a cool Helm source to
> configure where the headings that have certain tags could be displayed=
> by Helm.
>
> I looked @ the code for org-tags-view and it's fairly straight
> forward - however, I think that the function itself is tightly
> coupled between finding the results and displaying the results.=C2=A0 = In
> other words, there's no easy function that I see which would provi= de
> headings that match a tags search that I could use as a Helm source.
If tag is 'staff, this below will give structure out:

(org-scan-tags 'agenda '(staff lambda (todo tags-list level) (progn=
(setq org-cached-props nil) (or (and (member staff tags-list)))))
org--matcher-tags-todo-only)

Now `org-scan-tags` could be inspected if it constructs some lists,
alist, that are somewhat nicer than such output.

But that output can be converted to HELM completion.

Jean
--0000000000003c3802058fa0d5c3--