aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-10-08 19:37:04 +0000
committerRichard M. Stallman1995-10-08 19:37:04 +0000
commit0e7c8611353ed46a045b4eddb09e450d2b85f27b (patch)
treee4f2e8f11d1c74d72af619e0779fe60e64ee7c80
parent556f7d7737f3b0e053c2902a388b079aa5b4608b (diff)
downloademacs-0e7c8611353ed46a045b4eddb09e450d2b85f27b.tar.gz
emacs-0e7c8611353ed46a045b4eddb09e450d2b85f27b.zip
(desktop-outvar): Support truncation.
(desktop-globals-to-save): Doc fix.
-rw-r--r--lisp/desktop.el36
1 files changed, 26 insertions, 10 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index b9787a83766..aa881af5d03 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -3,7 +3,6 @@
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
@@ -124,7 +123,11 @@ Otherwise it simply ignores that file.")
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.
127An element may be variable name (a symbol)
128or a cons cell of the form (VAR . MAX-SIZE),
129which 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.
@@ -309,14 +312,27 @@ Not all types of values are supported."
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) 317The argument VARSPEC may be the variable name VAR (a symbol),
315 (insert "(setq " 318or a cons cell of the form (VAR . MAX-SIZE),
316 (symbol-name var) 319which 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.