From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YEolIZ/SaF97BgAA0tVLHw (envelope-from ) for ; Mon, 21 Sep 2020 16:19:43 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EDLiHJ/SaF81VQAAB5/wlQ (envelope-from ) for ; Mon, 21 Sep 2020 16:19:43 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D3BA39400C7 for ; Mon, 21 Sep 2020 16:19:42 +0000 (UTC) Received: from localhost ([::1]:52518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKOXV-0007wq-E3 for larch@yhetil.org; Mon, 21 Sep 2020 12:19:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKOX3-0007wD-NL for emacs-orgmode@gnu.org; Mon, 21 Sep 2020 12:19:13 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:36869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKOX1-0005Rt-5v; Mon, 21 Sep 2020 12:19:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id a9so94991wmm.2; Mon, 21 Sep 2020 09:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=p1umZ3cO6gaLFaF2CNtMI840UPJh6jHB3LysNQQ6jYU=; b=RlOQ9au70o5vqdrR9l2cEacP7OdpKJGy7WWO9Nk/hrvAef725L96yVqByxDg7xGj/D 9skyB7zoQx74S3B3iCj1pDgqtu7CerPAzwZRGqOPrv2ZIa/CGncQJl4X+rGEPED6LicD Zh30DKvF8CyuPiSX4JT0JlG9WL8vfUKqNweGkQcMnx+9J4cEfLr0Grd7QTjH6UIpHXqQ 5HtiI1J0t5n6j/1CETbZoRZefQf257qUUgvaruRIvWGPvRq/4IOhQeTu5p0zdKOoZeZl 5+BCuE7nXNvCKa3MVByxX1NdrIAbM5mAyy/QfWRE3mM137SPv1hL/5ILz2PjWumB3XFh sM9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=p1umZ3cO6gaLFaF2CNtMI840UPJh6jHB3LysNQQ6jYU=; b=XEKPCrIs5wTb/5tIEZH8rxfIBxySobTwCDx2C5T+F32TV6fUbhdQr0cS/DtbwsgR8L LwbuC2cn4j+BV6T/VT18Fx5hTofQwVnXtC4ZfZP9ztG6L9pV+xs57zWTpLxql/4Mpdfe yZ3ReK0GGy3VP2t7Utbg+7/zmZBtDoIG2UdlHeAAmrH/hpf7ZG4+KZ7ABWyS0uLFfcqz +xwPainjhSweQuGHWQBKUltrkUe8+Sx42wwIQFqg3AG+Abgik+WMh0ecvZtbsfF56bzm Rv/No+SyjqTt7gf/L7v9aFDC3/lAlkTgahD1WOd9b5Oz7IZ+UJVC/qSZb2V6Z++WP6A2 U1cw== X-Gm-Message-State: AOAM530fI6iOZc1vslvj7mZD9D34PpJdK725tUxJk7vr/rSiDQpl5fN2 NtqauC5Y0dn6xakEkGfUuyO+v7jCKdA= X-Google-Smtp-Source: ABdhPJxh7Bbk++oCW6O+QPBzIMoh3Px865S71t0RxE/O44U6HbXyS1JISs3BQMxW51I8hrPWL29GUA== X-Received: by 2002:a1c:2cc4:: with SMTP id s187mr194045wms.36.1600705148779; Mon, 21 Sep 2020 09:19:08 -0700 (PDT) Received: from my-little-tumbleweed (200.143.13.109.rev.sfr.net. [109.13.143.200]) by smtp.gmail.com with ESMTPSA id k4sm22137860wrx.51.2020.09.21.09.19.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 09:19:08 -0700 (PDT) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Bastien Subject: Re: Default description for abbreviated links References: <87mu3ze52c.fsf@gmail.com> <874kobcp5w.fsf@gnu.org> Date: Mon, 21 Sep 2020 18:19:07 +0200 In-Reply-To: <874kobcp5w.fsf@gnu.org> (Bastien's message of "Sun, 06 Sep 2020 09:58:19 +0200") Message-ID: <87363b5chw.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=kevin.legouguec@gmail.com; helo=mail-wm1-x32f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=RlOQ9au7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: icpKYMXDqTpI Hello Bastien! Thank you for following up on this. Bastien writes: > K=C3=A9vin Le Gouguec writes: > >> I like #+LINK keywords because they make documents self-sufficient: >> anyone opening my document can follow these links or export the buffer; >> they do not need to run some Elisp to add to org-link-parameters. >> >> One thing I don't know how to customize, however, is how these links are >> exported when they have no description.=20=20 > > thanks for sharing your need and ideas. > > I think we can allow > > #+LINK: bug [[https://debbugs.gnu.org/%s][bug:%s]] > > to define an abbreviated link producing the output you want. > > Same in org-link-abbrev-alist(-local): > > (("bug" . "[[https://debbugs.gnu.org/%s][bug:%s]]")) > > What do you think? I'd rather not add an option or modify the > structure of org-link-abbrev-alist(-local). That's an interesting idea! It sounds fairly more powerful than what I had in mind (only allowing KEY:TAG or TAG), but I'm sure someone could find some use for free-form formatting. I'm not sure how to implement it though. I just came back from a hike through ox-html.el, ox.el, org-element.el and ol.el; going backward, here is how descriptions are given to export backends: (1) Link-transcoding functions (e.g. org-html-link) are given two arguments: a link object, and its description. (2) The description argument is set in org-export-data, from whatever org-element-contents returns. (3) This (IIUC) is defined by what org-element--parse-objects `push'es on the link object, which is determined by a recursive call to org-element--parse-objects from the link's :contents-begin property to its :contents-end property. (4) org-element-link-parser sets these properties to the bounds of org-link-bracket-re's optional second group, if it exists. AFAICT steps (2) and (3) are not specific to links; they are generic steps that are independent of what kind of elements they are processing. I don't think this is where the "description fallback" feature should be implemented, since it would add special-casing just for links. I'm guessing I should keep aiming at step (4), like in my first patch; my problem is that this step just defines the link's :contents-begin and :contents-end properties. My first patch works because I'm only allowing KEY:TAG and TAG, so I can re-use positions inside org-link-bracket-re's first group. If we are to create a completely new format string, how can we pass it to the backends? FWIW, I would still favor only allowing KEY:TAG and TAG, since that covers all use-cases I've thought of so far (the one you quoted, and the "doc:" links in ORG-NEWS). I know you said you'd rather not modifying the structure of org-link-abbrev-alist, but maybe adding an optional third item would be the least intrusive way to go? I.e. going from: ("linkkey" . REPLACE) To: ("linkkey" REPLACE [DESCRIPTION-FALLBACK]) Where DESCRIPTION-FALLBACK could be nil (the default), 'key-tag or 'tag. Thank you for your time.