From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MGEJBl75c2C0QAAAgWs5BA (envelope-from ) for ; Mon, 12 Apr 2021 09:40:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 0IQAAF75c2CWXgAA1q6Kng (envelope-from ) for ; Mon, 12 Apr 2021 07:40:13 +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 D072515A29 for ; Mon, 12 Apr 2021 09:40:12 +0200 (CEST) Received: from localhost ([::1]:45128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVrB4-00078d-K0 for larch@yhetil.org; Mon, 12 Apr 2021 03:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVrAS-00078V-9W for emacs-orgmode@gnu.org; Mon, 12 Apr 2021 03:39:32 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:43770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVrAN-0006lc-Sb for emacs-orgmode@gnu.org; Mon, 12 Apr 2021 03:39:32 -0400 DKIM-Signature: a=rsa-sha256; b=s9Ed/LbnCLtcF+isxirEgn1omDAeiqdgz27w/Ellzylfrir4nnAhTbE/3IbK/bx4CpFIDNP7WStxm0XEFPc0hIlUn27kaYe/3vF8FUenK9irJoyJiz1Kolv9k22+/5Pot1G7fWsRzyrXVHyJ0VtjZt/fkhxUMYOLQtaV51iYcCN3cNkou0gBgwK9izrELCnCdEm2XqL8Ta2em+ugDAKnLXHyGqkfiiGvLwiyv/9i6lqQgwLlL8cvHyrWYeSjBrEI13Hko1poMPR5o7Po7SVt6fR87ilIm95RMzbUEOTAMaNj9MOUGkeVL7HWVNVaIE8y/CIV0uVT9SU4LwJyFJOvIA==; s=purelymail1; d=purelymail.com; v=1; bh=xcch4XesdKwIV6Xoj4t4JwyVj9uKxyXtgRXfrTYRmJo=; h=Feedback-ID:Received:From:To; Feedback-ID: 275:108:null:purelymail X-Pm-Original-To: emacs-orgmode@gnu.org Received: by ip-172-30-0-247.ec2.internal (JAMES SMTP Server ) with ESMTPA ID -1643052695 for ; Mon, 12 Apr 2021 07:39:12 +0000 (UTC) To: emacs-orgmode@gnu.org Subject: Custom link type that attaches file in :follow User-agent: mu4e 1.2.0; emacs 27.1 Date: Mon, 12 Apr 2021 09:39:02 +0200 Message-ID: <87h7kcymsp.fsf@purelymail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=34.202.193.197; envelope-from=tarjei@purelymail.com; helo=sendmail.purelymail.com 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, SPF_HELO_PASS=-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" Reply-to: Tarjei =?utf-8?Q?B=C3=A6rland?= From: Tarjei =?utf-8?Q?B=C3=A6rland?= via "General discussions about Org-mode." X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618213213; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=XNAILgu2693rSkmpdVerpLgr6Ah1GXTv0iOH0xnQrFE=; b=UVMZ22e2MvuZ8erKolvIn9Xhk+LnXxxGLdGJxwXCKnboLToP7nLA6gv/1grvWbs7GDwPGI Egfw5zgLSzxGHWQue+6kmhkEBFe07Zhis07tBntFAdrue9TXNvYpdGBssnCcWgoXe5OTp5 UqBCu+O3FNWVQ0H3jxS4O2+KknzobIsfBcm5kndkAbYvTIFzEpwGhKpwHwuyTzaoh+KrCp mc4GbccNpugme5yry6iz53h6Hy1RcWRY8Vr3JyxkYP2mu5ApvVT5L4GlW6/7l9S/YnWJSP pwzVqY3DIyfI86dgrdPFrkiAyoRxGpaynkTQaEIBwoh3iDcKvwfWsWQY5jt0zg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618213213; a=rsa-sha256; cv=none; b=tS4mE1TOtO2TBMp9kfYQTNAEMWXrpqSrgk1LjgOnf1bGY+zf8oczsvoVSUOzFzNlCLN48y u/kfMZMxTcZpzMLd5jkA00iXZJMaB2qvWFUTT5TpN+C+hTHVZdXnUuNDkauTp0fm1ejZAT bP9P8vKoZfid0+Be9iLIv47IHnr6uJzIshgE1uIhPbS6JJVKx7mhuCjXQA1eXuno6bM7kV PM1Sn+kQn0Dsor9zKQAgOCKzcyUgxzxxKws7ETIXG82FTNDrgPmBQWPRW5oVIr81mhDHMU hUwO3AFFFRjlIQT+O7vR/hHn2e3l/qg8dfnnk/JFXXQqYuLMjGE5eK3z1Fshvw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail1 header.b="s9Ed/Lbn"; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Spam-Score: -2.94 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail1 header.b="s9Ed/Lbn"; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Queue-Id: D072515A29 X-Spam-Score: -2.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: IEA5dU9DMYQ/ Hi! I am having some trouble adding a link via =3Dorg-link-set-parameters=3D. I want to have a custom =3Dxournalpp=3D-link type that behaves as follows: - follow :: Open attached file - exists :: open the file - don't exist :: create attachment directory and copy template file into = it - export :: Use [[https://xournalpp.github.io/][Xournalpp]] to export the f= ile as an svg. Inline this svg. #+begin_src emacs-lisp (org-link-set-parameters "xournalpp" :follow (lambda (path) (let ((xoppfile (concat (org-attach-dir-get-create) "/" path)) (template "/home/tarjei/repos/konturer/maler/skisse.xopp")) (cond ((not (file-exists-p xoppfile)) (copy-file template xoppfile)= )) (org-attach-sync) (shell-command (format "xournalpp %s" xoppfile)))) :export (lambda (path desc backend) (let ((xoppfile (concat (org-attach-dir-get-create) "/" path)) (tempfile "/home/tarjei/temp/xournal_export.svg")) (shell-command (format "xournalpp --create-img %s %s" tempfile xopp= file)) (with-temp-buffer (insert-file tempfile) (buffer-string))))) #+end_src Something seems to go wrong during the export, however, where a new attachm= ent directory is created. Is my assumption that the export will run with = =3Dpoint=3D at the link incorrect? All other feedback on the implementation would be much appreciated, I seem = to repeat myself way more than should be necessary. Regards, Tarjei B=C3=A6rland