[Top][All Lists]

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

Re: [O] patch for custom colored links in org-mode

From: Nicolas Goaziou
Subject: Re: [O] patch for custom colored links in org-mode
Date: Sun, 03 Jul 2016 00:17:37 +0200


John Kitchin <address@hidden> 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.


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

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.


Nicolas Goaziou

reply via email to

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