[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [POLL] Change calling convention for when `org-link-file-path-type'
From: |
Christopher M. Miles |
Subject: |
Re: [POLL] Change calling convention for when `org-link-file-path-type' is set to custom function (was: Enhancement Proposal for 'org-link-file-path-type' Behavior) |
Date: |
Wed, 17 Jan 2024 12:59:34 +0800 |
User-agent: |
mu4e 1.11.6; emacs 30.0.50 |
+1 for this propose.
I have one situation need this feature.
Assume a file structure like bellowing:
#+begin_example
`- folder-1
`- file-1.org
`- folder-1.2
` file-1.2.1.org
#+end_example
When I try to add link of "file-1.org" in "file-1.2.1.org", based on my
custom option `org-link-file-path-type' value `adaptive'. The link will
become a full-path link. But I want link to be relative to current Org
file path. The file link path should be [[file:../file-1.org]] instead
of [[file:folder-1/file-1.org]]. I hope I can use a custom function in
conditions to decide the file path.
Ihor Radchenko <yantar92@posteo.net> writes:
> 西 顾 <z.ref@outlook.com> writes:
>
>> I'd like to suggest a small enhancement to the
>> 'org-link-file-path-type' option. When set to 'function', it currently
>> passes an absolute path to the user's custom function. This limits
>> flexibility as the original path input is not available to the
>> function.
>>
>> For better customization, I propose passing the raw path to the
>> function. Users needing an absolute path could use 'expand-file-name'
>> within their function.
>
> Thanks for the suggestion!
>
> This makes sense - the current approach with passing absolute path is
> indeed limiting the information passed to the custom function.
>
> The docstring is also quite ambiguous about what is passed as an
> argument:
>
> org-link-file-path-type is a customizable variable defined in ol.el.
> <...>
> Alternatively, users may supply a custom function that takes the
> full filename as an argument and returns the path.
>
> "full filename" may or may not mean "absolute filename".
>
> However, changing the absolute path to "as is" path will technically be
> breaking.
>
> I cannot find any actual uses of custom function value for
> `org-link-file-path-type' in the wild, so I am leaning towards going
> ahead with this (minor) breaking change.
>
> Yet, I am starting a poll to give users who may be affected a chance to
> chime in.
--
[ stardiviner ]
I try to make every word tell the meaning that I want to express without
misunderstanding.
Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
signature.asc
Description: PGP signature