emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Noorul Islam <noorul@noorul.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org, Bastien <bastien.guerry@wikimedia.fr>
Subject: Re: [PATCH] question about org-agenda-files
Date: Fri, 6 Aug 2010 19:44:43 +0530	[thread overview]
Message-ID: <AANLkTikjtzB+Cip_F1VOj1CustsUtCTcS5gNtKqjZ12m@mail.gmail.com> (raw)
In-Reply-To: <4CB19CCB-1A75-41BF-8835-F839AA578624@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1441 bytes --]

On Fri, Aug 6, 2010 at 4:12 PM, Carsten Dominik
<carsten.dominik@gmail.com>wrote:

>
> On Aug 6, 2010, at 10:30 AM, Bastien wrote:
>
>  Rustom Mody <rustompmody@gmail.com> writes:
>>
>>  Why is it that if org-agenda-files is a list the list should have
>>> absolute file names whereas when it (points to) a single file
>>> containing the names those names are allowed to be relative to
>>> org-directory?
>>>
>>
>> I guess this is a small historical contingency.  We might indeed allow
>> relative filenames when `org-agenda-files' is a list.
>>
>
> I agree and would welcome a patch for this.
>
>
Changing this behavior is going to be a significant one as far as the
current users are concerned. I started working towards a patch for this and
now I am thinking how not to break existing functionality. Or should we
force everyone to be relative to org-directory?

Here is the simple patch which straight away expands the file names with
org-directory.

* org.el:
  + org-expand-file-list ()
     Expand the list of agenda files in "org-agenda-files" with
"org-directory" as base directory.
  + org-agenda-files ()
     Call org-expand-file-list() if "org-agenda-files" is a list.

Thanks and Regards
Noorul


> - Carsten
>
>
>
> _______________________________________________
> 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
>

[-- Attachment #1.2: Type: text/html, Size: 2631 bytes --]

[-- Attachment #2: org-agenda-files.txt --]
[-- Type: text/plain, Size: 1110 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 19b28a3..532da83 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15379,7 +15379,7 @@ used by the agenda files.  If ARCHIVE is `ifmode', do this only if
 	 (cond
 	  ((and (not unrestricted) (get 'org-agenda-files 'org-restrict)))
 	  ((stringp org-agenda-files) (org-read-agenda-file-list))
-	  ((listp org-agenda-files) org-agenda-files)
+	  ((listp org-agenda-files) (org-expand-file-list))
 	  (t (error "Invalid value of `org-agenda-files'")))))
     (setq files (apply 'append
 		       (mapcar (lambda (f)
@@ -15468,6 +15468,16 @@ un-expanded file names."
 	     e)))
        (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))))
 
+(defun org-expand-file-list ()
+  "Expand the list of agenda files in `org-agenda-files' with 
+`org-directory' as base directory."
+  (when (listp org-agenda-files)
+    (mapcar
+     (lambda (f)
+       (let ((e (expand-file-name 
+		 (substitute-in-file-name f) org-directory)))
+	 e)) org-agenda-files)))
+
 ;;;###autoload
 (defun org-cycle-agenda-files ()
   "Cycle through the files in `org-agenda-files'.

[-- Attachment #3: 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-08-06 14:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-01 17:50 question about org-agenda-files Rustom Mody
2010-08-06  8:30 ` Bastien
2010-08-06 10:42   ` Carsten Dominik
2010-08-06 14:14     ` Noorul Islam [this message]
2010-08-07  6:18       ` [PATCH] " Carsten Dominik

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=AANLkTikjtzB+Cip_F1VOj1CustsUtCTcS5gNtKqjZ12m@mail.gmail.com \
    --to=noorul@noorul.com \
    --cc=bastien.guerry@wikimedia.fr \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).