From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: patch for custom colored links in org-mode Date: Sat, 02 Jul 2016 11:46:01 -0400 Message-ID: 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]:59455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJN7T-00013v-Pg for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 11:46:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJN7N-0002k2-Qa for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 11:46:10 -0400 Received: from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]:36857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJN7N-0002jy-LL for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 11:46:05 -0400 Received: by mail-qt0-x231.google.com with SMTP id w59so71095452qtd.3 for ; Sat, 02 Jul 2016 08:46:05 -0700 (PDT) In-reply-to: <87a8i1gd2t.fsf@saiph.selenimh> 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: Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" , Rasmus > > WDYT? > >> Presumably we would then eliminate the "org-%s-complete-link" >> functions? > > Indeed. > > I think it is possible to proceed in four steps. > > 1. First, we create the variable, with appropriate getter, setter and > default values. At this point it is sufficient to > support :follow, :export and :completion properties only. Would it make sense to use a defstruct for the link? 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? E.g. #+BEGIN_SRC emacs-lisp (defstruct org-link follow export completion face display echo) #+END_SRC #+RESULTS: : org-link A getter: #+BEGIN_SRC emacs-lisp (let ((new-link (make-org-link :follow nil :face '(:background "red")))) (org-link-face new-link)) #+END_SRC #+RESULTS: | :background | red | A setter: #+BEGIN_SRC emacs-lisp (let ((new-link (make-org-link :follow nil :face '(:background "red")))) (setf (org-link-face new-link) '(:background "blue")) (org-link-face new-link)) #+END_SRC #+RESULTS: | :background | blue | 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) and I suppose it might be nice to have (org-link--get "type" :follow) instead. WDYT? > 2. Then we get all the code base to extract information about links > through this variable instead of various existing ways, namely, > `org-%s-complete-link', `org-link-protocols' and `org-link-types'. > > 3. Then we extend it with new properties, i.e., :display, :echo > and :face. > > 4. Document the changes in the manual and ORG-NEWS file. > > You have mostly worked out the third part of the process. Do you want to > take a stab at any of the other steps? Or do you prefer me to do some > parts? > > Regards, -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu