diff options
| author | Sam Steingold | 2016-10-15 23:14:48 -0400 |
|---|---|---|
| committer | Sam Steingold | 2016-10-15 23:14:48 -0400 |
| commit | cd726ef68ece4fff6772bd08c0051c294e925505 (patch) | |
| tree | 723e44a221ee89dabf6112ed3929227303a88775 | |
| parent | cf566b46a6cf85c6d54d0b0db80e32ed6ae8d1ca (diff) | |
| download | emacs-cd726ef68ece4fff6772bd08c0051c294e925505.tar.gz emacs-cd726ef68ece4fff6772bd08c0051c294e925505.zip | |
Save and restore buffer-display-time
* desktop.el (desktop-locals-to-save): Add `buffer-display-time'
(desktop-read): Set `desktop-file-modtime' before loading the desktop file
(desktop-create-buffer): Adjust `buffer-display-time' for the downtime
| -rw-r--r-- | lisp/desktop.el | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el index df4ff551c2d..9fb8393e76c 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -367,6 +367,7 @@ these won't be deleted." | |||
| 367 | column-number-mode | 367 | column-number-mode |
| 368 | size-indication-mode | 368 | size-indication-mode |
| 369 | buffer-file-coding-system | 369 | buffer-file-coding-system |
| 370 | buffer-display-time | ||
| 370 | indent-tabs-mode | 371 | indent-tabs-mode |
| 371 | tab-width | 372 | tab-width |
| 372 | indicate-buffer-boundaries | 373 | indicate-buffer-boundaries |
| @@ -1233,8 +1234,8 @@ Using it may cause conflicts. Use it anyway? " owner))))) | |||
| 1233 | (memq 'desktop-auto-save-set-timer window-configuration-change-hook)) | 1234 | (memq 'desktop-auto-save-set-timer window-configuration-change-hook)) |
| 1234 | (desktop-auto-save-disable) | 1235 | (desktop-auto-save-disable) |
| 1235 | ;; Evaluate desktop buffer and remember when it was modified. | 1236 | ;; Evaluate desktop buffer and remember when it was modified. |
| 1236 | (load (desktop-full-file-name) t t t) | ||
| 1237 | (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) | 1237 | (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) |
| 1238 | (load (desktop-full-file-name) t t t) | ||
| 1238 | ;; If it wasn't already, mark it as in-use, to bother other | 1239 | ;; If it wasn't already, mark it as in-use, to bother other |
| 1239 | ;; desktop instances. | 1240 | ;; desktop instances. |
| 1240 | (unless (eq (emacs-pid) owner) | 1241 | (unless (eq (emacs-pid) owner) |
| @@ -1536,6 +1537,19 @@ and try to load that." | |||
| 1536 | ;; An entry of the form `symbol'. | 1537 | ;; An entry of the form `symbol'. |
| 1537 | (make-local-variable this) | 1538 | (make-local-variable this) |
| 1538 | (makunbound this))) | 1539 | (makunbound this))) |
| 1540 | ;; adjust `buffer-display-time' for the downtime. e.g., | ||
| 1541 | ;; * if `buffer-display-time' was 8:00 | ||
| 1542 | ;; * and emacs stopped at `desktop-file-modtime' == 11:00 | ||
| 1543 | ;; * and we are loading the desktop file at (current-time) 12:30, | ||
| 1544 | ;; -> then we restore `buffer-display-time' as 9:30, | ||
| 1545 | ;; for the sake of `clean-buffer-list': preserving the invariant | ||
| 1546 | ;; "how much time the user spent in Emacs without looking at this buffer". | ||
| 1547 | (setq buffer-display-time | ||
| 1548 | (if buffer-display-time | ||
| 1549 | (time-add buffer-display-time | ||
| 1550 | (time-subtract (current-time) | ||
| 1551 | desktop-file-modtime)) | ||
| 1552 | (current-time))) | ||
| 1539 | (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args | 1553 | (unless (< desktop-file-version 208) ; Don't misinterpret any old custom args |
| 1540 | (dolist (record compacted-vars) | 1554 | (dolist (record compacted-vars) |
| 1541 | (let* | 1555 | (let* |