diff options
| author | Kelly Dean | 2015-02-09 13:25:53 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2015-02-09 13:26:19 +0000 |
| commit | c96983efef178d104a98bb900dda2087df80b172 (patch) | |
| tree | a87407f9ca089ae5d6485f5361702482710f7149 | |
| parent | 2f7008715326a49770fcb82003ed78eab28c0626 (diff) | |
| download | emacs-c96983efef178d104a98bb900dda2087df80b172.tar.gz emacs-c96983efef178d104a98bb900dda2087df80b172.zip | |
desktop.el: Save mark-ring less verbosely.
For the discussion, see
https://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00582.html
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/desktop.el | 34 |
2 files changed, 37 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cd40ac7a259..d4b1fff4373 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2015-02-09 Kelly Dean <kelly@prtime.org> | ||
| 2 | |||
| 3 | * desktop.el: Save mark-ring less verbosely. | ||
| 4 | (desktop-var-serdes-funs): New var. | ||
| 5 | (desktop-buffer-info, desktop-create-buffer): Use it. | ||
| 6 | (desktop-file-version): Update to 208. | ||
| 7 | |||
| 1 | 2015-02-09 Leo Liu <sdl.web@gmail.com> | 8 | 2015-02-09 Leo Liu <sdl.web@gmail.com> |
| 2 | 9 | ||
| 3 | * emacs-lisp/pcase.el (pcase-lambda): New Macro. (Bug#19814) | 10 | * emacs-lisp/pcase.el (pcase-lambda): New Macro. (Bug#19814) |
diff --git a/lisp/desktop.el b/lisp/desktop.el index c355d7f080f..c2724904b58 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -136,7 +136,7 @@ | |||
| 136 | (require 'cl-lib) | 136 | (require 'cl-lib) |
| 137 | (require 'frameset) | 137 | (require 'frameset) |
| 138 | 138 | ||
| 139 | (defvar desktop-file-version "206" | 139 | (defvar desktop-file-version "208" |
| 140 | "Version number of desktop file format. | 140 | "Version number of desktop file format. |
| 141 | Written into the desktop file and used at desktop read to provide | 141 | Written into the desktop file and used at desktop read to provide |
| 142 | backward compatibility.") | 142 | backward compatibility.") |
| @@ -629,6 +629,18 @@ Only valid during frame saving & restoring; intended for internal use.") | |||
| 629 | "When the desktop file was last modified to the knowledge of this Emacs. | 629 | "When the desktop file was last modified to the knowledge of this Emacs. |
| 630 | Used to detect desktop file conflicts.") | 630 | Used to detect desktop file conflicts.") |
| 631 | 631 | ||
| 632 | (defvar desktop-var-serdes-funs | ||
| 633 | (list (list | ||
| 634 | 'mark-ring | ||
| 635 | (lambda (mr) | ||
| 636 | (mapcar #'marker-position mr)) | ||
| 637 | (lambda (mr) | ||
| 638 | (mapcar #'copy-marker mr)))) | ||
| 639 | "Table of serialization/deserialization functions for variables. | ||
| 640 | Each record is a list of form: (var serializer deserializer). | ||
| 641 | These records can be freely reordered, deleted, or new ones added. | ||
| 642 | However, for compatibility, don't modify the functions for existing records.") | ||
| 643 | |||
| 632 | (defun desktop-owner (&optional dirname) | 644 | (defun desktop-owner (&optional dirname) |
| 633 | "Return the PID of the Emacs process that owns the desktop file in DIRNAME. | 645 | "Return the PID of the Emacs process that owns the desktop file in DIRNAME. |
| 634 | Return nil if no desktop file found or no Emacs process is using it. | 646 | Return nil if no desktop file found or no Emacs process is using it. |
| @@ -780,7 +792,12 @@ is nil, ask the user where to save the desktop." | |||
| 780 | (push here ll)) | 792 | (push here ll)) |
| 781 | ((member local loclist) | 793 | ((member local loclist) |
| 782 | (push local ll))))) | 794 | (push local ll))))) |
| 783 | ll))) | 795 | ll) |
| 796 | (mapcar (lambda (record) | ||
| 797 | (let ((var (car record))) | ||
| 798 | (list var | ||
| 799 | (funcall (cadr record) (symbol-value var))))) | ||
| 800 | desktop-var-serdes-funs))) | ||
| 784 | 801 | ||
| 785 | ;; ---------------------------------------------------------------------------- | 802 | ;; ---------------------------------------------------------------------------- |
| 786 | (defun desktop--v2s (value) | 803 | (defun desktop--v2s (value) |
| @@ -1336,7 +1353,9 @@ after that many seconds of idle time." | |||
| 1336 | buffer-readonly | 1353 | buffer-readonly |
| 1337 | buffer-misc | 1354 | buffer-misc |
| 1338 | &optional | 1355 | &optional |
| 1339 | buffer-locals) | 1356 | buffer-locals |
| 1357 | compacted-vars | ||
| 1358 | &rest _unsupported) | ||
| 1340 | 1359 | ||
| 1341 | (let ((desktop-file-version file-version) | 1360 | (let ((desktop-file-version file-version) |
| 1342 | (desktop-buffer-file-name buffer-filename) | 1361 | (desktop-buffer-file-name buffer-filename) |
| @@ -1426,7 +1445,14 @@ after that many seconds of idle time." | |||
| 1426 | (set (car this) (cdr this))) | 1445 | (set (car this) (cdr this))) |
| 1427 | ;; An entry of the form `symbol'. | 1446 | ;; An entry of the form `symbol'. |
| 1428 | (make-local-variable this) | 1447 | (make-local-variable this) |
| 1429 | (makunbound this)))))))) | 1448 | (makunbound this))) |
| 1449 | (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args | ||
| 1450 | (dolist (record compacted-vars) | ||
| 1451 | (let* | ||
| 1452 | ((var (car record)) | ||
| 1453 | (deser-fun (cl-caddr (assq var desktop-var-serdes-funs)))) | ||
| 1454 | (if deser-fun (set var (funcall deser-fun (cadr record)))))))) | ||
| 1455 | result)))) | ||
| 1430 | 1456 | ||
| 1431 | ;; ---------------------------------------------------------------------------- | 1457 | ;; ---------------------------------------------------------------------------- |
| 1432 | ;; Backward compatibility -- update parameters to 205 standards. | 1458 | ;; Backward compatibility -- update parameters to 205 standards. |