emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-files variable
@ 2010-01-17 11:00 andrea
  2010-01-18  7:37 ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: andrea @ 2010-01-17 11:00 UTC (permalink / raw)
  To: emacs-orgmode


I've set up in before-hook a function to append to org-agenda-files
every org file.
Now the problem is that sometimes it adds the file in form
~/path and sometimes in form /Users/user/path
It's annoying because on different machines I have different homes.

What could be the reason?
I always visit those files in the "relative" way, so using the ~...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-agenda-files variable
  2010-01-17 11:00 org-agenda-files variable andrea
@ 2010-01-18  7:37 ` Carsten Dominik
  2010-01-18 10:46   ` andrea
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2010-01-18  7:37 UTC (permalink / raw)
  To: andrea; +Cc: emacs-orgmode

Hi Andrea,

On Jan 17, 2010, at 12:00 PM, andrea wrote:

>
> I've set up in before-hook a function to append to org-agenda-files
> every org file.
> Now the problem is that sometimes it adds the file in form
> ~/path and sometimes in form /Users/user/path
> It's annoying because on different machines I have different homes.
>
> What could be the reason?
> I always visit those files in the "relative" way, so using the ~...

This post is really incomplete, and it is impossible for anyone to give
a good answer - which means that everyone has to read my answer and then
your second attempt.  Things that could help are:

- What does your hook look like?
- There is no hook called `before-hook'
- Are you using a recent version of Org-mode?
- Are the "different machines" different operating systems?

Please, before you send an email to more than 700 people, stop
for a second and check if you have supplied all the information
that could possibly be useful.

Thanks.

- 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

- Carsten

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-agenda-files variable
  2010-01-18  7:37 ` Carsten Dominik
@ 2010-01-18 10:46   ` andrea
  2010-01-18 11:45     ` Stephan Schmitt
  2010-01-22  9:58     ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: andrea @ 2010-01-18 10:46 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Andrea,
>
> This post is really incomplete, and it is impossible for anyone to give
> a good answer - which means that everyone has to read my answer and then
> your second attempt.  Things that could help are:
>
> - What does your hook look like?
> - There is no hook called `before-hook'
> - Are you using a recent version of Org-mode?
> - Are the "different machines" different operating systems?
>
> Please, before you send an email to more than 700 people, stop
> for a second and check if you have supplied all the information
> that could possibly be useful.
>
> Thanks.
>
> - Carsten

I'm really sorry you're right, I should write a sort for this kind of
questions, I always forget important details...
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.

By the way when I open the agenda all the org-files are visited and I
end up with a lot of buffers, is that normal?

Thanks and sorry for the incomplete post

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: org-agenda-files variable
  2010-01-18 10:46   ` andrea
@ 2010-01-18 11:45     ` Stephan Schmitt
  2010-01-22  9:58     ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Stephan Schmitt @ 2010-01-18 11:45 UTC (permalink / raw)
  To: andrea; +Cc: Org Mode Mailing List

Hi Andrea,

Also sprach andrea:
> Carsten Dominik <carsten.dominik@gmail.com> writes:
> ...
>> - Carsten
> 
> I'm really sorry you're right, I should write a sort for this kind of
> questions, I always forget important details...
> 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 think the function 'abbreviate-file-name' can help you.  Find more
information about file names in this info node:

(Elisp) Top > Files > File Names


> 
> By the way when I open the agenda all the org-files are visited and I
> end up with a lot of buffers, is that normal?
> 
If you mean all the org files listed in 'org-agenda-files':
That's normal and necessary for all the possible interaction in the agenda
buffer.  But you can type 'x' in the agenda:

--8<---------------cut here---------------start------------->8---
x runs the command org-agenda-exit, which is an interactive compiled
Lisp function in `org-agenda.el'.

It is bound to x, <menu-bar> <Agenda> <Exit and Release Buffers>.

(org-agenda-exit)

Exit agenda by removing the window or the buffer.
Also kill all Org-mode buffers which have been loaded by `org-agenda'.
Org-mode buffers visited directly by the user will not be touched.
--8<---------------cut here---------------end--------------->8---

hth,
	Stephan

> Thanks and sorry for the incomplete post
> 
> 
> 
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: org-agenda-files variable
  2010-01-18 10:46   ` andrea
  2010-01-18 11:45     ` Stephan Schmitt
@ 2010-01-22  9:58     ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-01-22  9:58 UTC (permalink / raw)
  To: andrea; +Cc: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-22  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 11:00 org-agenda-files variable andrea
2010-01-18  7:37 ` Carsten Dominik
2010-01-18 10:46   ` andrea
2010-01-18 11:45     ` Stephan Schmitt
2010-01-22  9:58     ` Carsten Dominik

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