comparison lisp/desktop.el @ 13154:f86e18ff3736

(desktop-outvar): Support truncation. (desktop-globals-to-save): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Sun, 08 Oct 1995 19:37:04 +0000
parents f7f101a90cd4
children 187735b53d52
comparison
equal deleted inserted replaced
13153:c9694633f7ca 13154:f86e18ff3736
1 ;;; desktop.el --- save partial status of Emacs when killed 1 ;;; desktop.el --- save partial status of Emacs when killed
2 2
3 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. 3 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
4 4
5 ;; Author: Morten Welinder <terra@diku.dk> 5 ;; Author: Morten Welinder <terra@diku.dk>
6 ;; Version: 2.10
7 ;; Keywords: customization 6 ;; Keywords: customization
8 ;; Favourite-brand-of-beer: None, I hate beer. 7 ;; Favourite-brand-of-beer: None, I hate beer.
9 8
10 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
11 10
122 'search-ring 121 'search-ring
123 'regexp-search-ring 122 'regexp-search-ring
124 'register-alist 123 'register-alist
125 ;; 'desktop-globals-to-save ; Itself! 124 ;; 'desktop-globals-to-save ; Itself!
126 ) 125 )
127 "List of global variables to save when killing Emacs.") 126 "List of global variables to save when killing Emacs.
127 An element may be variable name (a symbol)
128 or a cons cell of the form (VAR . MAX-SIZE),
129 which means to truncate VAR's value to at most MAX-SIZE elements
130 \(if the value is a list) before saving the value.")
128 131
129 (defvar desktop-locals-to-save 132 (defvar desktop-locals-to-save
130 (list 'desktop-locals-to-save ; Itself! Think it over. 133 (list 'desktop-locals-to-save ; Itself! Think it over.
131 'truncate-lines 134 'truncate-lines
132 'case-fold-search 135 'case-fold-search
307 (txt (cdr quote.txt))) 310 (txt (cdr quote.txt)))
308 (if (eq quote 'must) 311 (if (eq quote 'must)
309 (concat "'" txt) 312 (concat "'" txt)
310 txt))) 313 txt)))
311 ;; ---------------------------------------------------------------------------- 314 ;; ----------------------------------------------------------------------------
312 (defun desktop-outvar (var) 315 (defun desktop-outvar (varspec)
313 "Output a setq statement for VAR to the desktop file." 316 "Output a setq statement for variable VAR to the desktop file.
314 (if (boundp var) 317 The argument VARSPEC may be the variable name VAR (a symbol),
315 (insert "(setq " 318 or a cons cell of the form (VAR . MAX-SIZE),
316 (symbol-name var) 319 which means to truncate VAR's value to at most MAX-SIZE elements
317 " " 320 \(if the value is a list) before saving the value."
318 (desktop-value-to-string (symbol-value var)) 321 (let (var size)
319 ")\n"))) 322 (if (consp varspec)
323 (setq var (car varspec) size (cdr varspec))
324 (setq var varspec))
325 (if (boundp var)
326 (progn
327 (if (and (integerp size)
328 (> size 0)
329 (listp (eval var)))
330 (desktop-truncate (eval var) size))
331 (insert "(setq "
332 (symbol-name var)
333 " "
334 (desktop-value-to-string (symbol-value var))
335 ")\n")))))
320 ;; ---------------------------------------------------------------------------- 336 ;; ----------------------------------------------------------------------------
321 (defun desktop-save-buffer-p (filename bufname mode &rest dummy) 337 (defun desktop-save-buffer-p (filename bufname mode &rest dummy)
322 "Return t if the desktop should record a particular buffer for next startup. 338 "Return t if the desktop should record a particular buffer for next startup.
323 FILENAME is the visited file name, BUFNAME is the buffer name, and 339 FILENAME is the visited file name, BUFNAME is the buffer name, and
324 MODE is the major mode." 340 MODE is the major mode."