Gregor Zattler <telegr...@gmx.net> writes: > Hi Noorul, org-mod users and developers, > * Noorul Islam K M <noo...@noorul.com> [13. Jul. 2013]: >> Gregor Zattler <telegr...@gmx.net> writes: >>> I customized my org-agenda-files variable to contain 4 files. >>> But I wished I could automatically add org files to the agenda >>> simply by opening them. Is it possible to automagically add >>> some files to the agenda iff they are visited or add the contents >>> of org-mode buffers? >> >> I am not sure whether you already went through contents of this link. >> >> http://orgmode.org/manual/Agenda-files.html > > Yes I read this part of the manual before posting my question. > > As I understand the manual, I have the possibility to customize a > static list of agenda files in org-agenda-files or to manually > add and remove org files from the agenda or restrict the agenda > manually. > I do not see how to *automatically* add open org-files to the > agenda? Perhaps I could do this with some hooks? > > Actually I think a static list of files which contribute to the > agenda is fine. > But I wished there was also the ability to define a list of files > which do only contribute to the agenda if already open > (preferably with some pattern matching, so one could customize > org to add any open org file to the agenda). > > Ciao, Gregor
You could certainly do this with a function attached to `find-file-hook'. In the function, check if (buffer-file-name) ends in ".org": if it does, then `org-agenda-file-to-front' and you're good to go.