(bug-reference-bug-regexp): Also accept "patch" and "RFE".
(bug-reference-fontify): `bug-reference-url-format' can also be a function to be able to handle the bug kind. (turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode): Add
This commit is contained in:
parent
51a91f9da6
commit
dbb5e44a98
2 changed files with 29 additions and 4 deletions
|
|
@ -3,6 +3,12 @@
|
|||
* vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
|
||||
`vc-hg-command' with a list of flags.
|
||||
|
||||
* progmodes/bug-reference.el (bug-reference-bug-regexp): Also
|
||||
accept "patch" and "RFE".
|
||||
(bug-reference-fontify): `bug-reference-url-format' can also be a
|
||||
function to be able to handle the bug kind.
|
||||
(turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode): Add
|
||||
|
||||
2010-04-02 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* tmm.el (tmm-get-keymap): Check with symbolp before passing
|
||||
|
|
|
|||
|
|
@ -41,13 +41,20 @@
|
|||
(defvar bug-reference-url-format nil
|
||||
"Format used to turn a bug number into a URL.
|
||||
The bug number is supplied as a string, so this should have a single %s.
|
||||
This can also be a function designator; it is called without arguments
|
||||
and should return a string.
|
||||
It can use `match-string' to get parts matched against
|
||||
`bug-reference-bug-regexp', specifically:
|
||||
1. issue kind (bug, patch, rfe &c)
|
||||
2. issue number.
|
||||
|
||||
There is no default setting for this, it must be set per file.")
|
||||
|
||||
;;;###autoload
|
||||
(put 'bug-reference-url-format 'safe-local-variable 'stringp)
|
||||
|
||||
(defconst bug-reference-bug-regexp
|
||||
"\\(?:[Bb]ug ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
|
||||
"\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
|
||||
"Regular expression which matches bug references.")
|
||||
|
||||
(defun bug-reference-set-overlay-properties ()
|
||||
|
|
@ -87,9 +94,11 @@ There is no default setting for this, it must be set per file.")
|
|||
(overlay-put overlay 'category 'bug-reference)
|
||||
;; Don't put a link if format is undefined
|
||||
(when bug-reference-url-format
|
||||
(overlay-put overlay 'bug-reference-url
|
||||
(format bug-reference-url-format
|
||||
(match-string-no-properties 1))))))))))
|
||||
(overlay-put overlay 'bug-reference-url
|
||||
(if (stringp bug-reference-url-format)
|
||||
(format bug-reference-url-format
|
||||
(match-string-no-properties 2))
|
||||
(funcall bug-reference-url-format))))))))))
|
||||
|
||||
;; Taken from button.el.
|
||||
(defun bug-reference-push-button (&optional pos use-mouse-action)
|
||||
|
|
@ -121,6 +130,11 @@ There is no default setting for this, it must be set per file.")
|
|||
(widen)
|
||||
(bug-reference-unfontify (point-min) (point-max)))))
|
||||
|
||||
(defun turn-on-bug-reference-mode ()
|
||||
"Unconditionally turn bug reference mode on."
|
||||
(unless bug-reference-mode
|
||||
(bug-reference-mode)))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode bug-reference-prog-mode
|
||||
"Like `bug-reference-mode', but only buttonize in comments and strings."
|
||||
|
|
@ -134,5 +148,10 @@ There is no default setting for this, it must be set per file.")
|
|||
(widen)
|
||||
(bug-reference-unfontify (point-min) (point-max)))))
|
||||
|
||||
(defun turn-on-bug-reference-prog-mode ()
|
||||
"Unconditionally turn bug reference prog mode on."
|
||||
(unless bug-reference-prog-mode
|
||||
(bug-reference-prog-mode)))
|
||||
|
||||
;; arch-tag: b138abce-e5c3-475e-bd58-7afba40387ea
|
||||
;;; bug-reference.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue