summaryrefslogtreecommitdiff
path: root/lisp/progmodes/bug-reference.el
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2010-04-02 13:24:37 -0400
committerSam Steingold <sds@gnu.org>2010-04-02 13:24:37 -0400
commitdbb5e44a980a786d1f581faab81ad7830520a650 (patch)
treef8669121d05326f30d3912f680b2c388a8f9e3ad /lisp/progmodes/bug-reference.el
parent51a91f9da64f25b68a1d3f752df6193c49c9b4fc (diff)
downloademacs-dbb5e44a980a786d1f581faab81ad7830520a650.tar.gz
emacs-dbb5e44a980a786d1f581faab81ad7830520a650.tar.bz2
emacs-dbb5e44a980a786d1f581faab81ad7830520a650.zip
(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
Diffstat (limited to 'lisp/progmodes/bug-reference.el')
-rw-r--r--lisp/progmodes/bug-reference.el27
1 files changed, 23 insertions, 4 deletions
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index d0cc5541b8a..dd1790f9076 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -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