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