Max Nikulin <maniku...@gmail.com> 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 <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>