emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exporting elisp: and shell: links


From: Max Nikulin
Subject: Re: Exporting elisp: and shell: links
Date: Mon, 9 Oct 2023 19:04:26 +0700
User-agent: Mozilla Thunderbird

On 08/10/2023 16:48, Ihor Radchenko wrote:
+++ b/lisp/ol.el
@@ -1377,7 +1377,29 @@ (defun org-link--open-elisp (path _)
                 (call-interactively (read path))))
     (user-error "Abort")))
-(org-link-set-parameters "elisp" :follow #'org-link--open-elisp)
+(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)

I think, the fragment above should be a public function that is a building block for users who want to override export of links having descriptions.

+   (when description (format " (%s)" description))))

I hope, path was never added as default description, so checks (or (string-equal path description) (string-equal (concat type ":" path) description))) are not necessary to avoid annoying repetitions.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]