From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: org-agenda-files variable Date: Fri, 22 Jan 2010 10:58:21 +0100 Message-ID: <5AF2BB96-E765-44EB-9048-ED0AB7BDE37C@gmail.com> References: <447E3ED5-4D17-449C-A3C9-1F17E50DF4CF@gmail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NYGHh-0001RB-Ux for emacs-orgmode@gnu.org; Fri, 22 Jan 2010 04:58:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NYGHc-0001Qi-OT for emacs-orgmode@gnu.org; Fri, 22 Jan 2010 04:58:33 -0500 Received: from [199.232.76.173] (port=39092 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NYGHc-0001Qa-GF for emacs-orgmode@gnu.org; Fri, 22 Jan 2010 04:58:28 -0500 Received: from fg-out-1718.google.com ([72.14.220.157]:5927) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NYGHb-0003hD-Vj for emacs-orgmode@gnu.org; Fri, 22 Jan 2010 04:58:28 -0500 Received: by fg-out-1718.google.com with SMTP id 22so971301fge.12 for ; Fri, 22 Jan 2010 01:58:24 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: andrea Cc: emacs-orgmode@gnu.org On Jan 18, 2010, at 11:46 AM, andrea wrote: > Anyway > > emacs-version: "23.1.50.1" > org-version: "6.33trans" > > > The code for the hook is this > > --8<---------------cut here---------------start------------->8--- > (defun org-add-eventually() > "Adding a file to org-agenda when saved" > (interactive) > (if (string= major-mode "org-mode") > (org-agenda-file-to-front))) > > (add-hook 'before-save-hook 'org-add-eventually) > --8<---------------cut here---------------end--------------->8--- > > And finally I have different operating systems, linux on the other > machine and osx 10.6 on this one. > > I'm not sure when the filename gets added in the "wrong format", but > maybe it's my fault, I visit the absolute path. > Anyway if I can force somehow to only use relative to home paths in > emacs somehow it would be also fine. I have looked in the code, and I have trouble to see how file names would get into the list unabbreviated. The code explicitly abbreviates (i.e. inserts "~" for the HOME directory) for all new files. Even if you have visited the file with an absolute path. The only thing I can imagine is that you have, at some point, filled the variable in a direct way, for example using wildcard expansion like described in http://orgmode.org/worg/org-faq.php#set-agenda-files-using-wildcards This would insert absolute file names into the list, and once they are in there, they will not be replaced with relative ones. One way to clean up would be to remove all files from the list and start over, only adding them with your hook function. Another way would be to evaluate (i.e. put the cursor behind it and press `C-x C-e') the following form in the scratch buffer (org-store-new-agenda-file-list (mapcar 'abbreviate-file-name org-agenda-files)) Hope this helps - Carsten