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