Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-09 Thread Ihor Radchenko
Ihor Radchenko  writes:

> After second thought, I am not sure anymore if using XDG is a good idea.
> Emacs itself only recently started supporting XDG and the support is
> somewhat limited. Similar to the described case with non-existing .cache
> directory, Emacs ignores non-existing .config/emacs folder for init.el.
> Emacs never creates .config directory.

Some more data:

xdg.el is not (yet?) supported by Aquamacs [1]. While we do not
officially support Aquamacs, it is probably best to avoid xdg.el if we
can.

Also, there is an ongoing discussion at emacs-devel about Emacs support
for XDG specs and similar [2]. If the new user-directory library gets
merged to Emacs, it may be the way to go (with proper back-compatibility
aliases).

[1] 
https://list.orgmode.org/cafqubhf+wpuneeapkcg94wjhfcrxvsf+j-7ut3b_romfkqc...@mail.gmail.com/T/#m99c63439a745c07fd7c30cde0b49b3d5bd1757f0
[2] https://lists.gnu.org/archive/html/emacs-devel/2021-11/msg00469.html

Best,
Ihor



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-05 Thread Tim Cross


Ihor Radchenko  writes:

> Kaushal Modi  writes:
>
>> Figured out the problem.. looks like Org main branch doesn't support emacs
>> 25.
>>
>> My build script was building Org for all emacs versions starting from
>> version 25. It builds fine if remove the build  for emacs 25. I think I
>> missed it somewhere that Org main branch is dropping emacs 25 support.
>
> I am not sure if we are dropping Emacs 25 just yet. However, there is
> currently more than one place in Org that does not work on Emacs 25.
> See https://list.orgmode.org/87zgqu6081.fsf@localhost/T/#t
>
> If compilation is critical for you, I can make a patch to make things
> compile in Emacs 25. Though compatibility layer for xdg is more tricky.
> I do not want to do it unless necessary.
>

If we assume this version will not be released until Emacs 28 is
released, then I don't think emacs 25.x compatibility is required.
However, if these changes are to be incorporated into a release prior to
the release of Emacs 28, support for version 25.x would be required.

While release candidates for Emacs 28 have been released, I'm not sure
version 28 will be out this year. I would expect it will be released in
the next 6 - 12 months.

I would assume emacs 28 to include the released
9.5 (plus bug fixes) version and these changes to be in the 9.6 version?



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-05 Thread Kaushal Modi
On Fri, Nov 5, 2021, 9:48 AM Ihor Radchenko  wrote:

>
> I am not sure if we are dropping Emacs 25 just yet. However, there is
> currently more than one place in Org that does not work on Emacs 25.
> See https://list.orgmode.org/87zgqu6081.fsf@localhost/T/#t
>
> If compilation is critical for you, I can make a patch to make things
> compile in Emacs 25. Though compatibility layer for xdg is more tricky.
> I do not want to do it unless necessary.
>

I haven't switched back to emacs 25 in a while. It's just that the script I
had for building Org started failing. All's good after removing the build
step for emacs 25.

I am anyways on emacs/master and then emacs-28 for a while now. So I
personally don't need emacs 25 compatibility. But in any case, this
breakage on emacs 25 should be fixed or the min req bumped to emacs 26.

>


Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-05 Thread Ihor Radchenko
Kaushal Modi  writes:

> Figured out the problem.. looks like Org main branch doesn't support emacs
> 25.
>
> My build script was building Org for all emacs versions starting from
> version 25. It builds fine if remove the build  for emacs 25. I think I
> missed it somewhere that Org main branch is dropping emacs 25 support.

I am not sure if we are dropping Emacs 25 just yet. However, there is
currently more than one place in Org that does not work on Emacs 25.
See https://list.orgmode.org/87zgqu6081.fsf@localhost/T/#t

If compilation is critical for you, I can make a patch to make things
compile in Emacs 25. Though compatibility layer for xdg is more tricky.
I do not want to do it unless necessary.

