3.2 Buffer Functions

make-buffer  name [Function]
Make Buffer Hook  (initial value ) [Variable]
Default Modeline Fields  (initial value ) [Variable]
          

make-buffer creates and returns a buffer with the given name. If a buffer named name already exists, nil is returned. Modes is a list of modes which should be in effect in the buffer, major mode first, followed by any minor modes. If this is omitted then the buffer is created with the list of modes contained in Default Modes. Modeline-fields is a list of modeline-field objects (see section 3.3) which may be nil. delete-hook is a list of delete hooks specific to this buffer, and delete-buffer invokes these along with Delete Buffer Hook. [annotate]

Buffers created with make-buffer are entered into the list buffer-list, and their names are inserted into the string-table buffer-names. When a buffer is created the hook Make Buffer Hook is invoked with the new buffer. [annotate]

[annotate]

bufferp  buffer [Function]
          

Returns t if buffer is a buffer object, otherwise nil. [annotate]

[annotate]

buffer-name  buffer [Function]
Buffer Name Hook  (initial value ) [Variable]
          

buffer-name returns the name, which is a string, of the given buffer. The corresponding setf method invokes Buffer Name Hook with buffer and the new name and then sets the buffer's name. When the user supplies a name for which a buffer already exists, the setf method signals an error. [annotate]

[annotate]

buffer-region  buffer [Function]
          

Returns the buffer's region. This can be set with setf. Note, this returns the region that contains all the text in a buffer, not the current-region. [annotate]

[annotate]

buffer-pathname  buffer [Function]
Buffer Pathname Hook  (initial value ) [Variable]
          

buffer-pathname returns the pathname of the file associated with the given buffer, or nil if it has no associated file. This is the truename of the file as of the most recent time it was read or written. There is a setf form to change the pathname. When the pathname is changed the hook Buffer Pathname Hook is invoked with the buffer and new value. [annotate]

[annotate]

buffer-write-date  buffer [Function]
          

Returns the write date for the file associated with the buffer in universal time format. When this the buffer-pathname is set, use setf to set this to the corresponding write date, or to nil if the date is unknown or there is no file. [annotate]

[annotate]

buffer-point  buffer [Function]
          

Returns the mark which is the current location within buffer. To move the point, use move-mark or move-to-position rather than setting buffer-point with setf. [annotate]

[annotate]

buffer-mark  buffer [Function]
          

This function returns the top of buffer's mark stack. There always is at least one mark at the beginning of buffer's region, and all marks returned are right-inserting. [annotate]

[annotate]

buffer-start-mark  buffer [Function]
buffer-end-mark  buffer [Function]
          

These functions return the start and end marks of buffer's region: (buffer-start-mark buffer) <==> (region-start (buffer-region buffer)) and (buffer-end-mark buffer) <==> (region-end (buffer-region buffer)) [annotate]

[annotate]

buffer-writable  buffer [Function]
Buffer Writable Hook  (initial value ) [Variable]
          

This function returns t if you can modify the buffer, nil if you cannot. If a buffer is not writable, then any attempt to alter text in the buffer results in an error. There is a setf method to change this value. [annotate]

The setf method invokes the functions in Buffer Writable Hook on the buffer and new value before storing the new value. [annotate]

[annotate]

buffer-modified  buffer [Function]
Buffer Modified Hook  (initial value ) [Variable]
          

buffer-modified returns t if the buffer has been modified, nil if it hasn't. This attribute is set whenever a text-altering operation is performed on a buffer. There is a setf method to change this value. [annotate]

The setf method invokes the functions in Buffer Modified Hook with the buffer whenever the value of the modified flag changes. [annotate]

[annotate]

with-writable-buffer  (buffer) &rest forms [Macro]
          

This macro executes forms with buffer's writable status set. After forms execute, this resets the buffer's writable and modified status. [annotate]

[annotate]

buffer-signature  buffer [Function]
          

This function returns an arbitrary number which reflects the buffer's current signature. The result is eql to a previous result if and only if the buffer has not been modified between the calls. [annotate]

[annotate]

buffer-variables  buffer [Function]
          

This function returns a string-table (page 16.1) containing the names of the buffer's local variables. See chapter 6. [annotate]

[annotate]

buffer-modes  buffer [Function]
          

This function returns the list of the names of the modes active in buffer. The major mode is first, followed by any minor modes. See chapter 8. [annotate]

[annotate]

buffer-windows  buffer [Function]
          

This function returns the list of all the windows in which the buffer may be displayed. This list may include windows which are not currently visible. See page 10.1 for a discussion of windows. [annotate]

[annotate]

buffer-delete-hook  buffer [Function]
          

This function returns the list of buffer specific functions delete-buffer invokes when deleting a buffer. This is setf'able. [annotate]

[annotate]

delete-buffer  buffer [Function]
Delete Buffer Hook  (initial value ) [Variable]
          

delete-buffer removes buffer from buffer-list and its name from buffer-names. Before buffer is deleted, this invokes the functions on buffer returned by buffer-delete-hook and those found in Delete Buffer Hook. If buffer is the current-buffer, or if it is displayed in any windows, then this function signals an error. [annotate]

[annotate]

delete-buffer-if-possible  buffer [Function]
          

This uses delete-buffer to delete buffer if at all possible. If buffer is the current-buffer, then this sets the current-buffer to the first distinct buffer in buffer-history. If buffer is displayed in any windows, then this makes each window display the same distinct buffer. [annotate]

[annotate]