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: Tue, 19 Sep 2023 22:19:06 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

On 19/09/2023 07:10, Rudolf Adamkovič wrote:
Max Nikulin <manikulin@gmail.com> writes:

Do you think a label specifying language should be added to code
snippets, e.g. <code title="elisp">(identity "a")</code> or it is
useless and may cause undesired noise for screen reader users? What
about LaTeX?

As a user, I would expect

   [[elisp:(identity "a")]]

to be export-equivalent to

   src_elisp[:exports code]{(identity "a")}

across all backends.

(defun org-link-export-eval-link-no-descr
    (type path descr backend info)
  (unless descr
    (let ((element
           (org-element-create
            'inline-src-block
            (list :language type
                  :value path
                  :parameters ":exports code :noweb no :eval never"))))
      (org-export-data element info))))

(defun org-link-make-export-eval-link-no-descr (type)
  (lambda (path descr backend info)
           (org-link-export-eval-link-no-descr
            type path descr backend info)))

(dolist (type '("elisp" "shell"))
  (org-link-set-parameters
   type
   :export (org-link-make-export-eval-link-no-descr type)))

What is your expectation for links having description?

    [[elisp:(identity "a")][Run it]]

Good point!  Perhaps we just need to find a
good symbol that would work well between the
Elisp code and the description?

For example

   /Run it/ \to src_elisp[:exports code]{(identity "a")}

exports to ASCII as

   /Run it/ -> `(identity "a")'

Of course, \to could be something else...

I have another example:

   [[elisp:(server-start)][=M-x server-start RET=]]

suitable for a printed document.

From my point of view, it is better either to drop link path completely or to add a button to copy the code to clipboard. Repetition is undesired.

So I am unsure if it is possible to choose unambiguous rules for export of elisp and shell links.




reply via email to

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