emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Draft of links-9.0
Date: Tue, 05 Jul 2016 21:12:38 +0200	[thread overview]
Message-ID: <87a8hvgaqh.fsf@saiph.selenimh> (raw)
In-Reply-To: <m237nof8b7.fsf@Johns-MacBook-Air.local> (John Kitchin's message of "Tue, 05 Jul 2016 10:50:20 -0400")

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> 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)
> #+END_SRC
>
> #+RESULTS:
> : 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.")
> #+END_SRC

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.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-07-05 19:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 14:50 Draft of links-9.0 John Kitchin
2016-07-05 19:12 ` Nicolas Goaziou [this message]
2016-07-05 19:42   ` Nicolas Goaziou
2016-07-05 20:30   ` John Kitchin
2016-07-05 21:56     ` Nicolas Goaziou
2016-07-06  1:49       ` John Kitchin

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=87a8hvgaqh.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /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).