comparison lisp/emulation/cua-gmrk.el @ 108467:114b70461f96

CUA mode: Fix use of `filter-buffer-substring' (rework previous change). * emulation/cua-base.el (cua--filter-buffer-noprops): New function. (cua-repeat-replace-region): * emulation/cua-rect.el (cua--extract-rectangle, cua-incr-rectangle): * emulation/cua-gmrk.el (cua-copy-region-to-global-mark) (cua-cut-region-to-global-mark): Use it.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 10 May 2010 16:37:59 +0200
parents 41220cd25ea8
children 280c8ae2476d
comparison
equal deleted inserted replaced
108466:a30c85fa75e8 108467:114b70461f96
135 (interactive "r") 135 (interactive "r")
136 (if (cua--global-mark-active) 136 (if (cua--global-mark-active)
137 (let ((src-buf (current-buffer))) 137 (let ((src-buf (current-buffer)))
138 (save-excursion 138 (save-excursion
139 (if (equal (marker-buffer cua--global-mark-marker) src-buf) 139 (if (equal (marker-buffer cua--global-mark-marker) src-buf)
140 (let ((text (filter-buffer-substring start end))) 140 (let ((text (cua--filter-buffer-noprops start end)))
141 (goto-char (marker-position cua--global-mark-marker)) 141 (goto-char (marker-position cua--global-mark-marker))
142 (set-text-properties 0 (length text) text)
143 (insert text)) 142 (insert text))
144 (set-buffer (marker-buffer cua--global-mark-marker)) 143 (set-buffer (marker-buffer cua--global-mark-marker))
145 (goto-char (marker-position cua--global-mark-marker)) 144 (goto-char (marker-position cua--global-mark-marker))
146 (insert-buffer-substring-as-yank src-buf start end)) 145 (insert-buffer-substring-as-yank src-buf start end))
147 (cua--activate-global-mark) 146 (cua--activate-global-mark)
160 (save-excursion 159 (save-excursion
161 (if (equal (marker-buffer cua--global-mark-marker) src-buf) 160 (if (equal (marker-buffer cua--global-mark-marker) src-buf)
162 (if (and (< start (marker-position cua--global-mark-marker)) 161 (if (and (< start (marker-position cua--global-mark-marker))
163 (< (marker-position cua--global-mark-marker) end)) 162 (< (marker-position cua--global-mark-marker) end))
164 (message "Can't move region into itself") 163 (message "Can't move region into itself")
165 (let ((text (filter-buffer-substring start end)) 164 (let ((text (cua--filter-buffer-noprops start end))
166 (p1 (copy-marker start)) 165 (p1 (copy-marker start))
167 (p2 (copy-marker end))) 166 (p2 (copy-marker end)))
168 (goto-char (marker-position cua--global-mark-marker)) 167 (goto-char (marker-position cua--global-mark-marker))
169 (set-text-properties 0 (length text) text)
170 (insert text) 168 (insert text)
171 (cua--activate-global-mark) 169 (cua--activate-global-mark)
172 (delete-region (marker-position p1) (marker-position p2)) 170 (delete-region (marker-position p1) (marker-position p2))
173 (move-marker p1 nil) 171 (move-marker p1 nil)
174 (move-marker p2 nil))) 172 (move-marker p2 nil)))