Commit c81f72ce authored by Thien-Thi Nguyen's avatar Thien-Thi Nguyen

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

Don't signal error on empty register; use the text, instead.
parent 6159985a
2007-11-03 Sean O'Rourke <seano@cs.ucla.edu>
* register.el (append-to-register, prepend-to-register):
Don't signal error on empty register; use the text, instead.
2007-11-03 Michael Olson <mwolson@gnu.org> 2007-11-03 Michael Olson <mwolson@gnu.org>
* textmodes/remember.el (remember-buffer): Use * textmodes/remember.el (remember-buffer): Use
......
...@@ -287,10 +287,12 @@ With prefix arg, delete as well. ...@@ -287,10 +287,12 @@ With prefix arg, delete as well.
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 append." START and END are buffer positions indicating what to append."
(interactive "cAppend to register: \nr\nP") (interactive "cAppend to register: \nr\nP")
(or (stringp (get-register register)) (let ((reg (get-register register))
(error "Register does not contain text")) (text (filter-buffer-substring start end)))
(set-register register (concat (get-register register) (set-register
(filter-buffer-substring start end))) register (cond ((not reg) text)
((stringp reg) (concat reg text))
(t (error "Register does not contain text")))))
(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)
...@@ -299,10 +301,12 @@ With prefix arg, delete as well. ...@@ -299,10 +301,12 @@ With prefix arg, delete as well.
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 prepend." 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)) (let ((reg (get-register register))
(error "Register does not contain text")) (text (filter-buffer-substring start end)))
(set-register register (concat (filter-buffer-substring start end) (set-register
(get-register register))) register (cond ((not reg) text)
((stringp reg) (concat text reg))
(t (error "Register does not contain text")))))
(if delete-flag (delete-region start end))) (if delete-flag (delete-region start end)))
(defun copy-rectangle-to-register (register start end &optional delete-flag) (defun copy-rectangle-to-register (register start end &optional delete-flag)
......
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