[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: John Kitchin
Subject: Re: [O] patch for custom colored links in org-mode
Date: Sat, 02 Jul 2016 11:46:01 -0400
User-agent: mu4e 0.9.16; emacs

>> 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?


#+BEGIN_SRC emacs-lisp
(defstruct org-link  follow export completion face display echo)

: org-link

A getter:

#+BEGIN_SRC emacs-lisp
(let ((new-link (make-org-link :follow nil :face '(:background "red"))))
  (org-link-face new-link))

| :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))

| :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.


> 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

reply via email to

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