unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: 66752@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
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	[thread overview]
Message-ID: <87o7g9tj79.fsf@gnu.org> (raw)
In-Reply-To: <bdc2bd17-762e-8fff-3723-6a4e2128b6be@gmail.com> (Jim Porter's message of "Wed, 25 Oct 2023 15:33:17 -0700")

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





  parent reply	other threads:[~2023-11-04 19:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 22:33 bug#66752: 30.0.50; [PATCH] Add support for 'thing-at-point' to 'bug-reference-mode' Jim Porter
2023-11-04  8:12 ` Eli Zaretskii
2023-11-04 19:24 ` Tassilo Horn [this message]
2023-11-04 20:07   ` Jim Porter
2023-11-05  5:31     ` Eli Zaretskii
2023-11-05  6:21       ` Jim Porter
2023-11-05 14:19         ` Stefan Kangas
2023-11-05 23:20       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-06  4:55         ` Jim Porter
2023-11-12  5:41           ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7g9tj79.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=66752@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).