comparison lisp/replace.el @ 90072:cb67264d6096

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0
author Miles Bader <miles@gnu.org>
date Sun, 16 Jan 2005 03:40:12 +0000
parents f6b4d0ebf147 3d6f4d8e0b8b
children 3ebd9bdb4fe5
comparison
equal deleted inserted replaced
90071:f6b4d0ebf147 90072:cb67264d6096
59 :version "20.3") 59 :version "20.3")
60 60
61 (defcustom query-replace-skip-read-only nil 61 (defcustom query-replace-skip-read-only nil
62 "*Non-nil means `query-replace' and friends ignore read-only matches." 62 "*Non-nil means `query-replace' and friends ignore read-only matches."
63 :type 'boolean 63 :type 'boolean
64 :group 'matching
65 :version "21.4")
66
67 (defcustom query-replace-highlight t
68 "*Non-nil means to highlight matches during query replacement."
69 :type 'boolean
70 :group 'matching)
71
72 (defcustom query-replace-lazy-highlight t
73 "*Controls the lazy-highlighting during query replacements.
74 When non-nil, all text in the buffer matching the current match
75 is highlighted lazily using isearch lazy highlighting (see
76 `lazy-highlight-initial-delay' and `lazy-highlight-interval')."
77 :type 'boolean
78 :group 'lazy-highlight
79 :group 'matching
80 :version "21.4")
81
82 (defface query-replace
83 '((t (:inherit isearch)))
84 "Face for highlighting query replacement matches."
64 :group 'matching 85 :group 'matching
65 :version "21.4") 86 :version "21.4")
66 87
67 (defun query-replace-descr (string) 88 (defun query-replace-descr (string)
68 (mapconcat 'isearch-text-char-description string "")) 89 (mapconcat 'isearch-text-char-description string ""))
800 (eobp) 821 (eobp)
801 (bobp)))) 822 (bobp))))
802 (setq count (+ count (if forwardp -1 1))) 823 (setq count (+ count (if forwardp -1 1)))
803 (setq beg (line-beginning-position) 824 (setq beg (line-beginning-position)
804 end (line-end-position)) 825 end (line-end-position))
805 (if (and keep-props (boundp 'jit-lock-mode) jit-lock-mode 826 (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
806 (text-property-not-all beg end 'fontified t)) 827 (text-property-not-all beg end 'fontified t))
807 (jit-lock-fontify-now beg end)) 828 (if (fboundp 'jit-lock-fontify-now)
829 (jit-lock-fontify-now beg end)))
808 (push 830 (push
809 (funcall (if keep-props 831 (funcall (if keep-props
810 #'buffer-substring 832 #'buffer-substring
811 #'buffer-substring-no-properties) 833 #'buffer-substring-no-properties)
812 beg end) 834 beg end)
1006 (goto-char matchbeg) 1028 (goto-char matchbeg)
1007 (setq begpt (line-beginning-position) 1029 (setq begpt (line-beginning-position)
1008 endpt (line-end-position))) 1030 endpt (line-end-position)))
1009 (setq marker (make-marker)) 1031 (setq marker (make-marker))
1010 (set-marker marker matchbeg) 1032 (set-marker marker matchbeg)
1011 (if (and keep-props (boundp 'jit-lock-mode) jit-lock-mode 1033 (if (and keep-props
1034 (if (boundp 'jit-lock-mode) jit-lock-mode)
1012 (text-property-not-all begpt endpt 'fontified t)) 1035 (text-property-not-all begpt endpt 'fontified t))
1013 (jit-lock-fontify-now begpt endpt)) 1036 (if (fboundp 'jit-lock-fontify-now)
1037 (jit-lock-fontify-now begpt endpt)))
1014 (setq curstring (buffer-substring begpt endpt)) 1038 (setq curstring (buffer-substring begpt endpt))
1015 ;; Depropertize the string, and maybe 1039 ;; Depropertize the string, and maybe
1016 ;; highlight the matches 1040 ;; highlight the matches
1017 (let ((len (length curstring)) 1041 (let ((len (length curstring))
1018 (start 0)) 1042 (start 0))
1255 nil match-data match-data)))) 1279 nil match-data match-data))))
1256 noedit nil))) 1280 noedit nil)))
1257 (set-match-data match-data) 1281 (set-match-data match-data)
1258 (replace-match newtext fixedcase literal) 1282 (replace-match newtext fixedcase literal)
1259 noedit) 1283 noedit)
1260
1261 (defcustom query-replace-highlight t
1262 "*Non-nil means to highlight matches during query replacement."
1263 :type 'boolean
1264 :group 'matching)
1265
1266 (defcustom query-replace-lazy-highlight t
1267 "*Controls the lazy-highlighting during query replacements.
1268 When non-nil, all text in the buffer matching the current match
1269 is highlighted lazily using isearch lazy highlighting (see
1270 `isearch-lazy-highlight-initial-delay' and
1271 `isearch-lazy-highlight-interval')."
1272 :type 'boolean
1273 :group 'matching
1274 :version "21.4")
1275
1276 (defface query-replace
1277 '((t (:inherit isearch)))
1278 "Face for highlighting query replacement matches."
1279 :group 'matching
1280 :version "21.4")
1281 1284
1282 (defun perform-replace (from-string replacements 1285 (defun perform-replace (from-string replacements
1283 query-flag regexp-flag delimited-flag 1286 query-flag regexp-flag delimited-flag
1284 &optional repeat-count map start end) 1287 &optional repeat-count map start end)
1285 "Subroutine of `query-replace'. Its complexity handles interactive queries. 1288 "Subroutine of `query-replace'. Its complexity handles interactive queries.