Subject: Re: bug#66752: 30.0.50; [PATCH] Add support for 'thing-at-point' to 'bug-reference-mode'

From: Tassilo Horn <[email-masked]>
Date: Sat, 04 Nov 2023 20:24:58 +0100

Jim Porter <[email-masked]> writes:

Hi Jim & Eli,

> Currently, "(thing-at-point 'url)" returns nil when point is over a
> bug reference.  It would be nice to return the URL here.

Yes, why not.

> Attached is a patch plus a regression test for this.

The patch and test look good.  One minor nit below.

> +(defun bug-reference--url-at-point ()
> +  (get-char-property (point) 'bug-reference-url))
> +
> +(defun bug-reference--init (enable)
> +  (if enable
> +      (progn
> +        (jit-lock-register #'bug-reference-fontify)
> +        (require 'thingatpt)
> +        (setq-local thing-at-point-provider-alist
> +                    (append thing-at-point-provider-alist
> +                            '((url . bug-reference--url-at-point)))))

Quoting this way would be better:

                               `((url . ,#'bug-reference--url-at-point))

>      (jit-lock-unregister #'bug-reference-fontify)
> +    (setq thing-at-point-provider-alist
> +          (delete '((url . bug-reference--url-at-point))
> +                  thing-at-point-provider-alist))
> +    (when (equal thing-at-point-provider-alist
> +                 (default-value 'thing-at-point-provider-alist))
> +      (kill-local-variable 'thing-at-point-provider-alist))

Is that conventional, nuking a buffer-local value once it's back to its
default value.  Just asking out of curiosity.

Bye,
Tassilo