From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: collect info from org files in agenda when open? Date: Sat, 13 Jul 2013 23:09:49 +0800 Message-ID: <878v1aa43m.fsf@ericabrahamsen.net> References: <20130712221620.GC15939@boo.workgroup> <87ppumnan8.fsf@noman.maa.corp.collab.net> <20130713083315.GA20339@boo.workgroup> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy1S0-0001gu-Ap for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 11:09:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy1Rz-0001pZ-0Z for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 11:09:32 -0400 Received: from plane.gmane.org ([80.91.229.3]:34750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy1Ry-0001pR-R6 for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 11:09:30 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uy1Rw-0007XJ-Es for emacs-orgmode@gnu.org; Sat, 13 Jul 2013 17:09:28 +0200 Received: from 50.56.99.223 ([50.56.99.223]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 13 Jul 2013 17:09:28 +0200 Received: from eric by 50.56.99.223 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 13 Jul 2013 17:09:28 +0200 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Gregor Zattler writes: > Hi Noorul, org-mod users and developers, > * Noorul Islam K M [13. Jul. 2013]: >> Gregor Zattler 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.