aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/bug-reference.el
diff options
context:
space:
mode:
authorGlenn Morris <[email protected]>2008-06-21 20:13:48 +0000
committerGlenn Morris <[email protected]>2008-06-21 20:13:48 +0000
commitbffc65597f583fe83f4097a477589cbd894d045d (patch)
tree4ff203174623863f2edc222f1af7d0e5dc25e047 /lisp/progmodes/bug-reference.el
parenta86a16098e5d2b6cbd9ed16dba9c19267d690dea (diff)
(bug-reference-map): Bind down-mouse-1 rather than mouse-1.
(bug-reference-url-format): Autoload safe if string. (bug-reference-bug-regexp): Make space after "bug" optional. (bug-reference-fontify): Save match data.
Diffstat (limited to 'lisp/progmodes/bug-reference.el')
-rw-r--r--lisp/progmodes/bug-reference.el30
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 1e2f22b148..d98604a2af 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -32,7 +32,7 @@
(defvar bug-reference-map
(let ((map (make-sparse-keymap)))
- (define-key map [mouse-1] 'bug-reference-push-button)
+ (define-key map [down-mouse-1] 'bug-reference-push-button)
(define-key map (kbd "C-c RET") 'bug-reference-push-button)
map)
"Keymap used by bug reference buttons.")
@@ -43,8 +43,11 @@
The bug number is supplied as a string, so this should have a single %s.
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 ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
"Regular expression which matches bug references.")
(defun bug-reference-set-overlay-properties ()
@@ -74,17 +77,18 @@ There is no default setting for this, it must be set per file.")
;; Remove old overlays.
(bug-reference-unfontify beg-line end-line)
(goto-char beg-line)
- (while (and (< (point) end-line)
- (re-search-forward bug-reference-bug-regexp end-line 'move))
- (when (or (not bug-reference-prog-mode)
- ;; This tests for both comment and string syntax.
- (nth 8 (syntax-ppss)))
- (let ((overlay (make-overlay (match-beginning 0) (match-end 0)
- nil t nil)))
- (overlay-put overlay 'category 'bug-reference)
- (overlay-put overlay 'bug-reference-url
- (format bug-reference-url-format
- (match-string-no-properties 1)))))))))
+ (save-match-data
+ (while (and (< (point) end-line)
+ (re-search-forward bug-reference-bug-regexp end-line 'move))
+ (when (or (not bug-reference-prog-mode)
+ ;; This tests for both comment and string syntax.
+ (nth 8 (syntax-ppss)))
+ (let ((overlay (make-overlay (match-beginning 0) (match-end 0)
+ nil t nil)))
+ (overlay-put overlay 'category 'bug-reference)
+ (overlay-put overlay 'bug-reference-url
+ (format bug-reference-url-format
+ (match-string-no-properties 1))))))))))
;; Taken from button.el.
(defun bug-reference-push-button (&optional pos use-mouse-action)