[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66752: 30.0.50; [PATCH] Add support for 'thing-at-point' to 'bug-ref
From: |
Tassilo Horn |
Subject: |
bug#66752: 30.0.50; [PATCH] Add support for 'thing-at-point' to 'bug-reference-mode' |
Date: |
Sat, 04 Nov 2023 20:24:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Jim Porter <jporterbugs@gmail.com> 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