Best,
Ihor



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-05 Thread Kaushal Modi
On Fri, Nov 5, 2021 at 9:27 AM Kaushal Modi  wrote:

> Hello,
>
> On the topic of xdg, I pulled Org from main branch today and tried to
> build it but it's failing with:
>
> org-persist.el:32:1:Error: Cannot open load file: No such file or
> directory, xdg
>
> Anybody else seeing this?
>

Figured out the problem.. looks like Org main branch doesn't support emacs
25.

My build script was building Org for all emacs versions starting from
version 25. It builds fine if remove the build  for emacs 25. I think I
missed it somewhere that Org main branch is dropping emacs 25 support.


Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-05 Thread Kaushal Modi
On Fri, Nov 5, 2021 at 9:27 AM Kaushal Modi  wrote:

> Hello,
>
> On the topic of xdg, I pulled Org from main branch today and tried to
> build it but it's failing with:
>
> org-persist.el:32:1:Error: Cannot open load file: No such file or
> directory, xdg
>
> Anybody else seeing this?
>

To add more context, I am on emacs-28 branch right now.


Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-05 Thread Kaushal Modi
Hello,

On the topic of xdg, I pulled Org from main branch today and tried to build
it but it's failing with:

org-persist.el:32:1:Error: Cannot open load file: No such file or
directory, xdg

Anybody else seeing this?


Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-03 Thread Max Nikulin

On 02/11/2021 17:55, Ihor Radchenko wrote:

Max Nikulin writes:


Ihor, your fix affects linux as well. .cache directory may be missed in
fresh accounts. E.g. I just have created a new test container (my old
one has emacs-25):


After second thought, I am not sure anymore if using XDG is a good idea.
Emacs itself only recently started supporting XDG and the support is
somewhat limited. Similar to the described case with non-existing .cache
directory, Emacs ignores non-existing .config/emacs folder for init.el.
Emacs never creates .config directory.

...

4. Same as 3, but create $XDG_CACHE_DIR if possible. It is similar to
other XDG-complient software (at least, that's what I saw in
qutebrowser code).


I like the idea to put temporary automatically created files to a 
dedicated directory. Backups are easier when hand-written config files 
are separated from stuff that can be recreated on demand. Since enough 
applications follow XDG conventions, I suppose, XDG_CACHE_HOME=~/.cache 
is a reasonable variant consistent with user expectations. Emacs 
directory may be a fallback when XDG_CACHE_HOME can not be created. I am 
against using ~/.cache only if it already exists. It may result in stale 
cache in the emacs directory populated before another application 
created ~/.cache, so user would have 2 directories with cache files.


I agree that xdg.el lacks some useful features. Even parts of emacs such 
as startup.el and files.el do not use this package. Similar libraries 
for other programming languages offer wider support of OSes and create 
directories on demand, e.g. https://github.com/adrg/xdg for Go.


Maybe org-macs.el is a better place for code dealing initialization of 
cache directory.



