aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-06-21 20:13:48 +0000
committerGlenn Morris2008-06-21 20:13:48 +0000
commitbffc65597f583fe83f4097a477589cbd894d045d (patch)
tree4ff203174623863f2edc222f1af7d0e5dc25e047
parenta86a16098e5d2b6cbd9ed16dba9c19267d690dea (diff)
downloademacs-bffc65597f583fe83f4097a477589cbd894d045d.tar.gz
emacs-bffc65597f583fe83f4097a477589cbd894d045d.zip
(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.
-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 1e2f22b1488..d98604a2afd 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -32,7 +32,7 @@
32 32
33(defvar bug-reference-map 33(defvar bug-reference-map
34 (let ((map (make-sparse-keymap))) 34 (let ((map (make-sparse-keymap)))
35 (define-key map [mouse-1] 'bug-reference-push-button) 35 (define-key map [down-mouse-1] 'bug-reference-push-button)
36 (define-key map (kbd "C-c RET") 'bug-reference-push-button) 36 (define-key map (kbd "C-c RET") 'bug-reference-push-button)
37 map) 37 map)
38 "Keymap used by bug reference buttons.") 38 "Keymap used by bug reference buttons.")
@@ -43,8 +43,11 @@
43The bug number is supplied as a string, so this should have a single %s. 43The bug number is supplied as a string, so this should have a single %s.
44There is no default setting for this, it must be set per file.") 44There is no default setting for this, it must be set per file.")
45 45
46;;;###autoload
47(put 'bug-reference-url-format 'safe-local-variable 'stringp)
48
46(defconst bug-reference-bug-regexp 49(defconst bug-reference-bug-regexp
47 "\\(?:[Bb]ug #\\|PR [a-z-+]+/\\)\\([0-9]+\\)" 50 "\\(?:[Bb]ug ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
48 "Regular expression which matches bug references.") 51 "Regular expression which matches bug references.")
49 52
50(defun bug-reference-set-overlay-properties () 53(defun bug-reference-set-overlay-properties ()
@@ -74,17 +77,18 @@ There is no default setting for this, it must be set per file.")
74 ;; Remove old overlays. 77 ;; Remove old overlays.
75 (bug-reference-unfontify beg-line end-line) 78 (bug-reference-unfontify beg-line end-line)
76 (goto-char beg-line) 79 (goto-char beg-line)
77 (while (and (< (point) end-line) 80 (save-match-data
78 (re-search-forward bug-reference-bug-regexp end-line 'move)) 81 (while (and (< (point) end-line)
79 (when (or (not bug-reference-prog-mode) 82 (re-search-forward bug-reference-bug-regexp end-line 'move))
80 ;; This tests for both comment and string syntax. 83 (when (or (not bug-reference-prog-mode)
81 (nth 8 (syntax-ppss))) 84 ;; This tests for both comment and string syntax.
82 (let ((overlay (make-overlay (match-beginning 0) (match-end 0) 85 (nth 8 (syntax-ppss)))
83 nil t nil))) 86 (let ((overlay (make-overlay (match-beginning 0) (match-end 0)
84 (overlay-put overlay 'category 'bug-reference) 87 nil t nil)))
85 (overlay-put overlay 'bug-reference-url 88 (overlay-put overlay 'category 'bug-reference)
86 (format bug-reference-url-format 89 (overlay-put overlay 'bug-reference-url
87 (match-string-no-properties 1))))))))) 90 (format bug-reference-url-format
91 (match-string-no-properties 1))))))))))
88 92
89;; Taken from button.el. 93;; Taken from button.el.
90(defun bug-reference-push-button (&optional pos use-mouse-action) 94(defun bug-reference-push-button (&optional pos use-mouse-action)