* set different colors for different link types
@ 2011-04-29 8:42 Christian Wittern
2011-04-29 15:18 ` Michael Brand
0 siblings, 1 reply; 4+ messages in thread
From: Christian Wittern @ 2011-04-29 8:42 UTC (permalink / raw)
To: Org Mode Mailing List
Hi there,
In the archives, I have seen on and off references to a new, extensible
syntax that would go beyond /italic/, *bold* and =code=, but I have seen no
traces of seeing it implemented.
For the time being, therefore I am settling on having different linktypes
coming up in different colors, which I hope is doable, but again, I found no
immediate solution. I wonder if somebody has an idea of how to go about
this. What I would like to see is that, for example:
[[file://path/to/my file][myfile]] comes out visibly different from
[[http://www.example.com/path/to/my file][myfile]] , for example the one in
red, the other in blue.
Any help appreciated,
Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set different colors for different link types
2011-04-29 8:42 set different colors for different link types Christian Wittern
@ 2011-04-29 15:18 ` Michael Brand
2011-04-29 23:40 ` Christian Wittern
0 siblings, 1 reply; 4+ messages in thread
From: Michael Brand @ 2011-04-29 15:18 UTC (permalink / raw)
To: Christian Wittern; +Cc: Org Mode Mailing List
For links with a description I always just repeat the protocol tag
there manually:
[[file://path/to/my file][file: myfile]]
[[http://www.example.com/path/to/my file][http: myfile]]
Together with the space after the colon this shows, also immediately,
if you look only at the link description or at the link itself:
[[file://path/to/my file]]
[[http://www.example.com/path/to/my file]]
This color-independent solution works even if colors would not be
available occasionally like with some terminal configs.
Michael
2011/4/29 Christian Wittern <cwittern@gmail.com>:
> In the archives, I have seen on and off references to a new, extensible
> syntax that would go beyond /italic/, *bold* and =code=, but I have seen no
> traces of seeing it implemented.
>
> For the time being, therefore I am settling on having different linktypes
> coming up in different colors, which I hope is doable, but again, I found no
> immediate solution. I wonder if somebody has an idea of how to go about
> this. What I would like to see is that, for example:
>
> [[file://path/to/my file][myfile]] comes out visibly different from
> [[http://www.example.com/path/to/my file][myfile]] , for example the one in
> red, the other in blue.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set different colors for different link types
2011-04-29 15:18 ` Michael Brand
@ 2011-04-29 23:40 ` Christian Wittern
2011-04-30 4:25 ` Jambunathan K
0 siblings, 1 reply; 4+ messages in thread
From: Christian Wittern @ 2011-04-29 23:40 UTC (permalink / raw)
To: Michael Brand; +Cc: Org Mode Mailing List
Hi Michael,
Thank you for your suggestion. However, I would prefer not to clutter the
text with repeating the protocol there. Also, the example I gave is mainly
for illustration, in the way I use it, the description would not show the
filename, but some other text.
Chris
On 2011-04-30 00:18, Michael Brand wrote:
> For links with a description I always just repeat the protocol tag
> there manually:
> [[file://path/to/my file][file: myfile]]
> [[http://www.example.com/path/to/my file][http: myfile]]
>
> Together with the space after the colon this shows, also immediately,
> if you look only at the link description or at the link itself:
> [[file://path/to/my file]]
> [[http://www.example.com/path/to/my file]]
>
> This color-independent solution works even if colors would not be
> available occasionally like with some terminal configs.
>
> Michael
>
> 2011/4/29 Christian Wittern<cwittern@gmail.com>:
>> In the archives, I have seen on and off references to a new, extensible
>> syntax that would go beyond /italic/, *bold* and =code=, but I have seen no
>> traces of seeing it implemented.
>>
>> For the time being, therefore I am settling on having different linktypes
>> coming up in different colors, which I hope is doable, but again, I found no
>> immediate solution. I wonder if somebody has an idea of how to go about
>> this. What I would like to see is that, for example:
>>
>> [[file://path/to/my file][myfile]] comes out visibly different from
>> [[http://www.example.com/path/to/my file][myfile]] , for example the one in
>> red, the other in blue.
--
Christian Wittern
Institute for Research in Humanities, Kyoto University
47 Higashiogura-cho, Kitashirakawa, Sakyo-ku, Kyoto 606-8265, JAPAN
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set different colors for different link types
2011-04-29 23:40 ` Christian Wittern
@ 2011-04-30 4:25 ` Jambunathan K
0 siblings, 0 replies; 4+ messages in thread
From: Jambunathan K @ 2011-04-30 4:25 UTC (permalink / raw)
To: Christian Wittern; +Cc: Org Mode Mailing List
> Hi Michael,
>
> Thank you for your suggestion. However, I would prefer not to clutter
> the text with repeating the protocol there. Also, the example I gave
> is mainly for illustration, in the way I use it, the description would
> not show the filename, but some other text.
>
> Chris
>
> On 2011-04-30 00:18, Michael Brand wrote:
>> For links with a description I always just repeat the protocol tag
>> there manually:
>> [[file://path/to/my file][file: myfile]]
>> [[http://www.example.com/path/to/my file][http: myfile]]
>>
>> Together with the space after the colon this shows, also immediately,
>> if you look only at the link description or at the link itself:
>> [[file://path/to/my file]]
>> [[http://www.example.com/path/to/my file]]
>>
>> This color-independent solution works even if colors would not be
>> available occasionally like with some terminal configs.
>>
>> Michael
>>
>> 2011/4/29 Christian Wittern<cwittern@gmail.com>:
>>> In the archives, I have seen on and off references to a new, extensible
>>> syntax that would go beyond /italic/, *bold* and =code=, but I have seen no
>>> traces of seeing it implemented.
>>>
>>> For the time being, therefore I am settling on having different linktypes
>>> coming up in different colors, which I hope is doable, but again, I found no
>>> immediate solution. I wonder if somebody has an idea of how to go about
>>> this. What I would like to see is that, for example:
>>>
>>> [[file://path/to/my file][myfile]] comes out visibly different from
>>> [[http://www.example.com/path/to/my file][myfile]] , for example the one in
>>> red, the other in blue.
The easiest way to figure out the protocol is to "pretend" that you are
editing the link and thereby have the curtain raised a bit to reveal the
backstage. Do a C-c C-l or M-x org-insert-link RET (with cursor right
over the link) followed by 'C-g'ing.
If you are willing to hack something together, here is a possible entry
points for attack. With M-x highlight-regexp you could add persistent
regexp patterns for fontification.
1. Do a M-x describe-text-properties RET on a link to see what is under
the hood.
For example in one of my links I see
--8<---------------cut here---------------start------------->8---
Text content at position 509:
There are text properties here:
face org-link
font-lock-multiline t
fontified t
help-echo "LINK: file:src/org-jambu/lisp/org-odt.el"
keymap [Show]
mouse-face highlight
org-no-flyspell t
--8<---------------cut here---------------end--------------->8---
2. Start with org-descriptive-links set to nil (makes all components of
link visible)
3. Start with org-bracket-link-analytic-regexp as a starting regexp
which needs to be fine grained into say web urls, file urls etc etc
4. See org-activate-bracket-links for ideas on how org accomplishes
highlighting correctly.
C-h hi-lock-mode
C-h f highlight-regexp
C-h v hi-lock-file-patterns-policy
C-h v org-descriptive-links
C-h v org-angle-link-re
C-h v org-bracket-link-regexp
C-h v org-bracket-link-analytic-regexp
C-h f org-activate- <TAB> (look for functions like
org-activate-bracket-links etc)
Jambunathan K.
--
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-30 4:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29 8:42 set different colors for different link types Christian Wittern
2011-04-29 15:18 ` Michael Brand
2011-04-29 23:40 ` Christian Wittern
2011-04-30 4:25 ` Jambunathan K
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).