P.S. `org-open-file' may benefit from using of xdg.el. MIME handlers 
obtained from .desktop files should be more consistent with expectations 
of users of desktop environments.





Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-02 Thread Tim Cross


Ihor Radchenko  writes:

> Max Nikulin  writes:
>
>> Ihor, your fix affects linux as well. .cache directory may be missed in 
>> fresh accounts. E.g. I just have created a new test container (my old 
>> one has emacs-25):
>
> After second thought, I am not sure anymore if using XDG is a good idea.
> Emacs itself only recently started supporting XDG and the support is
> somewhat limited. Similar to the described case with non-existing .cache
> directory, Emacs ignores non-existing .config/emacs folder for init.el.
> Emacs never creates .config directory.
>
> So, I can see several options for Org:
> 1. Just move to back usual usage of user-emacs-directory and store the
>cache there
> 2. Use the same approach with Emacs: if $XDG_CACHE_DIR/org-persist
>exists and user-emacs-directory/org-persist does not, use the XDG
>dir. Otherwise fall back to user-emacs-directory
> 3. Same as 2, but only require existing $XDG_CACHE_DIR and create
>$XDG_CACHE_DIR/org-persist dir if possible.
> 4. Same as 3, but create $XDG_CACHE_DIR if possible. It is similar to
>other XDG-complient software (at least, that's what I saw in
>qutebrowser code).
>

I think the key is to be consistent with user expectations. If the
user's init.el is under XDG layout, then use that, otherwise use
user-emacs-dir. This is slightly different to your No. 2, as I suspect
in the first run of org, it could be possible that init.el is under XDG
layout, but there is no org-persist yet.

Most important requirement would be that the location is a custom
variable, allowing easy customisation for those who want to set it
explicitly.



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-02 Thread Ihor Radchenko
Max Nikulin  writes:

> Ihor, your fix affects linux as well. .cache directory may be missed in 
> fresh accounts. E.g. I just have created a new test container (my old 
> one has emacs-25):

After second thought, I am not sure anymore if using XDG is a good idea.
Emacs itself only recently started supporting XDG and the support is
somewhat limited. Similar to the described case with non-existing .cache
directory, Emacs ignores non-existing .config/emacs folder for init.el.
Emacs never creates .config directory.

So, I can see several options for Org:
1. Just move to back usual usage of user-emacs-directory and store the
   cache there
2. Use the same approach with Emacs: if $XDG_CACHE_DIR/org-persist
   exists and user-emacs-directory/org-persist does not, use the XDG
   dir. Otherwise fall back to user-emacs-directory
3. Same as 2, but only require existing $XDG_CACHE_DIR and create
   $XDG_CACHE_DIR/org-persist dir if possible.
4. Same as 3, but create $XDG_CACHE_DIR if possible. It is similar to
   other XDG-complient software (at least, that's what I saw in
   qutebrowser code).

WDYT?

Best,
Ihor



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-01 Thread Ihor Radchenko


> Emacs core rather than fixing this scenario on Emacs side.
*Org side



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-01 Thread Ihor Radchenko
Max Nikulin  writes:

> Ihor, your fix affects linux as well. .cache directory may be missed in 
> fresh accounts. E.g. I just have created a new test container (my old 
> one has emacs-25):

You are right. Though creating .cache dir is probably a job for xdg.el,
not Org. XDG spec prescribes specific permissions for the XDG
directories. I would prefer to send a bug report/feature request to
Emacs core rather than fixing this scenario on Emacs side.

Best,
Ihor



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-01 Thread Max Nikulin

On 01/11/2021 18:29, Ihor Radchenko wrote:

Scott Otterson writes:


Apparently, org version 9.5 expects the directory "~/.cache" to exist, and
if it doesn't, it terminates with an error.  I'd suggest that org mode
makes this directory if it needs it.


Thanks for reporting! Fixed in 6621ee32e.


Ihor, your fix affects linux as well. .cache directory may be missed in 
fresh accounts. E.g. I just have created a new test container (my old 
one has emacs-25):


emacs --batch -L org-mode/lisp/ -l org-persist  --eval '(message 
"%s\n%s" org-persist-directory (org-version nil t))'


Loading /etc/emacs/site-start.d/00debian.el (source)...
/home/ubuntu/.emacs.d/org-persist/
Org mode version 9.5 (release_9.5-194-g7a6f48 @ /home/ubuntu/org-mode/lisp/)

P.S. ~/.cache directory should not be world-readable, so likely it is 
required to change umask or to explicitly specify permissions while 
creating it.





Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Ihor Radchenko
Scott Otterson  writes:

> Apparently, org version 9.5 expects the directory "~/.cache" to exist, and
> if it doesn't, it terminates with an error.  I'd suggest that org mode
> makes this directory if it needs it.

Thanks for reporting! Fixed in 6621ee32e.

Best,
Ihor