From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kOU9Fbf4PGMrKAAAbAwnHQ (envelope-from ) for ; Wed, 05 Oct 2022 05:23:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yGNlFLf4PGN5JAAAG6o9tA (envelope-from ) for ; Wed, 05 Oct 2022 05:23:35 +0200 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 EBE141E37A for ; Wed, 5 Oct 2022 05:23:34 +0200 (CEST) Received: from localhost ([::1]:51444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofv0Q-0002aT-4A for larch@yhetil.org; Tue, 04 Oct 2022 23:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofuzw-0002a5-RX for emacs-orgmode@gnu.org; Tue, 04 Oct 2022 23:23:04 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:34806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofuzu-0004kY-Tc for emacs-orgmode@gnu.org; Tue, 04 Oct 2022 23:23:04 -0400 Received: by mail-pj1-x1035.google.com with SMTP id a5-20020a17090aa50500b002008eeb040eso2258018pjq.1 for ; Tue, 04 Oct 2022 20:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=fb9TNPHO0Ppq8DVAfmi73UKReinrYr3OQChZl41V1to=; b=YfpDfNQho8N7A6O6Q105tTBdr5ZFcBpu5pCOOBVFB1OyAhs2qGeOLg7EZm09btkse1 DOyuTRiE8WyhLkOyOYdWhl8vu65HSrSpGTl5qOYhzmexsdThntsxqDl4oCJ3jzfyHSPi 8bq890+1qmEmq2Nf3suaUDSZFi/QRfZ7DjygdJVO+LUct6NndipLPEaRiXKe/zcumann 8a0aTB+VavCgFAJ1aOL2A3ErkC4jLoGl53G27dIcBt6IDOQ3d6/BiEhfNTC0tFJuGiir CEpr3B7mIam0MboRi/w7ZJa0n42r/yZfoj2PMIIBU4/LzVabvSzYxfed9kWzY59ihF5+ 2JVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=fb9TNPHO0Ppq8DVAfmi73UKReinrYr3OQChZl41V1to=; b=4HnK6JB8NG85CJc1sevnxwzRndM9GO40XlX3qt4wpnKIg4Set13ZUSiJVUfc+X5phF Lu4jB5Qy5va5KZ9IQ9XT+BEuPmDyhl2MYF7k5zpzWKhQaZ3XwhuNEZcFDwEFsXfQkEAv Mi0Bsz2GyTctLiugMPCuYjr6Z5Y+WveHtsIKvxHpfAfDKnSXwKchZvE/vFebrbZaWg1+ YF5A4gOvb2/PCMPI+ZM5QURy0QIEc7hEmJVXMgdJva1B6/Bz6i33kxzkiRIFqVM2MAN6 9JE7stgZbL/GWzRmBVxPe3IbGJHYZFpX4Lce4PIlHY6BSp/iDkEzB3h6PvPgPy4zj/I+ 0G2w== X-Gm-Message-State: ACrzQf0k31yOO9x4hSgYvSyiesN/iMaoO8Pv7WNSORXyhZkbctO+3PUI +xbbbgKhOQ7iEZMZyfCLKi8= X-Google-Smtp-Source: AMsMyM6mS+x8ql3GlcRJgIzookWm4iI/xF5OruZZUMVihIKLYjrS0TWfdxakBHdibfMxY6OhAw3xhg== X-Received: by 2002:a17:902:8347:b0:178:6e81:35ce with SMTP id z7-20020a170902834700b001786e8135cemr29134326pln.23.1664940179994; Tue, 04 Oct 2022 20:22:59 -0700 (PDT) Received: from localhost ([2409:8970:af2:32f:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id 17-20020a630411000000b004582e25a595sm450441pge.41.2022.10.04.20.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 20:22:58 -0700 (PDT) From: Ihor Radchenko To: Michael Dauer Cc: emacs-orgmode@gnu.org Subject: [org-export] Linking inlinetasks (was: BUG?: Link to inline-task not working) In-Reply-To: <87ee6p4zhn.fsf@localhost> References: <875ys6m05b.fsf@localhost> <871r2tm4zk.fsf@localhost> <87ee6p4zhn.fsf@localhost> Date: Wed, 05 Oct 2022 11:23:50 +0800 Message-ID: <871qrnar7d.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664940215; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=fb9TNPHO0Ppq8DVAfmi73UKReinrYr3OQChZl41V1to=; b=M1Ig1eZs0TpWBYhM8XfqauxWEe25prkWD3aB+rDclERNHlF0z1YWWh8irtuv5P1WC2t+0m QV+k+ZwZJ+/rKjGJl8es7SfQ8LrsP5myy5MW1YUeGZu1oTe2myPZM52+77Y3H3VH9RReMS U6ykobsGFSrCQxpOCQTfV9w7cTAALOQpCH02UNPj0+a5fJGspX6Nu/ftt784sWu9CRIGRl GqpRCAA9frSEIPNfZL8Ef5rGYm+0WEvAlsqHn0PeIXlnD/9Dx9FkegBoQpIyRdxs/BQ7M0 gK0W1aUTmOf/3iMfrJW06EU1VP+fy44IVwMFuFJ5ADOWRUPzAu2EGiZ4OLM4Tg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664940215; a=rsa-sha256; cv=none; b=c68U68CmN+6elLd2HRh5yHk1oAiXOroug6qKgeX24zHoWjF+86ENPTHnCxGr12rry5+jk1 DvoKREFG1jbUQDbbp53x6w39K42mDZAmacLuI1O6/rtmAopZruooFmKDaaBf7ZhyVKPNY2 3s7RVOiaWi4unWDHh+LAA+vRLdR1PFtY+n/6Vrr1Gpf5+23+V3uYI8M8YzzGZ5eMdYAYLB 4BGO9D+i+ib9a0+I2PTwvOnQIaHU5ovCybX+jNbl5u40tc96R7Ef7Oan9GDwDIwIxJ/305 SttGvKa/3Rs5ON7GahTEU9ju/4BpSk2Nem880KnWX7L2EagvU9hJEAMzjx0WMw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YfpDfNQh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YfpDfNQh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EBE141E37A X-Spam-Score: -7.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: EGneYgWMI3H/ --=-=-= Content-Type: text/plain Ihor Radchenko writes: > Michael Dauer writes: > >> Shouldn't be org-export-resolve-fuzzy-link the relevant function, at least >> for my use case? >> >> But there it looks like it is searching through all elements including >> inlinetasks, which is in org-element-all-elements: >> (append pseudo-types '(target) org-element-all-elements) > > Maybe. Further it also calls org-export-search-cells, which does not > consider inlinetasks even if they are matched. I have investigated further. In addition to inlinetasks not being taken into account by `org-export-search-cells', `org-export-resolve-fuzzy-link', and `org-export-resolve-id-link', there is no export backend support for linking inlinetasks. In order to have full support for inlinetasks during export, we need to modify export backends to be able to link to the inlinetasks. For example, - ox-html.el does not associate ID anchor in `org-html-format-inlinetask-default-function' - ox-latex.el also does not provide any label in `org-latex-format-inlinetask-default-function' - ox-ascii.el does not assign a number to be referred to in `org-ascii-format-inlinetask-default' I did not check other backends. Note that changing only ox.el without altering the individual backends can break export in unexpected ways. I am attaching a simple patch changing the generic link resolution machinery. If one applies the patch, **export will be broken**. In particular, exporting to ASCII (C-c C-e t U) will straight throw an error. The same may happen in third-party export backends even if we alter the all built-in export backends appropriately. Thus, supporting links to inlinetasks will be a breaking change and such support should be shielded behind a user customization, not be enabled by default. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-lisp-ox.el-Allow-links-to-inlinetasks.patch >From c6737633b12b8f9de1a240b2f32f52d54e1c14a1 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Wed, 5 Oct 2022 11:17:55 +0800 Subject: [PATCH] lisp/ox.el: Allow links to inlinetasks * lisp/ox.el (org-export-search-cells): (org-export-resolve-fuzzy-link): (org-export-resolve-id-link): Resolve links to inlinetasks. **This is not a proper commit** Applying it will not make inlinetask links work during export. Backend-specific support will be required. --- lisp/ox.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 51145acaa..6090d1ecd 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -4313,7 +4313,7 @@ (defun org-export-search-cells (datum) A search cell is the internal representation of a fuzzy link. It ignores white spaces and statistics cookies, if applicable." (pcase (org-element-type datum) - (`headline + ((or `headline `inlinetask) (let ((title (split-string (replace-regexp-in-string "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" " " @@ -4408,7 +4408,8 @@ (defun org-export-resolve-fuzzy-link (link info &rest pseudo-types) ;; Matching both a name and a target is not valid, and ;; therefore undefined. (or (cl-some (lambda (datum) - (and (not (eq (org-element-type datum) 'headline)) + (and (not (memq (org-element-type datum) + '(headline inlinetask))) datum)) matches) (car matches)) @@ -4428,7 +4429,7 @@ (defun org-export-resolve-id-link (link info) (let ((table (make-hash-table :test #'equal))) (org-element-map (plist-get info :parse-tree) - 'headline + '(headline inlinetask) (lambda (headline) (let ((id (org-element-property :ID headline)) (custom-id (org-element-property :CUSTOM_ID headline))) -- 2.35.1 --=-=-= Content-Type: text/plain -- 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 --=-=-=--