[Top][All Lists]

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

Re: [O] Draft of links-9.0

From: Nicolas Goaziou
Subject: Re: [O] Draft of links-9.0
Date: Tue, 05 Jul 2016 21:12:38 +0200


John Kitchin <address@hidden> writes:

> I have completed a draft of links-9.0
> (https://github.com/jkitchin/org-mode/tree/link-9.0). This centralizes
> almost all link properties into a variable `org-link-parameters' and
> makes it possible to customize almost everything in the link.

Thank you.

> which also fail for me on master. There are about 27 commits from this
> branch to master I think. I didn't make patches for all of them yet,
> since that seemed like a bunch of them. This branch doesn't fix anything
> in contrib yet (except the manual).

I'm surprised there are so many of them. Anyway, it would be nice to
display them here, for review.

> I am pretty sure all the previous link behavior has been preserved, and
> a lot of new things are possible with this. Below are some example uses.
> Let me know what you think!
> * Example links 
> ** A basic link
> Predefined links work the same as before.
> A doi:10.1021 link and [[doi:10.1021][bracketed version]].  
> This should look and act like it did before.
> #+BEGIN_SRC emacs-lisp
>   (org-add-link-type
>    "test" nil nil)
> : Created test link.
> A test:link and [[test:link][bracketed form]]     
> ** A colored link with a static tooltip.
> #+BEGIN_SRC emacs-lisp
>   (org-add-link-type
>    "red"
>    ;; follow
>    (lambda (path) (message "You clicked me."))
>    ;; export
>    (lambda (path desc backend)
>      (cond
>       ((eq 'html backend)
>        (format "<font color=\"red\">%s</font>"
>              (or desc path)))))
>    :face '(:foreground "red")
>    :help-echo "Click me for a message.")

Please do not extend `org-add-link-type': you are conflating two ways to
set the same thing. 

It is better to create a new function, e.g., `org-link-add' with the
following signature

  (defun org-link-add (type &rest properties)

used like

  (org-link-add "red" :follow (lambda (path desc backend) ...) :export ....)

and keep `org-add-link-type' as a _deprecated_ function basically
calling the previous one:

  (defun org-add-link-type (type &optional follow export)
   (org-link-add type :follow follow :export export))

Otherwise, it looks good.


Nicolas Goaziou

reply via email to

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