emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Mikael Fornius <mfo@abc.se>
Cc: emacs-orgmode@gnu.org, zwz <zhangweize@gmail.com>
Subject: Re: Re: [feature request] use relative path in the file set by org-agenda-files
Date: Wed, 24 Mar 2010 13:00:09 +0100	[thread overview]
Message-ID: <4D4BCB95-CFF9-4FA1-B346-07B55F8CBA82@gmail.com> (raw)
In-Reply-To: <87sk7rnxe8.fsf@eee.lan>

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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

  reply	other threads:[~2010-03-24 20:07 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
2010-03-24 12:00   ` Carsten Dominik [this message]
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=4D4BCB95-CFF9-4FA1-B346-07B55F8CBA82@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mfo@abc.se \
    --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).