Subject: bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group

From: Juri Linkov <[email-masked]>
Date: Wed, 12 Sep 2012 23:54:05 +0300

> Well, the use case that motivated my first patch is grabbing a bug
> number in the subject line of a mail or posting, so the distance
> involved is rather small.

Grabbing a bug number in the subject line is a well-defined goal,
but when I tried your latest version of `gnus-get-emacs-bug-number',
it can't get a bug number from the subject line.

> Admittedly, the extension to ChangeLogs could involve several lines
> between point and the bug number, which my patch does not take
> into account.

For ChangeLogs it could look only inside the current entry.

> Well, my second patch assumed my first patch, which changes
> g-r-e-e-b-g's signature, so the bug number isn't passed as an argument.
> However, I agree it is bad to request confirmation on clicking the
> button in this case.  This appears to argue against the change in the
> interactive spec.

Yes, there is no need to change the function signature
and no need to move its interactive spec to the function body.
You could just replace old (thing-at-point 'word)
with a call to a new function `gnus-get-emacs-bug-number'.
Replacing `read-string' with `read-number' in your patch
also makes sense.  But selecting one of several bug numbers
would be easier by supplying a list of bug numbers to `read-number'
and using e.g. `3 M-n' to select one of them (third in this example).

> (defun bug-reference-gnus-read-ephemeral-emacs-bug-group (pos)
>   "Read the bug thread in a Gnus ephemeral group."
>   (dolist (o (overlays-at pos))
>     ;; It should only be possible to have one URL overlay.
>     (let* ((url (overlay-get o 'bug-reference-url))
> 	   (num (when (string-match "http://debbugs\\.gnu\\.org/\\([0-9]+\\)$" url)
                                     ============================
This is a bad thing.  It is not your failure, it is by design of
bug-reference.el that you have to circumvent.  I think that
bug-reference.el should be improved to add a bug number to overlays
where it currently adds a bug URL.