emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link
@ 2020-05-22  0:38 stardiviner
  2020-05-22 15:21 ` Nicolas Goaziou
  2020-12-23  2:48 ` stardiviner
  0 siblings, 2 replies; 6+ messages in thread
From: stardiviner @ 2020-05-22  0:38 UTC (permalink / raw)
  To: Org Mode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


I have following minimal testing code:

#+begin_src emacs-lisp
(defun org-link-beautify (start end path bracketp)
  "Display icon for the Org link type."
  (message
   (format "start: %s, end: %s, path: %s, bracketp: %s" start end path bracketp)))

(dolist (link-type (mapcar 'car org-link-parameters))
    (org-link-set-parameters link-type :activate-func #'org-link-beautify))
#+end_src

The ~message~ does not print parameter values at all. I guess those "customid"
[[#Usage] and "coderef" (coderef) are different with "file:" etc links. Is this
true? Here is my complete source code I want to try fontify customid and coderef
links.

https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L67

Is there any way to fix this problem?

Regards

- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7HHwAUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNAxggAtBoYLo9Gm5dLjVH/9XEqij1GtE0j
bgHF27icJq6p2BawOQx9MPENgFUO7GIYTlSjLTYq2fj9yXKWpqbyswIf6a/jLNGE
gTEktGAGul1/+k0OcAwE1RS1qCbU0t3AeX+LqcqUmSJN4TbfcsHaez+LaomGHSPH
tg5QtRgQNdp40/4Qc5JRc/YyfueN/qdJnsJ7hny63rroT7TWVugIkgSgS9WPtcCY
ss6Yrbz0EBHvb+7lyLDzyJfbn1YwIkYdTQ/tx0ebp/5dTnpH0XD1YDQD12HTvowE
4tWGlwI8YNJkUsp2NjtFfWz+bempl15i7swqgxwvNiETOxTBuuv7Lf7Z2Q==
=kaJV
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link
  2020-05-22  0:38 [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link stardiviner
@ 2020-05-22 15:21 ` Nicolas Goaziou
  2020-05-23  1:16   ` stardiviner
  2020-12-23  2:48 ` stardiviner
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2020-05-22 15:21 UTC (permalink / raw)
  To: stardiviner; +Cc: Org Mode

Hello,

stardiviner <numbchild@gmail.com> writes:

> I have following minimal testing code:
>
> #+begin_src emacs-lisp
> (defun org-link-beautify (start end path bracketp)
>   "Display icon for the Org link type."
>   (message
>    (format "start: %s, end: %s, path: %s, bracketp: %s" start end path bracketp)))
>
> (dolist (link-type (mapcar 'car org-link-parameters))
>     (org-link-set-parameters link-type :activate-func #'org-link-beautify))
> #+end_src
>
> The ~message~ does not print parameter values at all. I guess those "customid"
> [[#Usage] and "coderef" (coderef) are different with "file:" etc links. Is this
> true? Here is my complete source code I want to try fontify customid and coderef
> links.
>
> https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L67
>
> Is there any way to fix this problem?

[[#cusom]], [[*headline]], [[(coderef)]] or, simply [[target]], are
internal links, with a special syntax. In particular, they do not go
through the `org-link-parameters' process.

We could integrate them in that variable, i.e., extract the "follow"
function from `org-link-open', handle completion, storage, with
dedicated functions, etc.

Help welcome.

Meanwhile, your best bet is to defadvice `org-activate-links'.

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link
  2020-05-22 15:21 ` Nicolas Goaziou
@ 2020-05-23  1:16   ` stardiviner
  0 siblings, 0 replies; 6+ messages in thread
From: stardiviner @ 2020-05-23  1:16 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I have following minimal testing code:
>>
>> #+begin_src emacs-lisp
>> (defun org-link-beautify (start end path bracketp)
>>   "Display icon for the Org link type."
>>   (message
>>    (format "start: %s, end: %s, path: %s, bracketp: %s" start end path bracketp)))
>>
>> (dolist (link-type (mapcar 'car org-link-parameters))
>>     (org-link-set-parameters link-type :activate-func #'org-link-beautify))
>> #+end_src
>>
>> The ~message~ does not print parameter values at all. I guess those "customid"
>> [[#Usage] and "coderef" (coderef) are different with "file:" etc links. Is this
>> true? Here is my complete source code I want to try fontify customid and coderef
>> links.
>>
>> https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L67
>>
>> Is there any way to fix this problem?
>
> [[#cusom]], [[*headline]], [[(coderef)]] or, simply [[target]], are
> internal links, with a special syntax. In particular, they do not go
> through the `org-link-parameters' process.
>
> We could integrate them in that variable, i.e., extract the "follow"
> function from `org-link-open', handle completion, storage, with
> dedicated functions, etc.

That's a good solution, will be simple for future links manipulation.

>
> Help welcome.

Sure, anything I can help you can say.

>
> Meanwhile, your best bet is to defadvice `org-activate-links'.

I read the function `org-activate-links' source code, I guess you mean I can
advice on the `properties' let-binding variable. Add `'display' text property,
right? I don't know how to add advice for this functionality. Do you have any
sample code for hinting? I will be much thankful.

Regards,

- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7IeYsUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNjbggAlcDuPz9vXMC62NSZYf0WRIwD0893
UTsRr8sLlVWtIQV7eZ764mDrd7uOwzNnYTcBS2MbopzLs7sBRg4i6hmqKhAJFCYf
RuNJNnWg8oNQhiOTuN7eBRMIIv7k741T5H/8F4MdzX3KvtXhjoNjFm2BUdtwtWLl
UMAbazuRaDtjY3+sPtcGkXk6ZmkNtCh3LoPMYkfeq4dGXWantvlxDO6EYoJI+Klm
mPlqKXRSsVaZLbzxqAuqrQhIZog2gq+0nla2uqKTAocdNtTvWGqtlEbMd5p/BYB3
f/YGeFfJH5FeXIiuxZuFK83sVtpf1H3jtenHWQciuj+sqKgRN9acOi+bdg==
=tMva
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link
  2020-05-22  0:38 [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link stardiviner
  2020-05-22 15:21 ` Nicolas Goaziou
@ 2020-12-23  2:48 ` stardiviner
  2021-01-04 18:20   ` Nicolas Goaziou
  1 sibling, 1 reply; 6+ messages in thread
From: stardiviner @ 2020-12-23  2:48 UTC (permalink / raw)
  To: Org Mode; +Cc: Nicolas Goaziou


Bump this thread, hi, Nicolas, any thoughts or update about this?

stardiviner <numbchild@gmail.com> writes:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> I have following minimal testing code:
>
> #+begin_src emacs-lisp
> (defun org-link-beautify (start end path bracketp)
>   "Display icon for the Org link type."
>   (message
>    (format "start: %s, end: %s, path: %s, bracketp: %s" start end path bracketp)))
>
> (dolist (link-type (mapcar 'car org-link-parameters))
>     (org-link-set-parameters link-type :activate-func #'org-link-beautify))
> #+end_src
>
> The ~message~ does not print parameter values at all. I guess those "customid"
> [[#Usage] and "coderef" (coderef) are different with "file:" etc links. Is this
> true? Here is my complete source code I want to try fontify customid and coderef
> links.
>
> https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L67
>
> Is there any way to fix this problem?
>
> Regards
>
> - -- 
> [ stardiviner ]
>        I try to make every word tell the meaning that I want to express.
>
>        Blog: https://stardiviner.github.io/
>        IRC(freenode): stardiviner, Matrix: stardiviner
>        GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>       
> -----BEGIN PGP SIGNATURE-----
>
> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7HHwAUHG51bWJjaGls
> ZEBnbWFpbC5jb20ACgkQG13xyVromsNAxggAtBoYLo9Gm5dLjVH/9XEqij1GtE0j
> bgHF27icJq6p2BawOQx9MPENgFUO7GIYTlSjLTYq2fj9yXKWpqbyswIf6a/jLNGE
> gTEktGAGul1/+k0OcAwE1RS1qCbU0t3AeX+LqcqUmSJN4TbfcsHaez+LaomGHSPH
> tg5QtRgQNdp40/4Qc5JRc/YyfueN/qdJnsJ7hny63rroT7TWVugIkgSgS9WPtcCY
> ss6Yrbz0EBHvb+7lyLDzyJfbn1YwIkYdTQ/tx0ebp/5dTnpH0XD1YDQD12HTvowE
> 4tWGlwI8YNJkUsp2NjtFfWz+bempl15i7swqgxwvNiETOxTBuuv7Lf7Z2Q==
> =kaJV
> -----END PGP SIGNATURE-----


-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link
  2020-12-23  2:48 ` stardiviner
@ 2021-01-04 18:20   ` Nicolas Goaziou
  2021-01-05  4:37     ` miles christopher
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2021-01-04 18:20 UTC (permalink / raw)
  To: stardiviner; +Cc: Org Mode

Hello,

stardiviner <numbchild@gmail.com> writes:

> Bump this thread, hi, Nicolas, any thoughts or update about this?
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I have following minimal testing code:
>>
>> #+begin_src emacs-lisp
>> (defun org-link-beautify (start end path bracketp)
>>   "Display icon for the Org link type."
>>   (message
>>    (format "start: %s, end: %s, path: %s, bracketp: %s" start end path bracketp)))
>>
>> (dolist (link-type (mapcar 'car org-link-parameters))
>>     (org-link-set-parameters link-type :activate-func #'org-link-beautify))
>> #+end_src
>>
>> The ~message~ does not print parameter values at all. I guess those "customid"
>> [[#Usage] and "coderef" (coderef) are different with "file:" etc links. Is this
>> true? 

That's correct. coderef, customid, and fuzzy links are internal links.
They are not really customizable. They are meant to behave the same in
all Org documents.

>> Here is my complete source code I want to try fontify customid and coderef
>> links.
>>
>> https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L67
>>
>> Is there any way to fix this problem?

Coderef and custom-id links are fontified, so you may still change their
appearance using font-lock configuration variables. Here be dragons.

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link
  2021-01-04 18:20   ` Nicolas Goaziou
@ 2021-01-05  4:37     ` miles christopher
  0 siblings, 0 replies; 6+ messages in thread
From: miles christopher @ 2021-01-05  4:37 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> Bump this thread, hi, Nicolas, any thoughts or update about this?
>>
>> stardiviner <numbchild@gmail.com> writes:
>>
>>> I have following minimal testing code:
>>>
>>> #+begin_src emacs-lisp
>>> (defun org-link-beautify (start end path bracketp)
>>>   "Display icon for the Org link type."
>>>   (message
>>>    (format "start: %s, end: %s, path: %s, bracketp: %s" start end path bracketp)))
>>>
>>> (dolist (link-type (mapcar 'car org-link-parameters))
>>>     (org-link-set-parameters link-type :activate-func #'org-link-beautify))
>>> #+end_src
>>>
>>> The ~message~ does not print parameter values at all. I guess those "customid"
>>> [[#Usage] and "coderef" (coderef) are different with "file:" etc links. Is this
>>> true? 
>
> That's correct. coderef, customid, and fuzzy links are internal links.
> They are not really customizable. They are meant to behave the same in
> all Org documents.
>
>>> Here is my complete source code I want to try fontify customid and coderef
>>> links.
>>>
>>> https://github.com/stardiviner/org-link-beautify/blob/master/org-link-beautify.el#L67
>>>
>>> Is there any way to fix this problem?
>
> Coderef and custom-id links are fontified, so you may still change their
> appearance using font-lock configuration variables. Here be dragons.
>
> Regards,

I see, I searched some font-lock example code, but have not found any example
about font-lock + text-property. (Maybe my searching words is not good
enough...) How to write it? Do you got any hints? Thanks for your helping.

By the way I got an issue that org-link-beautify conflict with yasnippet[fn:1].
I know the key point is how Org Mode fontify the link. I tried to read code, but
have not found hint about how to disable fontify on link temporary. Can you give
some suggestion about this problem? Thanks too.

[fn:1] https://github.com/stardiviner/org-link-beautify/issues/5

Regards,

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-05  4:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  0:38 [QUESTION] Org "customid" and "coderef" links seems not fontified as other file: link stardiviner
2020-05-22 15:21 ` Nicolas Goaziou
2020-05-23  1:16   ` stardiviner
2020-12-23  2:48 ` stardiviner
2021-01-04 18:20   ` Nicolas Goaziou
2021-01-05  4:37     ` miles christopher

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