[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emac
From: |
Stephen Berman |
Subject: |
bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group |
Date: |
Mon, 10 Sep 2012 23:02:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
I discovered that the definition of gnus-get-emacs-bug-number in my
patch was deficient, so, in hopes that this feature may still make it
into Emacs, here is an improved definition (though the bit about bug
number 0 is probably dispensible). I'll be happy to provide an updated
patch if desired.
Steve Berman
(defun gnus-get-emacs-bug-number (&optional n)
"Return an Emacs bug number in this line, if any.
If point is on a recognizable bug number, return it; otherwise,
if argument N is a positive integer, return the Nth bug number in
this line, counting from the left, or nil if there is no Nth bug
number."
(save-excursion
;; Get the number if point is anywhere within a string like "bug#1234", or
;; similar strings with a capital "B" or with a space before or after "#",
;; or without "#", as well as strings like
;; "http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1234".
(when (or (eq (char-after) ?#) (eq (char-before) ?#)
(string= (thing-at-point 'word) "Bug")
(string= (thing-at-point 'word) "bug"))
(forward-word)
(skip-chars-forward " #="))
(let* ((str (thing-at-point 'word))
(num (if str (string-to-number str)))
(case-fold-search t))
(if (and num
;; If bug number 0 is allowed (though it isn't in the Emacs
;; bugtracker), it requires special handling, since
;; string-to-number also returns 0 if str is alphabetical.
(or (string= "0" str) (not (zerop num)))
;; Make sure this is a bug number, not just any number.
(beginning-of-thing 'word) (looking-back "bug ?[#=]? ?"))
num
;; Otherwise look for the Nth bug number on this line.
(goto-char (line-beginning-position))
(when (re-search-forward "bug ?[#=]? ?\\([0-9]+\\)"
(line-end-position) t n)
(string-to-number (match-string 1)))))))
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Stephen Berman, 2012/09/09
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Lars Ingebrigtsen, 2012/09/09
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Stephen Berman, 2012/09/09
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group,
Stephen Berman <=
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Juri Linkov, 2012/09/11
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Stephen Berman, 2012/09/11
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Juri Linkov, 2012/09/12
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Stephen Berman, 2012/09/13
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Juri Linkov, 2012/09/13
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Stephen Berman, 2012/09/14
- bug#12396: 24.2.50; [PATCH] extend usability of gnus-read-ephemeral-emacs-bug-group, Juri Linkov, 2012/09/14