diff options
| author | Sam Steingold | 2010-04-02 13:24:37 -0400 |
|---|---|---|
| committer | Sam Steingold | 2010-04-02 13:24:37 -0400 |
| commit | dbb5e44a980a786d1f581faab81ad7830520a650 (patch) | |
| tree | f8669121d05326f30d3912f680b2c388a8f9e3ad | |
| parent | 51a91f9da64f25b68a1d3f752df6193c49c9b4fc (diff) | |
| download | emacs-dbb5e44a980a786d1f581faab81ad7830520a650.tar.gz 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
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/bug-reference.el | 27 |
2 files changed, 29 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d38826011f4..d402a57b1a8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,6 +3,12 @@ | |||
| 3 | * vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling | 3 | * vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling |
| 4 | `vc-hg-command' with a list of flags. | 4 | `vc-hg-command' with a list of flags. |
| 5 | 5 | ||
| 6 | * progmodes/bug-reference.el (bug-reference-bug-regexp): Also | ||
| 7 | accept "patch" and "RFE". | ||
| 8 | (bug-reference-fontify): `bug-reference-url-format' can also be a | ||
| 9 | function to be able to handle the bug kind. | ||
| 10 | (turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode): Add | ||
| 11 | |||
| 6 | 2010-04-02 Jan Djärv <jan.h.d@swipnet.se> | 12 | 2010-04-02 Jan Djärv <jan.h.d@swipnet.se> |
| 7 | 13 | ||
| 8 | * tmm.el (tmm-get-keymap): Check with symbolp before passing | 14 | * tmm.el (tmm-get-keymap): Check with symbolp before passing |
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 @@ | |||
| 41 | (defvar bug-reference-url-format nil | 41 | (defvar bug-reference-url-format nil |
| 42 | "Format used to turn a bug number into a URL. | 42 | "Format used to turn a bug number into a URL. |
| 43 | The bug number is supplied as a string, so this should have a single %s. | 43 | The bug number is supplied as a string, so this should have a single %s. |
| 44 | This can also be a function designator; it is called without arguments | ||
| 45 | and should return a string. | ||
| 46 | It can use `match-string' to get parts matched against | ||
| 47 | `bug-reference-bug-regexp', specifically: | ||
| 48 | 1. issue kind (bug, patch, rfe &c) | ||
| 49 | 2. issue number. | ||
| 50 | |||
| 44 | There is no default setting for this, it must be set per file.") | 51 | There is no default setting for this, it must be set per file.") |
| 45 | 52 | ||
| 46 | ;;;###autoload | 53 | ;;;###autoload |
| 47 | (put 'bug-reference-url-format 'safe-local-variable 'stringp) | 54 | (put 'bug-reference-url-format 'safe-local-variable 'stringp) |
| 48 | 55 | ||
| 49 | (defconst bug-reference-bug-regexp | 56 | (defconst bug-reference-bug-regexp |
| 50 | "\\(?:[Bb]ug ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)" | 57 | "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)" |
| 51 | "Regular expression which matches bug references.") | 58 | "Regular expression which matches bug references.") |
| 52 | 59 | ||
| 53 | (defun bug-reference-set-overlay-properties () | 60 | (defun bug-reference-set-overlay-properties () |
| @@ -87,9 +94,11 @@ There is no default setting for this, it must be set per file.") | |||
| 87 | (overlay-put overlay 'category 'bug-reference) | 94 | (overlay-put overlay 'category 'bug-reference) |
| 88 | ;; Don't put a link if format is undefined | 95 | ;; Don't put a link if format is undefined |
| 89 | (when bug-reference-url-format | 96 | (when bug-reference-url-format |
| 90 | (overlay-put overlay 'bug-reference-url | 97 | (overlay-put overlay 'bug-reference-url |
| 91 | (format bug-reference-url-format | 98 | (if (stringp bug-reference-url-format) |
| 92 | (match-string-no-properties 1)))))))))) | 99 | (format bug-reference-url-format |
| 100 | (match-string-no-properties 2)) | ||
| 101 | (funcall bug-reference-url-format)))))))))) | ||
| 93 | 102 | ||
| 94 | ;; Taken from button.el. | 103 | ;; Taken from button.el. |
| 95 | (defun bug-reference-push-button (&optional pos use-mouse-action) | 104 | (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.") | |||
| 121 | (widen) | 130 | (widen) |
| 122 | (bug-reference-unfontify (point-min) (point-max))))) | 131 | (bug-reference-unfontify (point-min) (point-max))))) |
| 123 | 132 | ||
| 133 | (defun turn-on-bug-reference-mode () | ||
| 134 | "Unconditionally turn bug reference mode on." | ||
| 135 | (unless bug-reference-mode | ||
| 136 | (bug-reference-mode))) | ||
| 137 | |||
| 124 | ;;;###autoload | 138 | ;;;###autoload |
| 125 | (define-minor-mode bug-reference-prog-mode | 139 | (define-minor-mode bug-reference-prog-mode |
| 126 | "Like `bug-reference-mode', but only buttonize in comments and strings." | 140 | "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.") | |||
| 134 | (widen) | 148 | (widen) |
| 135 | (bug-reference-unfontify (point-min) (point-max))))) | 149 | (bug-reference-unfontify (point-min) (point-max))))) |
| 136 | 150 | ||
| 151 | (defun turn-on-bug-reference-prog-mode () | ||
| 152 | "Unconditionally turn bug reference prog mode on." | ||
| 153 | (unless bug-reference-prog-mode | ||
| 154 | (bug-reference-prog-mode))) | ||
| 155 | |||
| 137 | ;; arch-tag: b138abce-e5c3-475e-bd58-7afba40387ea | 156 | ;; arch-tag: b138abce-e5c3-475e-bd58-7afba40387ea |
| 138 | ;;; bug-reference.el ends here | 157 | ;;; bug-reference.el ends here |