From 7bc7fd6058a28cdf7da672dc625c6d3f2e50aa1b Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Thu, 21 Jan 2016 11:19:21 +0100 Subject: [PATCH] Fix desktop support in todo-mode and doc-view (bug#22377) * lisp/calendar/todo-mode.el (todo-restore-desktop-buffer): * lisp/doc-view.el (doc-view-restore-desktop-buffer): Return current buffer. * lisp/calendar/todo-mode.el (todo-modes-set-2): * lisp/doc-view.el (doc-view-mode): Set desktop-save-buffer unconditionally. --- lisp/calendar/todo-mode.el | 6 +++--- lisp/doc-view.el | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 353ca69a1ba..ebf0a82be0c 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -5230,7 +5230,8 @@ Also preserve category display, if applicable." (with-current-buffer buffer (widen) (let ((todo-category-number (cdr (assq 'catnum misc)))) - (todo-category-select)))) + (todo-category-select) + (current-buffer)))) (add-to-list 'desktop-buffer-mode-handlers '(todo-mode . todo-restore-desktop-buffer)) @@ -6579,8 +6580,7 @@ Added to `window-configuration-change-hook' in Todo mode." "Make some settings that apply to multiple Todo modes." (add-to-invisibility-spec 'todo) (setq buffer-read-only t) - (when (and (boundp 'desktop-save-mode) desktop-save-mode) - (setq-local desktop-save-buffer 'todo-desktop-save-buffer)) + (setq-local desktop-save-buffer 'todo-desktop-save-buffer) (when (boundp 'hl-line-range-function) (setq-local hl-line-range-function (lambda() (save-excursion diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 286811358fb..06cf8dcef3a 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1714,7 +1714,8 @@ If BACKWARD is non-nil, jump to the previous match." ;; window-parameters in the window-state(s) and then restoring this ;; window-state should call us back (to interpret/use those parameters). (doc-view-goto-page page) - (when slice (apply 'doc-view-set-slice slice))))) + (when slice (apply 'doc-view-set-slice slice)) + (current-buffer)))) (add-to-list 'desktop-buffer-mode-handlers '(doc-view-mode . doc-view-restore-desktop-buffer)) @@ -1788,9 +1789,7 @@ toggle between displaying the document or editing it as text. nil t) (add-hook 'clone-indirect-buffer-hook 'doc-view-clone-buffer-hook nil t) (add-hook 'kill-buffer-hook 'doc-view-kill-proc nil t) - (when (and (boundp 'desktop-save-mode) - desktop-save-mode) - (setq-local desktop-save-buffer 'doc-view-desktop-save-buffer)) + (setq-local desktop-save-buffer 'doc-view-desktop-save-buffer) (remove-overlays (point-min) (point-max) 'doc-view t) ;Just in case. ;; Keep track of display info ([vh]scroll, page number, overlay,