emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
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: Tue, 05 Sep 2023 09:42:23 +0000	[thread overview]
Message-ID: <8734ztvtvk.fsf@localhost> (raw)
In-Reply-To: <ud4cs7$f66$1@ciao.gmane.io>

Max Nikulin <manikulin@gmail.com> writes:

>>>     (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.

I strongly discourage abusing internal implementation details.
This behaviour is not documented. Moreover, I just suggested changing it.

>> (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

My suggestion will avoid the very need to have this list.

>> 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.

Yes. The main problem is that I fail to understand the motivation behind
the current behaviour. git logs reveal that the code is there from the
initial version of the library.

For now, the current behaviour looks like an oversight.
Also, only ox-latex-derived backends that worked around the current
undocumented behaviour might be affected.

>>> 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.

What I meant is a new link property called :filter.

>>> 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.

This is not what the bug report was about. I'd prefer to focus this
particular discussion closer to the bug report reproducer.

Feel free to branch off a new feature request about :follow with more
details on what you have in mind. I'd prefer a more concrete proposal,
because I have no good ideas how to make things easier.

-- 
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>


  reply	other threads:[~2023-09-05  9:42 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 15:25 [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/)] Csepp
2023-09-01  2:44 ` Max Nikulin
2023-09-01  9:04   ` [DISCUSSION] May we recognize everything like [[protocol:uri]] as a non-fuzzy link? (was: [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/)]) Ihor Radchenko
2023-09-01 10:49     ` Dr. Arne Babenhauserheide
2023-09-01 11:01       ` Ihor Radchenko
2023-09-01 12:25         ` Dr. Arne Babenhauserheide
2023-09-02  7:26           ` Ihor Radchenko
2023-09-02  7:54             ` Dr. Arne Babenhauserheide
2023-09-04 14:58             ` Max Nikulin
2023-09-05 11:02               ` Ihor Radchenko
2023-09-06 14:27                 ` Max Nikulin
2023-09-07 10:42                   ` Ihor Radchenko
2023-09-07 11:07                     ` Max Nikulin
2023-09-07 11:22                       ` Ihor Radchenko
2023-09-01 12:15     ` [DISCUSSION] May we recognize everything like [[protocol:uri]] as a non-fuzzy link? Jens Lechtenboerger
2023-09-02  7:29       ` Ihor Radchenko
2023-09-01 18:53     ` [DISCUSSION] May we recognize everything like [[protocol:uri]] as a non-fuzzy link? (was: [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/)]) Tom Gillespie
2023-09-02  7:45       ` Ihor Radchenko
2023-09-02 12:00     ` [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/)] Max Nikulin
2023-09-03  7:53       ` Ihor Radchenko
2023-09-04 10:51         ` Max Nikulin
2023-09-05  9:42           ` Ihor Radchenko [this message]
2023-09-10  4:40             ` Max Nikulin
2023-09-17 22:08               ` Rudolf Adamkovič
2023-09-18 15:20                 ` Exporting elisp: and shell: links Max Nikulin
2023-09-19  0:10                   ` Rudolf Adamkovič
2023-09-19 15:19                     ` Max Nikulin
2023-09-21  9:49                       ` Ihor Radchenko
2023-09-22 23:43                         ` Rudolf Adamkovič
2023-09-25 14:38                           ` Max Nikulin
2023-09-26 10:42                             ` Ihor Radchenko
2023-09-28 15:31                               ` Rudolf Adamkovič
2023-10-08  9:48                                 ` Ihor Radchenko
2023-10-09 12:04                                   ` Max Nikulin
2023-10-09 12:12                                     ` Ihor Radchenko
2023-10-10 10:35                                       ` Max Nikulin
2023-10-12 11:35                                         ` Ihor Radchenko
2023-10-13 10:20                                           ` Max Nikulin
2023-10-14  8:13                                             ` Ihor Radchenko
2023-10-11 19:34                                   ` Rudolf Adamkovič
2024-02-05 15:41               ` [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/)] Ihor Radchenko
2024-03-12 11:00                 ` Ihor Radchenko
2023-09-04 15:08     ` [DISCUSSION] May we recognize everything like [[protocol:uri]] as a non-fuzzy link? (was: [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/)]) Max Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734ztvtvk.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).