Org-mode mailing list
 help / color / mirror / Atom feed
* Can no longer org-set-link-parameters with "fuzzy" link types
@ 2021-02-25  4:00 Adam Sneller
  2021-04-06  0:54 ` Kyle Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Sneller @ 2021-02-25  4:00 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

I have a function that searches for broken fuzzy links in org-mode and applies org-warning face to anything it finds:

(org-link-set-parameters
"fuzzy"
:face (lambda (path)
(let ((org-link-search-inhibit-query t))
(if (condition-case nil
(save-excursion
(save-match-data
(org-link-search path (point) t)))
(error nil))
'org-link 'org-warning))))

In 9.4.4 this patch breaks this:

https://code.orgmode.org/bzg/org-mode/commit/8c4e270df280a08b7e61295712c86246088146ba

Is there some other recommended way to get this done as of 9.4.4?

Thanks,

Adam Sneller – CCO
MS2 Digital
20 Old Bailey, St Paul's, ​London EC4M 7AN
​adam.sneller@ms2.digital
office: 020 3988 6800
direct: 020 3988 6809
The information in this e-mail and any documents and files transmitted with it are confidential and for the use of the intended recipient only. If you are not the intended recipient, please delete the message and any attachments immediately and notify the sender. Although MS2 Group Limited believes this e-mail and any attachments are free of any virus or other defect which may affect a computer, it is the responsibility of the recipient to ensure that it is virus free and MS2 Group Limited does not accept any responsibility for any loss or damage arising from its use. MS2 Group Limited is registered in England and Wales, company number 10410414. Registered office: 27 Old Gloucester Street, London WC1N 3AX. 'MS2 Digital' is the trading name of MS2 Group Limited.
​
​© 2020 MS2 Group Limited

[-- Attachment #2: Type: text/html, Size: 6615 bytes --]

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

* Re: Can no longer org-set-link-parameters with "fuzzy" link types
  2021-02-25  4:00 Can no longer org-set-link-parameters with "fuzzy" link types Adam Sneller
@ 2021-04-06  0:54 ` Kyle Meyer
  2021-04-06 12:06   ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2021-04-06  0:54 UTC (permalink / raw)
  To: Adam Sneller; +Cc: emacs-orgmode

[ Sorry for the slow response. ]

Adam Sneller writes:

> I have a function that searches for broken fuzzy links in org-mode and
> applies org-warning face to anything it finds:
>
> (org-link-set-parameters
> "fuzzy"
> :face (lambda (path)
> (let ((org-link-search-inhibit-query t))
> (if (condition-case nil
> (save-excursion
> (save-match-data
> (org-link-search path (point) t)))
> (error nil))
> 'org-link 'org-warning))))
>
> In 9.4.4 this patch breaks this:
>
> https://code.orgmode.org/bzg/org-mode/commit/8c4e270df280a08b7e61295712c86246088146ba
>
> Is there some other recommended way to get this done as of 9.4.4?

