diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-04-29 20:13:16 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-04-29 20:13:16 +0000 |
commit | f475e0102877bfc6aa8619b5d719a8ff5f790615 (patch) | |
tree | 696903a7d4aa6e4a7c51f685063803096bb7a51f /lisp/desktop.el | |
parent | 07aaa3974f717f113f5be6e8c0e9f84083389d01 (diff) | |
download | emacs-f475e0102877bfc6aa8619b5d719a8ff5f790615.tar.gz |
(desktop-internal-v2s): Default case fixed to return correct quote flag.
Fix cons cell handling to avoid recursion in the cdr part.
Diffstat (limited to 'lisp/desktop.el')
-rw-r--r-- | lisp/desktop.el | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el index 9bbc8490df2..e22f50634a0 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. ;; Author: Morten Welinder <terra@diku.dk> -;; Version: 2.07 +;; Version: 2.08 ;; Keywords: customization ;; Favourite-brand-of-beer: None, I hate beer. @@ -218,22 +218,42 @@ and evaluated yields value. quote may be 'may (value may be quoted), ")")) (cons 'may (concat "[" (mapconcat 'cdr pass1 " ") "]"))))) ((consp val) - (let ((car-q.txt (desktop-internal-v2s (car val))) - (cdr-q.txt (desktop-internal-v2s (cdr val)))) - (cond - ((or (null (car car-q.txt)) (null (car cdr-q.txt))) - (cons nil (concat "(cons " - (if (eq (car car-q.txt) 'must) "'") - (cdr car-q.txt) " " - (if (eq (car cdr-q.txt) 'must) "'") - (cdr cdr-q.txt) ")"))) - ((consp (cdr val)) - (cons 'must (concat "(" (cdr car-q.txt) - " " (substring (cdr cdr-q.txt) 1 -1) ")"))) - ((null (cdr val)) - (cons 'must (concat "(" (cdr car-q.txt) ")"))) - (t - (cons 'must (concat "(" (cdr car-q.txt) " . " (cdr cdr-q.txt) ")")))))) + (let ((p val) + newlist + anynil) + (while (consp p) + (let ((q.txt (desktop-internal-v2s (car p)))) + (or anynil (setq anynil (null (car q.txt)))) + (setq newlist (cons q.txt newlist))) + (setq p (cdr p))) + (if p + (let ((last (desktop-internal-v2s p)) + (el (car newlist))) + (setcar newlist + (if (or anynil (setq anynil (null (car last)))) + (cons nil + (concat "(cons " + (if (eq (car el) 'must) "'" "") + (cdr el) + " " + (if (eq (car last) 'must) "'" "") + (cdr last) + ")")) + (cons 'must + (concat (cdr el) " . " (cdr last))))))) + (setq newlist (nreverse newlist)) + (if anynil + (cons nil + (concat "(list " + (mapconcat (lambda (el) + (if (eq (car el) 'must) + (concat "'" (cdr el)) + (cdr el))) + newlist + " ") + ")")) + (cons 'must + (concat "(" (mapconcat 'cdr newlist " ") ")"))))) ((subrp val) (cons nil (concat "(symbol-function '" (substring (prin1-to-string val) 7 -1) @@ -246,7 +266,7 @@ and evaluated yields value. quote may be 'may (value may be quoted), " (list 'lambda '() (list 'set-marker mk " pos " (get-buffer " buf ")))) mk)")))) (t ; save as text - (cons nil (prin1-to-string (prin1-to-string val)))))) + (cons 'may (prin1-to-string val))))) (defun desktop-value-to-string (val) "Convert VALUE to a string that when read evaluates to the same value. Not |