unofficial mirror of emacs-orgmode@gnu.org
 help / color / mirror / Atom feed
* add linked files to agenda files
@ 2020-11-14  9:33 Alan Schmitt
  2020-11-16 21:33 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2020-11-14  9:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

Hello,

I'm experimenting with a setup where each project is its own org file,
and where I have a master file linking to active projects. How can I
configure org to add every linked file of that master file to the
org-agenda-files?

Thanks,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: add linked files to agenda files
  2020-11-14  9:33 add linked files to agenda files Alan Schmitt
@ 2020-11-16 21:33 ` Nick Dokos
  2020-11-17  7:52   ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2020-11-16 21:33 UTC (permalink / raw)
  To: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> I'm experimenting with a setup where each project is its own org file,
> and where I have a master file linking to active projects. How can I
> configure org to add every linked file of that master file to the
> org-agenda-files?
>

You'll probably have to write a custom function to do that, but it
depends on how exactly your master file is set-up, so providing some
details on that would help.

Just guessing at this point, I would imagine you'd want something like
this:

--8<---------------cut here---------------start------------->8---
(defun path-from-link (link)
   (org-element-property :path link))

(setq org-agenda-files (with-current-buffer
                         (find-file-noselect "master.org")
                         (org-element-map (org-element-parse-buffer)
                                          '(link)
                                          #'path-from-link)))
--8<---------------cut here---------------end--------------->8---

but the details might make a difference.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: add linked files to agenda files
  2020-11-16 21:33 ` Nick Dokos
@ 2020-11-17  7:52   ` Alan Schmitt
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Schmitt @ 2020-11-17  7:52 UTC (permalink / raw)
  To: Nick Dokos, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

Hello Nick,

On 2020-11-16 16:33, Nick Dokos <ndokos@gmail.com> writes:

> Just guessing at this point, I would imagine you'd want something like
> this:
>
> --8<---------------cut here---------------start------------->8---
> (defun path-from-link (link)
>    (org-element-property :path link))
>
> (setq org-agenda-files (with-current-buffer
>                          (find-file-noselect "master.org")
>                          (org-element-map (org-element-parse-buffer)
>                                           '(link)
>                                           #'path-from-link)))
> --8<---------------cut here---------------end--------------->8---

Thanks a lot, this is most useful! I did not think it could be this
simple.

Best,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-17  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-14  9:33 add linked files to agenda files Alan Schmitt
2020-11-16 21:33 ` Nick Dokos
2020-11-17  7:52   ` Alan Schmitt

unofficial mirror of emacs-orgmode@gnu.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git