I don't know enough about the change to say whether this is recommended,
but it looks like you could get the behavior you're after with something
like

  (add-to-list 'org-link-parameters
               '("fuzzy" :face (lambda (path) ...)))


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

* Re: Can no longer org-set-link-parameters with "fuzzy" link types
  2021-04-06  0:54 ` Kyle Meyer
@ 2021-04-06 12:06   ` Nicolas Goaziou
  2021-04-06 12:20     ` Adam Sneller
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2021-04-06 12:06 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Adam Sneller, emacs-orgmode

Hello,

Kyle Meyer <kyle@kyleam.com> writes:

> [ Sorry for the slow response. ]
>
> Adam Sneller writes:
>
>> I have a function that searches for broken fuzzy links in org-mode and
>> applies org-warning face to anything it finds:
>>
>> (org-link-set-parameters
>> "fuzzy"
>> :face (lambda (path)
>> (let ((org-link-search-inhibit-query t))
>> (if (condition-case nil
>> (save-excursion
>> (save-match-data
>> (org-link-search path (point) t)))
>> (error nil))
>> 'org-link 'org-warning))))
>>
>> In 9.4.4 this patch breaks this:
>>
>> https://code.orgmode.org/bzg/org-mode/commit/8c4e270df280a08b7e61295712c86246088146ba
>>
>> Is there some other recommended way to get this done as of 9.4.4?
>
> I don't know enough about the change to say whether this is recommended,
> but it looks like you could get the behavior you're after with something
> like
>
>   (add-to-list 'org-link-parameters
>                '("fuzzy" :face (lambda (path) ...)))

Link parameters are meant to be used with "scheme:path" links. However,
we forbid internal link types, as writing [[fuzzy:whatever]] would be
confusing for Org. As a consequence, link parameters are not meant to
control internal links.

We might need a different variable specific to internal links, but in
the current case, using `font-lock-add-keywords' should be sufficient.

Regards,
-- 
Nicolas Goaziou


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

* Re: Can no longer org-set-link-parameters with "fuzzy" link types
  2021-04-06 12:06   ` Nicolas Goaziou
@ 2021-04-06 12:20     ` Adam Sneller
  2021-04-07 17:42       ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Sneller @ 2021-04-06 12:20 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Kyle Meyer, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1686 bytes --]

Thank you both for the replies!

Nicholas - can you recommend how to best implement this with font-lock-add-keywords?

Best regards,

-Adam

> On 6 Apr 2021, at 13:06, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> Kyle Meyer <kyle@kyleam.com> writes:
>
>> [ Sorry for the slow response. ]
>>
>> Adam Sneller writes:
>>
>>> I have a function that searches for broken fuzzy links in org-mode and
>>> applies org-warning face to anything it finds:
>>>
>>> (org-link-set-parameters
>>> "fuzzy"
>>> :face (lambda (path)
>>> (let ((org-link-search-inhibit-query t))
>>> (if (condition-case nil
>>> (save-excursion
>>> (save-match-data
>>> (org-link-search path (point) t)))
>>> (error nil))
>>> 'org-link 'org-warning))))
>>>
>>> In 9.4.4 this patch breaks this:
>>>
>>> https://code.orgmode.org/bzg/org-mode/commit/8c4e270df280a08b7e61295712c86246088146ba
>>>
>>> Is there some other recommended way to get this done as of 9.4.4?
>>
>> I don't know enough about the change to say whether this is recommended,
>> but it looks like you could get the behavior you're after with something
>> like
>>
>>  (add-to-list 'org-link-parameters
>>               '("fuzzy" :face (lambda (path) ...)))
>
> Link parameters are meant to be used with "scheme:path" links. However,
> we forbid internal link types, as writing [[fuzzy:whatever]] would be
> confusing for Org. As a consequence, link parameters are not meant to
> control internal links.
>
> We might need a different variable specific to internal links, but in
> the current case, using `font-lock-add-keywords' should be sufficient.
>
> Regards,
> --
> Nicolas Goaziou

[-- Attachment #1.2: Type: text/html, Size: 2015 bytes --]

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

* Re: Can no longer org-set-link-parameters with "fuzzy" link types
  2021-04-06 12:20     ` Adam Sneller
@ 2021-04-07 17:42       ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2021-04-07 17:42 UTC (permalink / raw)
  To: Adam Sneller; +Cc: Kyle Meyer, emacs-orgmode

Hello,

Adam Sneller <adam@earth2adam.com> writes:

> Nicholas - can you recommend how to best implement this with
> font-lock-add-keywords?

I think you can add a function as a matcher. The function could probably
be what you wrote already.

See `org-set-font-lock-defaults' for examples.

Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2021-04-07 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-25  4:00 Can no longer org-set-link-parameters with "fuzzy" link types Adam Sneller
2021-04-06  0:54 ` Kyle Meyer
2021-04-06 12:06   ` Nicolas Goaziou
2021-04-06 12:20     ` Adam Sneller
2021-04-07 17:42       ` Nicolas Goaziou

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git