From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: org mode <emacs-orgmode@gnu.org>
Subject: Re: patch for custom colored links in org-mode
Date: Thu, 30 Jun 2016 13:44:26 -0400 [thread overview]
Message-ID: <m27fd6mv0l.fsf@Johns-MacBook-Air.local> (raw)
In-Reply-To: <87twga28j8.fsf@saiph.selenimh>
[-- Attachment #1: Type: text/plain, Size: 738 bytes --]
I think I have attached the right patch that does this.
Let me know what you think.
Nicolas Goaziou writes:
> Hello,
>
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> I took a stab at this implementation here:
>>
>> https://github.com/jkitchin/org-mode/compare/master...colored-link-2?expand=1
>
> Thank you.
>
> Could you send the patch on the ML instead? It is better for commenting
> and archiving. Also make sure to patch against master branch (e.g.
> `org-match-string-no-properties' -> 'match-string-no-properties').
>
>
> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: colored-link.patch --]
[-- Type: text/x-patch, Size: 2929 bytes --]
diff --git a/lisp/org.el b/lisp/org.el
index 89b72bc..48b6748 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1867,6 +1867,18 @@ return the description to use."
:tag "Org Store Link"
:group 'org-link)
+(defcustom org-link-display-parameters nil
+ "An alist of properties to display a link with.
+The first element in each list is a string of the link
+type. Subsequent optional elements make up a p-list. :face can be
+used to change the face on the link (the default is
+`org-link'. If :display is 'full the full link will show in
+descriptive link mode."
+ :type '(alist :tag "Link display paramters"
+ :key-type 'string
+ :value-type '(plist))
+ :group 'org-link)
+
(defcustom org-url-hexify-p t
"When non-nil, hexify URL when creating a link."
:type 'boolean
@@ -5864,14 +5876,19 @@ prompted for."
"Add link properties for plain links."
(when (and (re-search-forward org-plain-link-re limit t)
(not (org-in-src-block-p)))
+
(let ((face (get-text-property (max (1- (match-beginning 0)) (point-min))
'face))
- (link (match-string-no-properties 0)))
+ (link (match-string-no-properties 0))
+ (type (match-string-no-properties 1)))
(unless (if (consp face) (memq 'org-tag face) (eq 'org-tag face))
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
(add-text-properties (match-beginning 0) (match-end 0)
(list 'mouse-face 'highlight
- 'face 'org-link
+ 'face (or (plist-get
+ (cdr (assoc type org-link-display-parameters))
+ :face)
+ 'org-link)
'htmlize-link `(:uri ,link)
'keymap org-mouse-map))
(org-rear-nonsticky-at (match-end 0))
@@ -6065,7 +6082,10 @@ by a #."
(not (org-in-src-block-p)))
(let* ((hl (match-string-no-properties 1))
(help (concat "LINK: " (save-match-data (org-link-unescape hl))))
- (ip (list 'invisible 'org-link
+ (ip (list 'invisible (or (plist-get
+ (cdr (assoc type org-link-display-parameters))
+ :display)
+ 'org-link)
'keymap org-mouse-map 'mouse-face 'highlight
'font-lock-multiline t 'help-echo help
'htmlize-link `(:uri ,hl)))
@@ -6362,8 +6382,8 @@ needs to be inserted at a specific position in the font-lock sequence.")
;; Links
(when (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
(when (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
- (when (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
- (when (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
+ (when (memq 'plain lk) '(org-activate-plain-links (0 'org-link)))
+ (when (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link)))
(when (memq 'radio lk) '(org-activate-target-links (1 'org-link t)))
(when (memq 'date lk) '(org-activate-dates (0 'org-date t)))
(when (memq 'footnote lk) '(org-activate-footnote-links))
next prev parent reply other threads:[~2016-06-30 17:44 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
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 [this message]
-- 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=m27fd6mv0l.fsf@Johns-MacBook-Air.local \
--to=jkitchin@andrew.cmu.edu \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/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).