LispWorks Editor User Guide > 6 Advanced Features > 6.3 Programming the editor > 6.3.16 Examples

NextPrevUpTopContentsIndex Example 3

The following example illustrates how text might be copied between buffers. First, string is set to all the text in from-buf . This text is then copied to the end of to-buf .

(defun copy-string (from-buf to-buf)
   (let ((string (editor:points-to-string  
           (editor:buffers-start from-buf)
           (editor:buffers-end from-buf))))
        (editor:insert-string (editor:buffers-end to-buf) string)))

To test this example, two buffers named t1 and t2 should be created. Then, to copy all the text from t1 to the end of t2 :

(copy-string (editor:buffer-from-name "t1") 
						(editor:buffer-from-name "t2"))

LispWorks Editor User Guide (Macintosh version) - 22 Dec 2009