Commit 13191e32 authored by Richard M. Stallman's avatar Richard M. Stallman

(copy-to-register, append-to-register, prepend-to-register):

Use filter-buffer-substring.
parent 7fcce20f
...@@ -277,7 +277,7 @@ Interactively, second arg is non-nil if prefix arg is supplied." ...@@ -277,7 +277,7 @@ Interactively, second arg is non-nil if prefix arg is supplied."
Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to copy." START and END are buffer positions indicating what to copy."
(interactive "cCopy to register: \nr\nP") (interactive "cCopy to register: \nr\nP")
(set-register register (buffer-substring start end)) (set-register register (filter-buffer-substring start end))
(if delete-flag (delete-region start end))) (if delete-flag (delete-region start end)))
(defun append-to-register (register start end &optional delete-flag) (defun append-to-register (register start end &optional delete-flag)
...@@ -289,7 +289,7 @@ START and END are buffer positions indicating what to append." ...@@ -289,7 +289,7 @@ START and END are buffer positions indicating what to append."
(or (stringp (get-register register)) (or (stringp (get-register register))
(error "Register does not contain text")) (error "Register does not contain text"))
(set-register register (concat (get-register register) (set-register register (concat (get-register register)
(buffer-substring start end))) (filter-buffer-substring start end)))
(if delete-flag (delete-region start end))) (if delete-flag (delete-region start end)))
(defun prepend-to-register (register start end &optional delete-flag) (defun prepend-to-register (register start end &optional delete-flag)
...@@ -300,7 +300,7 @@ START and END are buffer positions indicating what to prepend." ...@@ -300,7 +300,7 @@ START and END are buffer positions indicating what to prepend."
(interactive "cPrepend to register: \nr\nP") (interactive "cPrepend to register: \nr\nP")
(or (stringp (get-register register)) (or (stringp (get-register register))
(error "Register does not contain text")) (error "Register does not contain text"))
(set-register register (concat (buffer-substring start end) (set-register register (concat (filter-buffer-substring start end)
(get-register register))) (get-register register)))
(if delete-flag (delete-region start end))) (if delete-flag (delete-region start end)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment