Mercurial > emacs
annotate lisp/progmodes/bug-reference.el @ 107880:43aef96c6073
* s/freebsd.h: Restore osreldate.h include.
Suggested by Naohiro Aota.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 16 Apr 2010 10:22:12 -0700 |
parents | 7fe21bd6ddf8 |
children | 087c3dc49930 |
rev | line source |
---|---|
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
1 ;; bug-reference.el --- buttonize bug references |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
4 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
5 ;; Author: Tom Tromey <tromey@redhat.com> |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
6 ;; Created: 21 Mar 2007 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
7 ;; Keywords: tools |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
8 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
10 |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94323
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94323
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94323
diff
changeset
|
14 ;; (at your option) any later version. |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
15 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
20 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94673
52b7a8c22af5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94323
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
23 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
24 ;;; Commentary: |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
25 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
26 ;; This file provides minor modes for putting clickable overlays on |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
27 ;; references to bugs. A bug reference is text like "PR foo/29292"; |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
28 ;; this is mapped to a URL using a user-supplied format. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
29 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
30 ;; Two minor modes are provided. One works on any text in the buffer; |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
31 ;; the other operates only on comments and strings. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
32 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
33 (defvar bug-reference-map |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
34 (let ((map (make-sparse-keymap))) |
106536
8cc9318e5841
* progmodes/bug-reference.el (bug-reference-map): Bind mouse-2
Chong Yidong <cyd@stupidchicken.com>
parents:
101160
diff
changeset
|
35 (define-key map [mouse-2] 'bug-reference-push-button) |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
36 (define-key map (kbd "C-c RET") 'bug-reference-push-button) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
37 map) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
38 "Keymap used by bug reference buttons.") |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
39 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
40 ;; E.g., "http://gcc.gnu.org/PR%s" |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
41 (defvar bug-reference-url-format nil |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
42 "Format used to turn a bug number into a URL. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
43 The bug number is supplied as a string, so this should have a single %s. |
107751
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
44 This can also be a function designator; it is called without arguments |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
45 and should return a string. |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
46 It can use `match-string' to get parts matched against |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
47 `bug-reference-bug-regexp', specifically: |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
48 1. issue kind (bug, patch, rfe &c) |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
49 2. issue number. |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
50 |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
51 There is no default setting for this, it must be set per file.") |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
52 |
96178
382d88eb4f25
(bug-reference-map): Bind down-mouse-1 rather than mouse-1.
Glenn Morris <rgm@gnu.org>
parents:
94673
diff
changeset
|
53 ;;;###autoload |
382d88eb4f25
(bug-reference-map): Bind down-mouse-1 rather than mouse-1.
Glenn Morris <rgm@gnu.org>
parents:
94673
diff
changeset
|
54 (put 'bug-reference-url-format 'safe-local-variable 'stringp) |
382d88eb4f25
(bug-reference-map): Bind down-mouse-1 rather than mouse-1.
Glenn Morris <rgm@gnu.org>
parents:
94673
diff
changeset
|
55 |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
56 (defconst bug-reference-bug-regexp |
107751
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
57 "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)" |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
58 "Regular expression which matches bug references.") |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
59 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
60 (defun bug-reference-set-overlay-properties () |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
61 "Set properties of bug reference overlays." |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
62 (put 'bug-reference 'evaporate t) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
63 (put 'bug-reference 'face 'link) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
64 (put 'bug-reference 'mouse-face 'highlight) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
65 (put 'bug-reference 'help-echo "mouse-1, C-c RET: visit this bug") |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
66 (put 'bug-reference 'keymap bug-reference-map) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
67 (put 'bug-reference 'follow-link t)) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
68 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
69 (bug-reference-set-overlay-properties) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
70 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
71 (defun bug-reference-unfontify (start end) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
72 "Remove bug reference overlays from region." |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
73 (dolist (o (overlays-in start end)) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
74 (when (eq (overlay-get o 'category) 'bug-reference) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
75 (delete-overlay o)))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
76 |
94323
e8d2086bbf1a
(bug-reference-prog-mode): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
94319
diff
changeset
|
77 (defvar bug-reference-prog-mode) |
e8d2086bbf1a
(bug-reference-prog-mode): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
94319
diff
changeset
|
78 |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
79 (defun bug-reference-fontify (start end) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
80 "Apply bug reference overlays to region." |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
81 (save-excursion |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
82 (let ((beg-line (progn (goto-char start) (line-beginning-position))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
83 (end-line (progn (goto-char end) (line-end-position)))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
84 ;; Remove old overlays. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
85 (bug-reference-unfontify beg-line end-line) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
86 (goto-char beg-line) |
96180
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
87 (while (and (< (point) end-line) |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
88 (re-search-forward bug-reference-bug-regexp end-line 'move)) |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
89 (when (or (not bug-reference-prog-mode) |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
90 ;; This tests for both comment and string syntax. |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
91 (nth 8 (syntax-ppss))) |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
92 (let ((overlay (make-overlay (match-beginning 0) (match-end 0) |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
93 nil t nil))) |
7734d90cd461
(bug-reference-fontify): Revert previous change that saved match data.
Glenn Morris <rgm@gnu.org>
parents:
96178
diff
changeset
|
94 (overlay-put overlay 'category 'bug-reference) |
101160
0bcb0e9c72ca
(bug-reference-fontify): Check for
Juri Linkov <juri@jurta.org>
parents:
100908
diff
changeset
|
95 ;; Don't put a link if format is undefined |
0bcb0e9c72ca
(bug-reference-fontify): Check for
Juri Linkov <juri@jurta.org>
parents:
100908
diff
changeset
|
96 (when bug-reference-url-format |
107751
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
97 (overlay-put overlay 'bug-reference-url |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
98 (if (stringp bug-reference-url-format) |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
99 (format bug-reference-url-format |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
100 (match-string-no-properties 2)) |
e130bb78db87
(bug-reference-bug-regexp): Also accept "patch" and "RFE".
Sam Steingold <sds@gnu.org>
parents:
106815
diff
changeset
|
101 (funcall bug-reference-url-format)))))))))) |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
102 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
103 ;; Taken from button.el. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
104 (defun bug-reference-push-button (&optional pos use-mouse-action) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
105 "Open URL corresponding to the bug reference at POS." |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
106 (interactive |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
107 (list (if (integerp last-command-event) (point) last-command-event))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
108 (if (and (not (integerp pos)) (eventp pos)) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
109 ;; POS is a mouse event; switch to the proper window/buffer |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
110 (let ((posn (event-start pos))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
111 (with-current-buffer (window-buffer (posn-window posn)) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
112 (bug-reference-push-button (posn-point posn) t))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
113 ;; POS is just normal position. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
114 (dolist (o (overlays-at pos)) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
115 ;; It should only be possible to have one URL overlay. |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
116 (let ((url (overlay-get o 'bug-reference-url))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
117 (when url |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
118 (browse-url url)))))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
119 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
120 ;;;###autoload |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
121 (define-minor-mode bug-reference-mode |
101160
0bcb0e9c72ca
(bug-reference-fontify): Check for
Juri Linkov <juri@jurta.org>
parents:
100908
diff
changeset
|
122 "Minor mode to buttonize bugzilla references in the current buffer." |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
123 nil |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
124 "" |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
125 nil |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
126 (if bug-reference-mode |
101160
0bcb0e9c72ca
(bug-reference-fontify): Check for
Juri Linkov <juri@jurta.org>
parents:
100908
diff
changeset
|
127 (jit-lock-register #'bug-reference-fontify) |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
128 (jit-lock-unregister #'bug-reference-fontify) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
129 (save-restriction |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
130 (widen) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
131 (bug-reference-unfontify (point-min) (point-max))))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
132 |
107803
25be388c76cc
add ";;;###autoload" cookies
Sam Steingold <sds@gnu.org>
parents:
107751
diff
changeset
|
133 ;;;###autoload |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
134 (define-minor-mode bug-reference-prog-mode |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
135 "Like `bug-reference-mode', but only buttonize in comments and strings." |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
136 nil |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
137 "" |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
138 nil |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
139 (if bug-reference-prog-mode |
101160
0bcb0e9c72ca
(bug-reference-fontify): Check for
Juri Linkov <juri@jurta.org>
parents:
100908
diff
changeset
|
140 (jit-lock-register #'bug-reference-fontify) |
94319
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
141 (jit-lock-unregister #'bug-reference-fontify) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
142 (save-restriction |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
143 (widen) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
144 (bug-reference-unfontify (point-min) (point-max))))) |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
145 |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
146 ;; arch-tag: b138abce-e5c3-475e-bd58-7afba40387ea |
91dd07fb6b73
Tom Tromey <tromey at redhat.com>: New file.
Glenn Morris <rgm@gnu.org>
parents:
diff
changeset
|
147 ;;; bug-reference.el ends here |