[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/subr.el,v
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/subr.el,v |
Date: |
Sat, 10 Nov 2007 21:48:16 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Juri Linkov <jurta> 07/11/10 21:48:16
Index: subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.565
retrieving revision 1.566
diff -u -b -r1.565 -r1.566
--- subr.el 27 Oct 2007 09:07:15 -0000 1.565
+++ subr.el 10 Nov 2007 21:48:16 -0000 1.566
@@ -2709,6 +2709,24 @@
(buffer-substring-no-properties (match-beginning num)
(match-end num)))))
+
+(defun match-substitute-replacement (replacement
+ &optional fixedcase literal string subexp)
+ "Return REPLACEMENT as it will be inserted by `replace-match'.
+In other words, all back-references in the form `\\&' and `\\N'
+are substituted with actual strings matched by the last search.
+Optional FIXEDCASE, LITERAL, STRING and SUBEXP have the same
+meaning as for `replace-match'."
+ (let ((match (match-string 0 string)))
+ (save-match-data
+ (set-match-data (mapcar (lambda (x)
+ (if (numberp x)
+ (- x (match-beginning 0))
+ x))
+ (match-data t)))
+ (replace-match replacement fixedcase literal match subexp))))
+
+
(defun looking-back (regexp &optional limit greedy)
"Return non-nil if text before point matches regular expression REGEXP.
Like `looking-at' except matches before point, and is slower.
- [Emacs-diffs] Changes to emacs/lisp/subr.el,v,
Juri Linkov <=
- [Emacs-diffs] Changes to emacs/lisp/subr.el,v, Stefan Monnier, 2007/11/15
- [Emacs-diffs] Changes to emacs/lisp/subr.el,v, Juanma Barranquero, 2007/11/16
- [Emacs-diffs] Changes to emacs/lisp/subr.el,v, Glenn Morris, 2007/11/16
- [Emacs-diffs] Changes to emacs/lisp/subr.el,v, Glenn Morris, 2007/11/18
- [Emacs-diffs] Changes to emacs/lisp/subr.el,v, Stefan Monnier, 2007/11/22