emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-store-link-functions advertizes that the first non-nil return value is used, but it is not how org-store-link handles it
Date: Tue, 27 Sep 2022 18:39:40 +0700	[thread overview]
Message-ID: <tgundt$g7d$1@ciao.gmane.io> (raw)
In-Reply-To: <87tu4tppb6.fsf@localhost>

On 27/09/2022 08:40, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> There is the `org-store-link-plist' variable used by :store functions
>> from `org-link-parameters' but not by the
>> `org-create-file-search-functions' hook. Maybe it is enough to add
> 
> Reading through `org-store-link-functions' docstring and
> `org-store-link' code, I noticed that `org-store-link-functions'
> promises the following:
...
> That is, all the store link functions are actually being executed, not
> until first non-nil return value. If multiple non-nil values are
> returned, an interactive query is displayed to the user.
> 
> The actual behaviour is indeed nice, but I am wondering how it is going
> to work in non-interactive case.

There are more inconsistencies. For a heading in an Org file 2 links may 
be created: title search and #custom_id. Only one link is removed by 
`org-insert-link'. Only one of them is checked if it has been stored 
earlier. Usually after several store+insert actions I have a list of 
stored links that I will never use. I am unsure what is better, to 
prompt user when link is saved, or store all options with some group ID 
and remain other links when one item from the group is inserted.

I suppose, `org-store-link' should be split into smaller building blocks 
to allow experiments with alternative implementations and strategies to 
select from several variants.

I was wrong suggestion that changing of :store property of "file" links 
may be a workaround for original issue. It is easy to store line number 
instead of search text, but there are a lot of code to detect headings, 
#custom_id, <<target>>, etc. for "file" links and this code can not be 
easily reused.




  reply	other threads:[~2022-09-27 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 17:40 [BUG] org-create-file-search-functions and description [9.5.5 (release_9.5.5 @ /usr/share/emacs/29.0.50/lisp/org/)] Magnus Therning
2022-09-26 12:12 ` Ihor Radchenko
2022-09-26 12:15   ` Magnus Therning
2022-09-26 15:13   ` Max Nikulin
2022-09-27  1:35     ` Ihor Radchenko
2022-09-27  1:40     ` [BUG] org-store-link-functions advertizes that the first non-nil return value is used, but it is not how org-store-link handles it (was: [BUG] org-create-file-search-functions and description [9.5.5 (release_9.5.5 @ /usr/share/emacs/29.0.50/lisp/org/)]) Ihor Radchenko
2022-09-27 11:39       ` Max Nikulin [this message]
2022-09-28  1:03         ` [BUG] org-store-link-functions advertizes that the first non-nil return value is used, but it is not how org-store-link handles it Ihor Radchenko

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='tgundt$g7d$1@ciao.gmane.io' \
    --to=manikulin@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).