emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH v2] Re: Adding target and custom id links doesn't ask for description
Date: Sun, 11 Sep 2022 20:18:06 +0700	[thread overview]
Message-ID: <tfkn6f$v94$1@ciao.gmane.io> (raw)
In-Reply-To: <tdagnf$1012$1@ciao.gmane.io>

On 14/08/2022 16:53, Max Nikulin wrote:
> On 13/08/2022 12:01, Ihor Radchenko wrote:
>> See the updated version of the patch attached. It works on my side.
>> --- a/lisp/ol.el
>> +++ b/lisp/ol.el
>> @@ -1577,10 +1577,8 @@ (defun org-store-link (arg &optional interactive?)
>>            t))))
>>      (setq link (plist-get org-store-link-plist :link))
>>          ;; If store function actually set `:description' property, use
>> -        ;; it, even if it is nil.  Otherwise, fallback to link value.
>> -    (setq desc (if (plist-member org-store-link-plist :description)
>> -                       (plist-get org-store-link-plist :description)
>> -             link)))
>> +        ;; it, even if it is nil.  Otherwise, fallback to nil (ask 
>> user).
>> +    (setq desc (plist-get org-store-link-plist :description)))
> I can not say that I understand design of `org-store-link` and 
> `org-insert-link' pair, but I suspect that you might try to fix the 
> issue in a wrong place.
> It seems the same :link and :description value were set for purpose, see 
> `org-insert-link' code:
>          (dolist (l org-stored-links)
>            (when (equal link (cadr l))
>          (setq link (car l))
>          (setq auto-desc t)))

Ihor, I beg you pardon. I was wrong writing that you are trying to fix 
the issue in a wrong place. I figured out that the purpose of this 
snippet is completion by link description, not detecting of the case of 
identical link target and description. You have just committed the patch 
from the following thread where I provided more details:
Max Nikulin. ido, org-insert-link, and completion based on link 
description. Tue, 6 Sep 2022 21:34:12 +0700. 

Now I believe that your change is an improvement. I do not see any real 
reason to store the same description as the target. 
"~/Desktop/Org/captures.org::target" for <<target>> as default value of 
the description prompt might be a hint to the user for which link their 
should write description, but I hope, there is a better way to do the 
same. I have seen a mention that some export backend may create perhaps 
invisible links if description is omitted, but if it is still an issue, 
it should be fixed in affected backends.

Unfortunately, your patch does not fix the real issue. The title (not 
nil) should be saved for link description when the heading contains the 
CUSTOM_ID property. I tried to address it in the following patches:

Max Nikulin. Re: Bug: org-store-link uses CUSTOM_ID instead of target 
point. Sat, 6 Nov 2021 19:51:29 +0700. 

  reply	other threads:[~2022-09-11 13:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 17:44 Adding target and custom id links doesn't ask for description Carlos Pita
2022-08-02 18:58 ` Carlos Pita
2022-08-03 11:35   ` Max Nikulin
2022-08-10  5:39 ` [PATCH] " Ihor Radchenko
2022-08-10 12:30   ` Carlos Pita
2022-08-11 15:50     ` Max Nikulin
2022-08-12 19:18       ` Carlos Pita
2022-08-13  5:01         ` [PATCH v2] " Ihor Radchenko
2022-08-14  9:53           ` Max Nikulin
2022-09-11 13:18             ` Max Nikulin [this message]
2022-09-12 11:02               ` Ihor Radchenko
2022-09-12 16:05                 ` Max Nikulin
2022-09-13 13:08           ` 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:

  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='tfkn6f$v94$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).