emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: org-agenda-files variable


From: Carsten Dominik
Subject: Re: [Orgmode] Re: org-agenda-files variable
Date: Fri, 22 Jan 2010 10:58:21 +0100


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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]