emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99811: (bug-reference-bug-regexp): A


From: Sam Steingold
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99811: (bug-reference-bug-regexp): Also accept "patch" and "RFE".
Date: Fri, 02 Apr 2010 13:24:37 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99811
committer: Sam Steingold <address@hidden>
branch nick: trunk
timestamp: Fri 2010-04-02 13:24:37 -0400
message:
  (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
modified:
  lisp/ChangeLog
  lisp/progmodes/bug-reference.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-02 14:21:57 +0000
+++ b/lisp/ChangeLog    2010-04-02 17:24:37 +0000
@@ -3,6 +3,12 @@
        * vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling
        `vc-hg-command' with a list of flags.
 
+       * progmodes/bug-reference.el (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
+
 2010-04-02  Jan Djärv  <address@hidden>
 
        * tmm.el (tmm-get-keymap): Check with symbolp before passing

=== modified file 'lisp/progmodes/bug-reference.el'
--- a/lisp/progmodes/bug-reference.el   2010-01-13 08:35:10 +0000
+++ b/lisp/progmodes/bug-reference.el   2010-04-02 17:24:37 +0000
@@ -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 @@
            (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 @@
       (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 @@
       (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]