+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>
* textmodes/remember.el (remember-buffer): Use
Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to append."
(interactive "cAppend to register: \nr\nP")
- (or (stringp (get-register register))
- (error "Register does not contain text"))
- (set-register register (concat (get-register register)
- (filter-buffer-substring start end)))
+ (let ((reg (get-register register))
+ (text (filter-buffer-substring start end)))
+ (set-register
+ register (cond ((not reg) text)
+ ((stringp reg) (concat reg text))
+ (t (error "Register does not contain text")))))
(if delete-flag (delete-region start end)))
(defun prepend-to-register (register start end &optional delete-flag)
Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to prepend."
(interactive "cPrepend to register: \nr\nP")
- (or (stringp (get-register register))
- (error "Register does not contain text"))
- (set-register register (concat (filter-buffer-substring start end)
- (get-register register)))
+ (let ((reg (get-register register))
+ (text (filter-buffer-substring start end)))
+ (set-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)))
(defun copy-rectangle-to-register (register start end &optional delete-flag)