emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Reuben Thomas <rrt@sc3d.org>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Bug: Fix for org-make-link-description-function use in org-insert-link [9.0.10 (9.0.10-5-g1654a5-elpa @ /home/rrt/.emacs.d/elpa/org-20170904/)]
Date: Tue, 5 Sep 2017 22:05:59 +0100	[thread overview]
Message-ID: <CAOnWdogprVG7wTFtaVQ0XOhd9E3iGOqVDya5orb_Z+XNc7X+ug@mail.gmail.com> (raw)
In-Reply-To: <87a828na5m.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 2464 bytes --]

On 5 September 2017 at 21:49, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>

​Hi, thanks for looking at this.​


> Reuben Thomas <rrt@sc3d.org> writes:
>
> > This seems to be incorrect behaviour, as the docstring for
> > org-insert-link says:
> >
> >   If `org-make-link-description-function' is non-nil, this function
> will be
> >   called with the link target, and the result will be the default
> >   link description.
> >
> > The implication is that the value returned is used as the default, not
> > that it overrides the prompt.
>
> I agree.
>
> > First, org-make-link-description-function is called if it is non-nil,
> > and used to set default-description.
>
> I think the optional parameter from the function call should still
> prevail. I.e., shouldn't this function be called when
> DEFAULT-DESCRIPTION is nil (e.g., called interatively)?
>

​This question occurred to me too, but I didn't form an opinion. However, I
am inclined to agree with you on thinking about it some more.​


> > Then (unless auto-desc is non-nil) the description is prompted for with
> > default-description as the default value (unless
> > org-make-link-description-function returned nil, in which case the
> > current value of desc, if any, is used).
> >
> > There is one further matter that my patch does not address: the
> > docstring for org-make-link-description-function says:
> >
> > “When [org-make-link-description-function is] nil, the link location
> > will be used.”
> >
> > This does not happen (it’s precisely the behaviour I’ve been trying to
> > obtain!), and my patch does not make it happen. Indeed, it’s not clear
> > that it’s desirable (if one is using numbered sections, for example).
>
> Obviously, it would not be desirable.
>
> However, I think it should read "When
> `org-make-link-description-function' _returns_ nil, the link location is
> used". This is not what is implemented either, tho.
>

​If you (or someone) can confirm your interpretation above, I would be
happy to update my patch to implement the two behaviours required, namely,
that org-make-link-description-function is only called if the
default-description argument to org-insert-link is nil, and that if that
function returns nil, then the link location is used. I would also clarify
the docstring regarding the second behaviour.

-- 
https://rrt.sc3d.org <http://rrt.sc3d.org>

[-- Attachment #2: Type: text/html, Size: 3791 bytes --]

  reply	other threads:[~2017-09-05 21:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05 16:27 Bug: Fix for org-make-link-description-function use in org-insert-link [9.0.10 (9.0.10-5-g1654a5-elpa @ /home/rrt/.emacs.d/elpa/org-20170904/)] Reuben Thomas
2017-09-05 20:49 ` Nicolas Goaziou
2017-09-05 21:05   ` Reuben Thomas [this message]
2017-09-05 22:02     ` Nicolas Goaziou
2017-09-07 23:06       ` Reuben Thomas
2017-09-08  5:00         ` Nicolas Goaziou

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=CAOnWdogprVG7wTFtaVQ0XOhd9E3iGOqVDya5orb_Z+XNc7X+ug@mail.gmail.com \
    --to=rrt@sc3d.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).