emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mikael Fornius <mfo@abc.se>
To: zwz <zhangweize@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [feature request] use relative path in the file set by org-agenda-files
Date: Tue, 23 Mar 2010 11:30:07 +0100	[thread overview]
Message-ID: <87sk7rnxe8.fsf@eee.lan> (raw)
In-Reply-To: <loom.20100323T081822-474@post.gmane.org> (zwz's message of "Tue, 23 Mar 2010 07:32:59 +0000 (UTC)")

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]


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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-read-agenda-file-list --]
[-- Type: text/x-patch, Size: 626 bytes --]

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 ()

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


-- 
Mikael Fornius

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

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

  reply	other threads:[~2010-03-23 10:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23  7:32 [feature request] use relative path in the file set by org-agenda-files zwz
2010-03-23 10:30 ` Mikael Fornius [this message]
2010-03-24 12:00   ` Carsten Dominik
2010-03-25 11:01     ` Mikael Fornius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sk7rnxe8.fsf@eee.lan \
    --to=mfo@abc.se \
    --cc=emacs-orgmode@gnu.org \
    --cc=zhangweize@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).