Orgzly-android: Make file:xxx relative to notebook and file:/xxx relative to card

Created on 16 Mar 2019  路  16Comments  路  Source: orgzly/orgzly-android

Please, for local repositories this is very important since it allows to keep a consistent structure both in your computer and in orgzly. I think file:/xxx should be relative to your sdcard but file:xxx should be relative to your repo. I can't figure out why this isn't like that.

feature

Most helpful comment

I changed my mind regarding file:xxx. Despite the fact that currently "relative to repo" and "relative to file" mean the same thing, since orgzly just sees a list of files under the repo path, room should be made in advance for behavior more closely aligned with org mode, because hopefully one day file:proj1/notes.org would be accessible and then relative file links in proj1/notes.org would have to be accessed relative to proj1 as in org mode. So I propose this behavior:

  • file:/xxx relative to sdcard
  • file:xxx relative to notebook, which currently is equivalent to relative to repo

All 16 comments

Implementing this feature will mostly solve the problem of notebooks nested in a hierarchy as discussed in https://github.com/orgzly/orgzly-android/issues/485.

I believe this feature is low cost and pays too much: by simply differentiating between file:/xxx and file:xxx you get:

  1. Consistency between the links in your computer and the links in orgzly.

  2. Consistency between the tree structure in your computer and the flattened structure in orgzly.

  3. Ability to access arbitrary notebooks in the hierarchy.

It's true that this still requires to manually create index files to access the content buried in the hierarchy, but it still is a far cry from not being able to access this content at all!!!

I changed my mind regarding file:xxx. Despite the fact that currently "relative to repo" and "relative to file" mean the same thing, since orgzly just sees a list of files under the repo path, room should be made in advance for behavior more closely aligned with org mode, because hopefully one day file:proj1/notes.org would be accessible and then relative file links in proj1/notes.org would have to be accessed relative to proj1 as in org mode. So I propose this behavior:

  • file:/xxx relative to sdcard
  • file:xxx relative to notebook, which currently is equivalent to relative to repo

file:/xxx relative to sdcard

There could be multiple "external" storages. For example the main emulated one, but also removable SD card at the same time. These all currently work (after 1a63a685bc987a3e7693ff216eac380ba60e689c):

file:file-on-main-storage.txt
file:/sdcard/file-on-main-storage.txt
file:/storage/emulated/0/file-on-main-storage.txt

file:/storage/0F18-3901/file-on-sd-card.txt

I think an option is needed to map / to whatever user wants it to be. Maybe the same with relative paths - some users might want file:xxx to be relative to SD card, not the repository (which might not even exist, or is remote).

Where would fit this syntax?
[[file-on-main-storage.txt]]

[[file-on-main-storage.txt]]

This is the same as file:file-on-main-storage.txt

It is necessary to allow to custom-map ~ (home directory) for compatibility with desktop Emacs, not only /

But I suggested it in the another issue

I have recordings in an apps directory on my phone. I share those with my computer with syncthing. If I could custom map ~ I would be able to map it to something like /directory/i/have/perms-to-symlink and then emulate my computer hierarchy there like:

+ /directory/i/have/perms-to-symlink
- voice-recordings -> /path/to-android-apps/recording-file-directory
- pictures -> /DCIM/path-to-camera-pictures

So, does anyone know how to write file links for using with both Emacs and Orgzly?

Hi, was this solved? I am trying to see the same images, in the same notes (path and images duplicated) in emacs and orgzly and I can't. It seems this could be called almost a bug.

@Ypot it is still not

workaround for notes dir: when creating note, type 2 different links, 1 for Emacs, 1 for Orgzly

for example:

[[sync-dir/picture.jpg]]
[[./picture.jpg]]

Orgzly shows you the first link image (located in /sdcard/sync-dir) while the Emacs uses relative path and shows you the second link image (located just here). Not pretty enough, but works with Syncthing

@vit1-irk could it be definitively solved using org-attach feature?
https://github.com/orgzly/orgzly-android/issues/1

@vit1-irk could it be definitively solved using org-attach feature?

1

@Ypot IDK, but it needs some hacks both for Orgzly and for Emacs to work properly
See this: https://emacs.stackexchange.com/questions/18404/can-i-display-org-mode-attachments-as-inline-images-in-my-document

I think this works, at least for files
file:/sync-dir/picture.txt - looks in /
file:picture.txt - looks in current directory

The things that doesn't work for me is links to heading inside the file, like file:my-notebook.org::*Heading1

The things that doesn't work for me is links to heading inside the file, like file:my-notebook.org::*Heading1

I would love to see this work like it does on desktop.

One possible workaround: Use a path that works in Orgzly: file:./Orgzly-Syncdir/Images/foo.jpg, that is, the path is relative to the sdcard. Here, Orgzly-Syncdir is the directory that contains the notebooks and is synced (e.g., with syncthing). Then, inside the synced directory Orgzly-Syncdir, add a symbolic link ln -s . Orgzly-Syncdir. Now, your desktop Emacs sees a relative path ./Orgzly-Syncdir/Images/foo.jpg too. But still it would be nice to see a proper solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ypot picture Ypot  路  5Comments

ghost picture ghost  路  4Comments

sudomain picture sudomain  路  3Comments

ghost picture ghost  路  4Comments

Emilv2 picture Emilv2  路  6Comments