Function: desktop-buffer-info

desktop-buffer-info is a byte-compiled function defined in desktop.el.gz.

Signature

(desktop-buffer-info BUFFER)

Documentation

Return information describing BUFFER.

This function is not pure, as BUFFER is made current with set-buffer.

Returns a list of all the necessary information to recreate the buffer, which is (in order):

    uniquify-buffer-base-name;
    buffer-file-name(var)/buffer-file-name(fun);
    buffer-name;
    major-mode;
    list of minor-modes;
    point;
    mark;
    buffer-read-only;
    auxiliary information given by desktop-save-buffer;
    local variables;
    auxiliary information given by desktop-var-serdes-funs.

Source Code

;; Defined in /usr/src/emacs/lisp/desktop.el.gz
;; ----------------------------------------------------------------------------
(defun desktop-buffer-info (buffer)
  "Return information describing BUFFER.
This function is not pure, as BUFFER is made current with
`set-buffer'.

Returns a list of all the necessary information to recreate the
buffer, which is (in order):

    `uniquify-buffer-base-name';
    `buffer-file-name';
    `buffer-name';
    `major-mode';
    list of minor-modes;
    `point';
    `mark';
    `buffer-read-only';
    auxiliary information given by `desktop-save-buffer';
    local variables;
    auxiliary information given by `desktop-var-serdes-funs'."
  (set-buffer buffer)
  `(
    ;; base name of the buffer; replaces the buffer name if managed by uniquify
    ,(and (fboundp 'uniquify-buffer-base-name) (uniquify-buffer-base-name))
    ;; basic information
    ,(desktop-file-name (buffer-file-name) desktop-dirname)
    ,(buffer-name)
    ,major-mode
    ;; minor modes
    ,(seq-filter
      (lambda (minor-mode)
        ;; Just two sanity checks.
        (and (boundp minor-mode)
             (symbol-value minor-mode)
             (let ((special
                    (assq minor-mode desktop-minor-mode-table)))
               (or (not special)
                   (cadr special)))))
      local-minor-modes)
    ;; point and mark, and read-only status
    ,(point)
    ,(list (mark t) mark-active)
    ,buffer-read-only
    ;; auxiliary information
    ,(when (functionp desktop-save-buffer)
       (funcall desktop-save-buffer desktop-dirname))
    ;; local variables
    ,(let ((loclist (buffer-local-variables))
           (ll nil))
       (dolist (local desktop-locals-to-save)
         (let ((here (assq local loclist)))
           (cond (here
                  (push here ll))
                 ((member local loclist)
                  (push local ll)))))
       ll)
   ,@(when (>= desktop-io-file-version 208)
       (list
        (mapcar (lambda (record)
                  (let ((var (car record)))
                    (list var
                          (funcall (cadr record) (symbol-value var)))))
                desktop-var-serdes-funs)))))