From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: patch for custom colored links in org-mode Date: Sun, 03 Jul 2016 00:17:37 +0200 Message-ID: <871t3bhegu.fsf@saiph.selenimh> References: <87twgdxtfm.fsf@saiph.selenimh> <87lh1pazj9.fsf@gmx.us> <877fd9xecw.fsf@saiph.selenimh> <87eg7dikr9.fsf@saiph.selenimh> <87a8i1gd2t.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJTET-0004Yq-S9 for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 18:17:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJTEQ-0007Dn-Jq for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 18:17:49 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:48433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJTEQ-0007DG-CY for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 18:17:46 -0400 In-Reply-To: (John Kitchin's message of "Sat, 02 Jul 2016 11:46:01 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: "emacs-orgmode@gnu.org" , Rasmus Hello, John Kitchin 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