emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] URI handling is overly complicated and nonstandard [9.6.7 (N/A


From: Max Nikulin
Subject: Re: [BUG] URI handling is overly complicated and nonstandard [9.6.7 (N/A @ /gnu/store/mg7223g8mw90lccp6mm5g6f3mpjk70si-emacs-org-9.6.7/share/emacs/site-lisp/org-9.6.7/)]
Date: Mon, 4 Sep 2023 17:51:48 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

On 03/09/2023 14:53, Ihor Radchenko wrote:
Max Nikulin writes:
I missed this feature, but anyway it does not work as expected.

    (org-link-set-parameters "tel")
...
    \href{321}{call}

"tel:" is missed.

I have realized that it is possible to take advantage of current behavior:

  (org-link-set-parameters
   "browse"
   :follow
   (lambda (url arg) (browse-url url arg)))

so [[browse:tel:+321][call]] with *any* protocol is properly exported and opened. The only inconvenience is that the "browse:" type must be added when a link is inserted or stripped down to copy a URL.

(path (org-latex--protect-text
                (pcase type
                  ((or "http" "https" "ftp" "mailto" "doi")
                   (concat type ":" raw-path))
                  ("file"
                   (org-export-file-uri raw-path))
                  (_
                   raw-path))))

is fishy.

I do not like that lists of types in ox backends are not the same as in ol.el:

(dolist (scheme '("ftp" "http" "https" "mailto" "news"))
  (org-link-set-parameters scheme

We may simply use (org-element-property :raw-link link) and leave
special handling to "file" links only.

Does it make sense?

From my point of view it will be more sane behavior. However it may require update of 3rd party ox backends.

Actually I had in mind more flexible delegation. :export functions
should be able to alter URI, attributes and to provide description if it
is missed, but did not care if '<a href=""></a>' or '\href{}{}' should
be used.

I'd call that :filter rather than :export :)

It is an option, the only disadvantage is that `org-link-properties' can not set an export filter directly.

Have nothing against it, though it is not 100% relevant to this
particular report.

If there were an `org-link-properties' field to export link as a parsed element, not just path and description then it would be easier to define backend agnostic export function for a non-standard link type.

Easy way to add protocol/scheme should include :follow with `browse-url'
as well.

Sorry, but I do not understand what you are referring to.
May you elaborate?

My reading of the bug report subject is that it should be easy to define a link type for a protocol not supported by Org mode out of the box. Minimal features are export and follow using a handler configured desktop-wide or Emacs-wide.





reply via email to

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