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>, Rasmus <rasmus@gmx.us>
Subject: Re: patch for custom colored links in org-mode
Date: Sun, 03 Jul 2016 00:17:37 +0200	[thread overview]
Message-ID: <871t3bhegu.fsf@saiph.selenimh> (raw)
In-Reply-To: <m2lh1k82me.fsf@Johns-MacBook-Air.local> (John Kitchin's message of "Sat, 02 Jul 2016 11:46:01 -0400")

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> Would it make sense to use a defstruct for the link?

I thought about that. Unfortunately, defstructs are not customize
friendly. If we are going to give direct access to
`org-link-parameters', i.e., make it a defcustom, this is not an option.

> Then we get getters and setters automatically. We would still use an
> a-list of ("type" org-link-struct). I see defstruct is an alias for
> cl-defstruct, does that have Emacs version implications?

Org 9.0 minimal requirement is Emacs 24.3, so "cl-lib" is fine.

> To get the follow property on a link it would look like:
>
> (org-link-follow (cdr (assoc "type" org-link-parameters)))
>
> It isn't that different from this:
>
> (plist-get (cdr (assoc "type" org-link-parameters)) :follow)

This is not very different, but the value you are manipulating is
slightly more opaque in the first case.

> and I suppose it might be nice to have
>
> (org-link--get "type" :follow) instead.

`org-link-get-parameter' and `org-link-set-parameter', or some such. We
should make them public.

> WDYT?

As I said above, if `org-link-parameters' is a defcustom, we need to use
a plist. This is, however, not mandatory.

Indeed, we can also treat `org-link--parameters' as an internal variable
and force users, and libraries, to manipulate these parameters only
through a set of functions (e.g., `org-link-get-parameter',
`org-link-set-parameter', `org-link-add-parameters' and
`org-link-show-parameters').

Nevertheless, I tend to think the former is clearer for users, simply
because plists are simpler to grasp than structs. OTOH, /you/ are
customizing links and I'm not, so your opinion on the subject is
probably more accurate.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-07-02 22:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-26 13:35 patch for custom colored links in org-mode John Kitchin
2016-06-27 12:52 ` Christian Wittern
2016-06-28 14:46 ` Nicolas Goaziou
2016-06-28 18:34   ` Thomas S. Dye
2016-06-28 19:23   ` Rasmus
2016-06-28 20:11     ` Nicolas Goaziou
2016-06-28 20:27       ` Rasmus
2016-06-28 20:44         ` John Kitchin
2016-07-01 23:23         ` Nicolas Goaziou
2016-07-06 11:25           ` Rasmus
2016-06-28 20:42       ` John Kitchin
2016-07-01 12:51         ` Nicolas Goaziou
2016-07-01 17:20           ` John Kitchin
2016-07-01 23:20             ` Nicolas Goaziou
2016-07-02 15:46               ` John Kitchin
2016-07-02 22:17                 ` Nicolas Goaziou [this message]
2016-07-03 20:57               ` John Kitchin
2016-06-29  0:44   ` John Kitchin
2016-06-30 11:58     ` Nicolas Goaziou
2016-06-30 17:44       ` John Kitchin
  -- strict thread matches above, loose matches on Subject: below --
2016-07-02  0:51 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=871t3bhegu.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=rasmus@gmx.us \
    /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).