changeset 110856:86c4eea71813

gnus.el (gnus-expand-group-parameter): Only return and act on what was matched.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 08 Oct 2010 12:16:05 +0000
parents bec49af30c2f
children 93079c0866aa
files lisp/gnus/ChangeLog lisp/gnus/gnus.el
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Fri Oct 08 12:14:47 2010 +0200
+++ b/lisp/gnus/ChangeLog	Fri Oct 08 12:16:05 2010 +0000
@@ -81,6 +81,9 @@
 
 2010-10-06  Julien Danjou  <julien@danjou.info>
 
+	* gnus.el (gnus-expand-group-parameter): Only return and act on what
+	was matched.
+
 	* sieve-manage.el: Update example in `Commentary'.
 
 	* sieve.el (sieve-open-server): Use sieve-manage-authenticate.
--- a/lisp/gnus/gnus.el	Fri Oct 08 12:14:47 2010 +0200
+++ b/lisp/gnus/gnus.el	Fri Oct 08 12:16:05 2010 +0000
@@ -3815,12 +3815,13 @@
 
 (defun gnus-expand-group-parameter (match value group)
   "Use MATCH to expand VALUE in GROUP."
-  (with-temp-buffer
-    (insert group)
-    (goto-char (point-min))
-    (while (re-search-forward match nil t)
-      (replace-match value))
-    (buffer-string)))
+  (let ((start (string-match match group)))
+    (if start
+        (let ((matched-string (substring group start (match-end 0))))
+          ;; Build match groups
+          (string-match match matched-string)
+          (replace-match value nil nil matched-string))
+      group)))
 
 (defun gnus-expand-group-parameters (match parameters group)
   "Go through PARAMETERS and expand them according to the match data."