aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-06-14 18:53:40 +0000
committerRichard M. Stallman1993-06-14 18:53:40 +0000
commit5c927015eeba89a83299536e7b2ffcf294fdbc6c (patch)
tree260dd33472c879f4a7e172fa6b33f7769de06ca4
parent9199fa7f7f182aeb77ea48a43483753ca5bad32e (diff)
downloademacs-5c927015eeba89a83299536e7b2ffcf294fdbc6c.tar.gz
emacs-5c927015eeba89a83299536e7b2ffcf294fdbc6c.zip
(picture-replace-match): New function.
-rw-r--r--lisp/textmodes/picture.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index b8a1ec0c5c2..3b6a5fe232c 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -263,6 +263,28 @@ With positive argument insert that many lines."
263 (forward-line -1) 263 (forward-line -1)
264 (insert contents)))) 264 (insert contents))))
265 265
266;; Like replace-match, but overwrites.
267(defun picture-replace-match (newtext fixedcase literal)
268 (let (ocolumn change pos)
269 (goto-char (setq pos (match-end 0)))
270 (setq ocolumn (current-column))
271 ;; Make the replacement and undo it, to see how it changes the length.
272 (let ((buffer-undo-list nil)
273 list1)
274 (replace-match newtext fixedcase literal)
275 (setq change (- (current-column) ocolumn))
276 (setq list1 buffer-undo-list)
277 (while list1
278 (setq list1 (primitive-undo 1 list1))))
279 (goto-char pos)
280 (if (> change 0)
281 (delete-region (point)
282 (progn
283 (move-to-column-force (+ change (current-column)))
284 (point))))
285 (replace-match newtext fixedcase literal)
286 (if (< change 0)
287 (insert-char ?\ (- change)))))
266 288
267;; Picture Tabs 289;; Picture Tabs
268 290