From: Alexander Baier <alexander.baier@mailbox.org>
To: Herbert Sitz <hesitz@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Programmatically construct agenda from list of headline ids
Date: Fri, 29 Apr 2016 19:19:59 +0200 [thread overview]
Message-ID: <874makfi2o.fsf@mailbox.org> (raw)
In-Reply-To: <loom.20160426T175517-771@post.gmane.org> (Herbert Sitz's message of "Tue, 26 Apr 2016 16:16:52 +0000 (UTC)")
On 2016-04-26 16:16 Herbert Sitz wrote:
> Alexander Baier <alexander.baier <at> mailbox.org> writes:
>> As the title mentions I have a list of ids of existing org headlines and
>> want create an agenda view listing all of these headlines.
>>
>> Is there functionality in org-agenda, that allows me to do this?
>
> Nobody else has offered help yet, so I'll take a shot.
Thanks you! :)
> What exactly are your "ids"? Do you mean you have headlines with
> assigned CUSTOM_ID properties, and you have a list of values for which
> you want to show the headlines in agenda?
The ids I am talking about are generated by org-id. A list of these
might look as follows:
#+BEGIN_SRC emacs-lisp
'("55b95977-5e5b-4457-bb76-533499bc34e7"
"249d04f4-7352-488c-bf05-1b00578c414a"
"1833d6fc-46bf-4827-93a8-3f8c22310053"
"4d9c0cb1-fb10-4e28-a15b-63ae03169b39")
#+END_SRC
> If so, I think you could just assemble the list in a command that
> sticks new search conditions into one of your custom agenda views.
>
> E.g., if you currently had a custom agenda search mapped to "i" for
> two different CUSTOM_IDs, like this:
>
> (setq org-agenda-custom-commands
> '(("i" tags "CUSTOM_ID=323|CUSTOM_ID=832")))
>
> you could reissue command to get the search done for different list of
> custom ids:
>
> (setq org-agenda-custom-commands
> '(("i" tags "CUSTOM_ID=153|CUSTOM_ID=932|CUSTOM_ID=293")))
>
> I haven't tested this, but I expect it or something similar would
> work. There are probably tweaks you could make, e.g, list could be
> combined into a regular expression so you don't need to repeat
> multiple 'CUSTOM_ID=' sections.
I want to avoid using custom agendas. I aim to use the agenda view as a
method of presenting a list of tasks, not as a search based view
triggered manually by the user (as it is normally used). The closest
example of what I am trying to achieve is the behaviour achieved by
org-contacts (when searching for a contact), which uses the agenda view,
without "polluting" the custom-agenda-selection.
Although this is not the way I wanted to populate my agenda view, I
settled on the same approach used by org-contacts. I define a skip
function that only keeps headlines whose ID is a member of my list of
ids. Here is the code:
#+BEGIN_SRC emacs-lisp
(let ((org-agenda-skip-function
(lambda ()
(if (member (org-id-get (point)) list-of-ids)
nil
(outline-next-heading)))))
;; (org-todo-list) or similar calls
)
#+END_SRC
IIUC, this approach will scan each headline in all my agenda files only
to find those few (usually < 10) I already know how to retrieve, as I
have the relevant IDs. That is why I wanted to know whether I can just
pass those IDs to an agenda creation command which will then simply
render the corresponding headlines as an agenda view.
Kind regards,
--
Alexander Baier
prev parent reply other threads:[~2016-04-29 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-24 19:45 Programmatically construct agenda from list of headline ids Alexander Baier
2016-04-26 16:16 ` Herbert Sitz
2016-04-29 17:19 ` Alexander Baier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874makfi2o.fsf@mailbox.org \
--to=alexander.baier@mailbox.org \
--cc=emacs-orgmode@gnu.org \
--cc=hesitz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.