emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: [feature request] use relative path in the file set by


From: Carsten Dominik
Subject: Re: [Orgmode] Re: [feature request] use relative path in the file set by org-agenda-files
Date: Wed, 24 Mar 2010 13:00:09 +0100

Hi Mikael,

thanks for the patch, I have applied it.

It is incomplete in the following sense:  When I add another file
with `C-c [', the the expanded file names will be written back
to the file.  So maybe it would be useful to implement an inverse
operation in `org-store-new-agenda-file-list'.  I guess you cannot
get back environment variables because you don't know which
ones to use.  But getting back "~", and removing org-directory
might be nice.  Such a file could then be kept, for example
in the drop box and could work on different machines.

- Carsten

On Mar 23, 2010, at 11:30 AM, Mikael Fornius wrote:


I have made a small patch implementing the following behavior:

With org-agenda-files = "/home/mfo/org/agenda", a filename.

| Line in agenda-file    | Expands to:                  |
|------------------------+------------------------------|
| $HOME/org/org-mode.org | "/home/mfo/org/org-mode.org" |
| td/td.org              | "/home/mfo/org/td/td.org"    |
| ~/org/test.org         | "/home/mfo/org/test.org"     |
| scratch.org            | "/home/mfo/org/scratch.org"  |
| /home/mfo/org/wep.org  | "/home/mfo/org/wep.org"      |
| ../te.org              | "/home/mfo/te.org"           |
|------------------------+------------------------------|

Here is the patch to current git-head:

diff --git a/lisp/org.el b/lisp/org.el
index 84bec4c..dad9293 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14672,8 +14672,10 @@ the buffer and restores the previous window configuration."
  (when (stringp org-agenda-files)
    (with-temp-buffer
      (insert-file-contents org-agenda-files)
- (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r \n]*"))))
-
+      (mapcar (lambda (f)
+               (expand-file-name (substitute-in-file-name f)
+                                 (file-name-directory org-agenda-files)))
+ (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r \n]*")))))

;;;###autoload
(defun org-cycle-agenda-files ()

--
Mikael Fornius
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten







reply via email to

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