Node:append interactive, Next:, Previous:append-to-buffer overview, Up:append-to-buffer



4.4.1 The append-to-buffer Interactive Expression

Since the append-to-buffer function will be used interactively, the function must have an interactive expression. (For a review of interactive, see Making a Function Interactive.) The expression reads as follows:

(interactive "BAppend to buffer: \nr")

This expression has an argument inside of quotation marks and that argument has two parts, separated by \n.

The first part is BAppend to buffer: . Here, the B tells Emacs to ask for the name of the buffer that will be passed to the function. Emacs will ask for the name by prompting the user in the minibuffer, using the string following the B, which is the string Append to buffer: . Emacs then binds the variable buffer in the function's argument list to the specified buffer.

The newline, \n, separates the first part of the argument from the second part. It is followed by an r that tells Emacs to bind the two arguments that follow the symbol buffer in the function's argument list (that is, start and end) to the values of point and mark.