[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG] org-store-link-functions advertizes that the first non-nil return
From: |
Ihor Radchenko |
Subject: |
[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/)]) |
Date: |
Tue, 27 Sep 2022 09:40:45 +0800 |
Max Nikulin <manikulin@gmail.com> 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:
Each function will be called in turn until one returns a non-nil
value.
Yet, `org-store-link' does the following:
(dolist (f (org-store-link-functions))
(when (funcall f)
(push (cons f (copy-sequence org-store-link-plist))
results-alist)))
(pcase results-alist
...
;; Reinstate link plist associated to the chosen
;; function.
(apply #'org-link-store-props
(cdr (assoc-string
(completing-read
(format "Store link with (default %s): " name)
(mapcar #'car results-alist)
nil t nil nil (symbol-name name))
results-alist)))
t))
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.
Thoughts?
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
- [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/25
- Re: [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/26
- Re: [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
- Re: [BUG] org-create-file-search-functions and description [9.5.5 (release_9.5.5 @ /usr/share/emacs/29.0.50/lisp/org/)], Max Nikulin, 2022/09/26
- Re: [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/26
- [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 <=
- 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, Max Nikulin, 2022/09/27
- 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, Ihor Radchenko, 2022/09/27