From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id sHiVDzLWf2WkJQAAkFu2QA (envelope-from ) for ; Mon, 18 Dec 2023 06:18:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id KDVECTLWf2WeCgAAqHPOHw (envelope-from ) for ; Mon, 18 Dec 2023 06:18:42 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ggoJxWnY; 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=1702876722; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Z/1XvuI1bjlxwplF1xvhMYytG0eRjWEZxOont1lwrzw=; b=OecMurWANEqDJBEisDw/geyoHj+eQP/ceazgvSfOzbHGoBBF88G9kJNa30Zg28w5UO7urM NQPhFhJ1gQxY+MwnOlKjbDsfbX2zq7/wmCeOmf0HbZ1FMfofIBYK/5ewz2kvef/OxTgWUS mPrJKj7WhDj85b6SrRU7CxLdPqHgNSWx2L/TlD0hV2Pm0QH1Zh3eql+GPzaqq7kTfwZpsw tuWePhaoC5vX9dnj9aUkoNx3371G0bhunzY6GHmvsnd5WjM/O8YMzJs8s0VKUghg8OO0aY ixAe5y9LBZ9KvLV0lEPtHc+W5JK+mCIVcn6wFVOnrrOt2ul/tj3QLSbH1kVdTA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702876722; a=rsa-sha256; cv=none; b=eh6IlES1vjMBtBxQPsDHvPNnwsXJcHzNs6m2724fh1xnZIW1rDuaiq2dUQ1u322GFT2L8y 5JCRTPzZz/ChUmD6z2Oe9PdjvdDw9tX6PAfY2YphOp8+kFcksR0c8qsx9ZF+FxvxWim+ll x2JhLGF1pqtgt7/l17M9fmPPaGhOBfLCM6XZV5AWGMRqPjlVDv1Kz9+Q9IdZlIXdrBOwPR uUpgfVIqIctzp2aDERZlXaiUX+WVcKNopVny5m5BT59L1Nk2SrlDwis6RfG3YqxWyycMxC 7ueBceiFxQrrD8Y+hbkSOggVzw8ytvLRb48O9VBV57i4EbBu9nZySOdlBQg4/g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ggoJxWnY; 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 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 CD27010AF8 for ; Mon, 18 Dec 2023 06:18:41 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rF60q-0002cc-6e; Mon, 18 Dec 2023 00:17:56 -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 1rF60n-0002cQ-4x for emacs-orgmode@gnu.org; Mon, 18 Dec 2023 00:17:53 -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 1rF60a-0003jR-KD for emacs-orgmode@gnu.org; Mon, 18 Dec 2023 00:17:52 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id EC2EE240101 for ; Mon, 18 Dec 2023 06:17:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1702876657; bh=Rb/VQvamoOm0hqHz5CgYJp4egoqWsBvKX2m+Lhu6AB0=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Disposition: From; b=ggoJxWnY9GfiAQIT/xvLYH8glV2DHwJeHBcEuPuKkayZZlPr42P7HlXJiXOXljivz yyD/I7KrfTuG/bbh8Y7NJHepu3ySGSU6dcUnYnnpHLmKqx7p8c8PXYlxImkVt48Pdv U5QisabZVqgi5GfJZgHXqcUX7osIDNxy4qlXmHiffWM1763iER21UKgq7HArBuzt7t qut5cdUD67c3UyLXMmWw6DNXSQM4GkIuoqGOUQfHtTgj8Tq/Jk/gHxVmNjW/EOM3+u IBG5y8K2T4+AK2G6iSFpB4te5NxS9T3dQOcvh/PjdcvK304jqiBXBwM1Q9Jxhmrxwk OJNfLdq2o8wLg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Stp402LN1z6tw3 for ; Mon, 18 Dec 2023 06:17:36 +0100 (CET) Date: Mon, 18 Dec 2023 05:19:02 +0000 From: Hammer Hu To: emacs-orgmode@gnu.org Subject: [Patch] Adding support for arxiv type link Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="kl4yulxsmyzx4oux" Content-Disposition: inline Received-SPF: pass client-ip=185.67.36.66; envelope-from=hammer@posteo.net; helo=mout02.posteo.de 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_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.41 X-Spam-Score: -9.41 X-Migadu-Queue-Id: CD27010AF8 X-Migadu-Scanner: mx11.migadu.com X-TUID: SXWYdOXpZIp+ --kl4yulxsmyzx4oux Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi there, I made several commit adding support for link as arxiv:2208.11710. These codes basically come from lisp/ol-doi.el. I copy and modify them side by side. Let me know what do you think! Best, Hammer --kl4yulxsmyzx4oux Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename="0001-New-file.patch" >From 97ea5d017a2c9a889604fb5216ded59a1952e723 Mon Sep 17 00:00:00 2001 From: hammerfunctor Date: Mon, 18 Dec 2023 00:01:39 -0500 Subject: [PATCH 1/3] New file --- lisp/ol-arxiv.el | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 lisp/ol-arxiv.el diff --git a/lisp/ol-arxiv.el b/lisp/ol-arxiv.el new file mode 100644 index 000000000..280b909f2 --- /dev/null +++ b/lisp/ol-arxiv.el @@ -0,0 +1,76 @@ +;;; ol-arxiv.el --- ARXIV links support in Org -*- lexical-binding: t; -*- + +;; Copyright (C) 2023-2023 Free Software Foundation, Inc. + +;; Author: Zhengfei Hu + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; This library introduces the "arxiv" link type in Org, and provides +;; code for opening and exporting such links. + +;;; Code: + +(require 'org-macs) +(org-assert-version) + +(require 'ol) + +(defcustom org-link-arxiv-server-url "https://arxiv.org/abs/" + "The URL of the ARXIV server." + :group 'org-link-follow + :version "24.3" + :type 'string + :safe #'stringp) + +(defun org-link-arxiv-open (path arg) + "Open a \"arxiv\" type link. +PATH is a the path to search for, as a string. +ARG is passed to `browse-url'." + (browse-url (url-encode-url (concat org-link-arxiv-server-url path)) arg)) + +(defun org-link-arxiv-export (path desc backend info) + "Export a \"arxiv\" type link. +PATH is the ARXIV name. DESC is the description of the link, or +nil. BACKEND is a symbol representing the backend used for +export. INFO is a plist containing the export parameters." + (let ((uri (concat org-link-arxiv-server-url path))) + (pcase backend + (`html + (format "%s" uri (or desc uri))) + (`latex + (if desc (format "\\href{%s}{%s}" uri desc) + (format "\\url{%s}" uri))) + (`ascii + (if (not desc) (format "<%s>" uri) + (concat (format "[%s]" desc) + (and (not (plist-get info :ascii-links-to-notes)) + (format " (<%s>)" uri))))) + (`texinfo + (if (not desc) (format "@uref{%s}" uri) + (format "@uref{%s, %s}" uri desc))) + (_ uri)))) + +(org-link-set-parameters "arxiv" + :follow #'org-link-arxiv-open + :export #'org-link-arxiv-export) + + +(provide 'org-link-arxiv) +(provide 'ol-arxiv) +;;; ol-arxiv.el ends here -- 2.43.0 --kl4yulxsmyzx4oux Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename="0002-lisp-ox-latex.el-org-latex-link-keep-arxiv-type-link.patch" >From 013dffb022ca84a9aa40e2b4d9e8764b9cd94169 Mon Sep 17 00:00:00 2001 From: hammerfunctor Date: Mon, 18 Dec 2023 00:04:21 -0500 Subject: [PATCH 2/3] lisp/ox-latex.el (org-latex-link): keep arxiv type link --- lisp/ox-latex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 41c2d3994..11140eddf 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2917,7 +2917,7 @@ INFO is a plist holding contextual information. See link (plist-get info :latex-inline-image-rules))) (path (org-latex--protect-text (pcase type - ((or "http" "https" "ftp" "mailto" "doi") + ((or "http" "https" "ftp" "mailto" "doi" "arxiv") (concat type ":" raw-path)) ("file" (org-export-file-uri raw-path)) -- 2.43.0 --kl4yulxsmyzx4oux Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename="0003-lisp-org.el-org-modules-autoload-new-library.patch" >From 20dee5f0f3c7a784f490feaa14b98ba127fe7574 Mon Sep 17 00:00:00 2001 From: hammerfunctor Date: Mon, 18 Dec 2023 00:04:55 -0500 Subject: [PATCH 3/3] lisp/org.el (org-modules): autoload new library --- lisp/org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 8868388bf..366626b52 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -746,7 +746,7 @@ defined in org-duration.el.") (require 'org-element) (org-element-cache-reset 'all))) -(defcustom org-modules '(ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) +(defcustom org-modules '(ol-doi ol-arxiv ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) "Modules that should always be loaded together with org.el. If a description starts with , the file is not part of Emacs and Org mode, @@ -773,6 +773,7 @@ For export specific modules, see also `org-export-backends'." (const :tag " ctags: Access to Emacs tags with links" org-ctags) (const :tag " docview: Links to Docview buffers" ol-docview) (const :tag " doi: Links to DOI references" ol-doi) + (const :tag " arxiv: Links to ARXIV references" ol-arxiv) (const :tag " eww: Store link to URL of Eww" ol-eww) (const :tag " gnus: Links to GNUS folders/messages" ol-gnus) (const :tag " habit: Track your consistency with habits" org-habit) -- 2.43.0 --kl4yulxsmyzx4oux--