From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 6IBLMllmS2UzhQAAG6o9tA:P1 (envelope-from ) for ; Wed, 08 Nov 2023 11:43:38 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 6IBLMllmS2UzhQAAG6o9tA (envelope-from ) for ; Wed, 08 Nov 2023 11:43:37 +0100 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 7626A50E35 for ; Wed, 8 Nov 2023 11:43:37 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DHPX1JhP; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699440217; 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=lofhd4kWGqKQIt3jqe7n0Y6E9WVhjyVJgx4voUT0AZw=; b=TNdg9lArxVWMh/LVfnnWTfOip1JWEOIWslNw1q5kx0KbWfefeXb5tO6yroXbp2Jk+f0P4M a/3JoBZQAf+7mne0VGmx4DQpD752+uEtfTd5oVCO49hv6mWv2PzAB1zKY1GCURgHBRgXF/ 0/giEU8fp7XuqH6Z/WIunTpdGtjbXGjJw/RGEwcVnJP3RHtOmP4XnUhBfwrQP8x52vmxo+ ee9ZVx3jS1LntteJz6xA8S2g4ot6I46aQBro+kQA5NQcP48werGaUwAdP0SWhJU32vK+uo iuYnAX/9gxJ5XMsrFZk3wAge7GVDkYwLOeDEIyilU6qgYWjMSyGA0fOERWb7wg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DHPX1JhP; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699440217; a=rsa-sha256; cv=none; b=mX+JhGbCPJ3k8Rquh7yggiqO5xj++SaMTNoNnVmr0VFXpZKPgMfdgHTacHFU8okUkUD3tI 7IUtRX9n1Awed4/SKFFL8+TXwTZPc6AxXeVigD1sGAgChcJ1Xz0wn57aupNlQiWRnNJrHg 1mETeGxDThae2/B7624vPgPoGJo1gUo5Eg+nlneNuKb/G8QW+zb9IZv+dQUcIzAj9OE9IY A/vtrus+nZ4v5IqpyF8BszMZZR6qDaJ25iQAojFMfBa0zeMx8n3efdr74JKgddinBg2BL/ S2foQ/GsCHpkk91PEP9p1fM3K8H3cvB9nVbAzZ7Ql8t1ThEfmyAZS4SU2qRyRQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0g1i-0003SS-Pk; Wed, 08 Nov 2023 05:43:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0g1h-0003SH-Qy for emacs-orgmode@gnu.org; Wed, 08 Nov 2023 05:43:13 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0g1d-00022V-KV for emacs-orgmode@gnu.org; Wed, 08 Nov 2023 05:43:13 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F3C39240103 for ; Wed, 8 Nov 2023 11:43:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1699440186; bh=mF1ds9AXJF3ytuU9f2t/WJXzll1PXzW/siI/fiEep0E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=DHPX1JhPP1cV/uZc8OTT7VUDEMAoHASR+WabwnvXwMnZLF4fIxGAfUpceK5SKkKtO TkfwkPDhMPYafWv+e9mOVb2LWa909YQ9hMYt07DKRqU/kcWXHrnjUhIWuUrEJ/VYN4 PxViOtUEZD5112NQsIo4KyKLhNPU9WKdHjwoKbR2ROY4hTxeXCnJ3ubif+wCENmsUn azUEVnVXWrLEicmgVlGWIali26XBO8EX9rRqIJXkWbgy2BD01v3teS4wnMdQpyOi5V pcf3H1JY9Qi8/qr5Wpc4mQXpGdGOpb6ZO7afq94eO4aoLxdiPXfbtNDG9DOJWCDUSt qFJnwgCPCURzQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SQMB06ws5z6trs; Wed, 8 Nov 2023 11:43:04 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [RFC][PATCH v2] Allow to export to ascii custom link types as notes In-Reply-To: References: <874jijaukf.fsf@localhost> <8734y1aeae.fsf@localhost> <87lebt8rrm.fsf@localhost> <87v8ad29n2.fsf@localhost> <87il6d22rr.fsf@localhost> Date: Wed, 08 Nov 2023 10:45:10 +0000 Message-ID: <8734xgfrrd.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.31 X-Spam-Score: -9.31 X-Migadu-Queue-Id: 7626A50E35 X-Migadu-Scanner: mx13.migadu.com X-TUID: 7KHMc6UYatAm Max Nikulin writes: >> We can alternatively check function arity. > > 5 unnamed arguments for functions that are supposed to be implemented by > users looks rather close to a border when it becomes fragile. The > language does not enforce type checking for user-supplied functions and > users would not bother as well. Multi-argument functions was a painful > experience with FORTRAN for me (fortunately I was not deeply involved). Makes sense. >>> Do you mean something like the following? >>> >>> (defun org-man-export (link description backend) >>> "Export a man page LINK with DESCRIPTION. >>> BACKEND is the current export backend." >>> (org-element-create-link >>> (format "http://man.he.net/?topic=%s§ion=all" link) >>> description)) >> >> Yes. > > It is nice idea for most backends, but it is unclear for me what the > following function should return for ox-ascii > > Ihor Radchenko. Re: Exporting elisp: and shell: links. Sun, 08 Oct 2023 > 09:48:07 +0000. > https://list.orgmode.org/87r0m5phrc.fsf@localhost >> +(defun org-link--export-code (path description _ info &optional lang) >> + "Export executable link with PATH and DESCRIPTION. >> +INFO is the current export info plist. >> +LANG is the language name, as in #+begin_src lang. For example, \"elisp\" >> +or \"shell\"." >> + (concat >> + (org-export-data >> + (org-element-create >> + 'inline-src-block >> + `( :language ,lang >> + :value ,path >> + :parameters ":exports code :noweb no :eval never")) >> + info) >> + (when description (format " (%s)" description)))) > > Source code should be exported inline or as a note depending on > preferences. This case exported element is not a link, so description > should be treated separately. In this scenario, :filter function may transform :raw-path in the link object, replacing it with (org-export-data (org-element-create-inline-src-block ...) info). Or we may arrange ox-ascii to export :raw-link object (format "[%s] <%s>" anchor (org-export-data (org-element-property :raw-link link) info)) Then, I imagine `org-link--export-code' to do something like (unless (org-element-property :org-link-code-exported link) (setq link (org-element-copy link)) (org-element-put-property link :org-link-code-exported t) (org-element-put-property :raw-link (org-element-create-inline-src-block ...))) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at