Copyright (C) 2000-2012 |
GNU Info (emacs-lisp-intro.info)append-to-buffer overviewAn Overview of `append-to-buffer' --------------------------------- The `append-to-buffer' command uses the `insert-buffer-substring' function to copy the region. `insert-buffer-substring' is described by its name: it takes a string of characters from part of a buffer, a "substring", and inserts them into another buffer. Most of `append-to-buffer' is concerned with setting up the conditions for `insert-buffer-substring' to work: the code must specify both the buffer to which the text will go and the region that will be copied. Here is the complete text of the function: (defun append-to-buffer (buffer start end) "Append to specified buffer the text of the region. It is inserted into that buffer before its point. When calling from a program, give three arguments: a buffer or the name of one, and two character numbers specifying the portion of the current buffer to be copied." (interactive "BAppend to buffer: \nr") (let ((oldbuf (current-buffer))) (save-excursion (set-buffer (get-buffer-create buffer)) (insert-buffer-substring oldbuf start end)))) The function can be understood by looking at it as a series of filled-in templates. The outermost template is for the function definition. In this function, it looks like this (with several slots filled in): (defun append-to-buffer (buffer start end) "DOCUMENTATION..." (interactive "BAppend to buffer: \nr") BODY...) The first line of the function includes its name and three arguments. The arguments are the `buffer' to which the text will be copied, and the `start' and `end' of the region in the current buffer that will be copied. The next part of the function is the documentation, which is clear and complete. automatically generated by info2www version 1.2.2.9 |