Function: buffer-local-variables

buffer-local-variables is a function defined in buffer.c.

Signature

(buffer-local-variables &optional BUFFER)

Documentation

Return an alist of variables that are buffer-local in BUFFER.

Most elements look like (SYMBOL . VALUE), describing one variable. For a symbol that is locally unbound, just the symbol appears in the value. Note that storing new VALUEs in these elements doesn't change the variables. No argument or nil as argument means use current buffer as BUFFER.

Probably introduced at or before Emacs version 19.20.

Source Code

// Defined in /usr/src/emacs/src/buffer.c
{
  struct buffer *buf = decode_buffer (buffer);
  Lisp_Object result = buffer_lisp_local_variables (buf, 0);
  Lisp_Object tem;

  /* Add on all the variables stored in special slots.  */
  {
    int offset;

    FOR_EACH_PER_BUFFER_OBJECT_AT (offset)
      {
        tem = buffer_local_variables_1 (buf, offset, Qnil);
        if (!NILP (tem))
          result = Fcons (tem, result);
      }
  }

  tem = buffer_local_variables_1 (buf, PER_BUFFER_VAR_OFFSET (undo_list),
				  intern ("buffer-undo-list"));
  if (!NILP (tem))
    result = Fcons (tem, result);

  return result;
}