Merge branch 'keep-some-local-variables-at-rebuild' into keep-text-scale-in-agenda-at-reload

This commit is contained in:
Marco Wahl 2018-06-23 20:36:04 +02:00
commit d6ebe38e2c
1 changed files with 26 additions and 18 deletions

View File

@ -2184,29 +2184,37 @@ The following commands are available:
\\{org-agenda-mode-map}" \\{org-agenda-mode-map}"
(interactive) (interactive)
(cond (org-agenda-doing-sticky-redo (let ((agenda-local-vars-to-keep
;; Refreshing sticky agenda-buffer '(text-scale-mode-amount
;; text-scale-mode
;; Preserve the value of `org-agenda-local-vars' variables, text-scale-mode-lighter
;; while letting `kill-all-local-variables' kill the rest face-remapping-alist))
(let ((save (buffer-local-variables))) (save (buffer-local-variables)))
(kill-all-local-variables) (kill-all-local-variables)
(cond (org-agenda-doing-sticky-redo
;; Refreshing sticky agenda-buffer
;;
;; Preserve the value of `org-agenda-local-vars' variables.
(mapc #'make-local-variable org-agenda-local-vars) (mapc #'make-local-variable org-agenda-local-vars)
(dolist (elem save) (dolist (elem save)
(pcase elem (pcase elem
(`(,var . ,val) ;ignore unbound variables (`(,var . ,val) ;ignore unbound variables
(when (and val (memq var org-agenda-local-vars)) (when (and val (memq var org-agenda-local-vars))
(set var val)))))) (set var val)))))
(setq-local org-agenda-this-buffer-is-sticky t)) (setq-local org-agenda-this-buffer-is-sticky t))
(org-agenda-sticky (org-agenda-sticky
;; Creating a sticky Agenda buffer for the first time ;; Creating a sticky Agenda buffer for the first time
(kill-all-local-variables) (mapc 'make-local-variable org-agenda-local-vars)
(mapc 'make-local-variable org-agenda-local-vars) (setq-local org-agenda-this-buffer-is-sticky t))
(setq-local org-agenda-this-buffer-is-sticky t)) (t
(t ;; Creating a non-sticky agenda buffer
;; Creating a non-sticky agenda buffer (setq-local org-agenda-this-buffer-is-sticky nil)))
(kill-all-local-variables) (mapc #'make-local-variable agenda-local-vars-to-keep)
(setq-local org-agenda-this-buffer-is-sticky nil))) (dolist (elem save)
(pcase elem
(`(,var . ,val) ;ignore unbound variables
(when (and val (memq var agenda-local-vars-to-keep))
(set var val))))))
(setq org-agenda-undo-list nil (setq org-agenda-undo-list nil
org-agenda-pending-undo-list nil org-agenda-pending-undo-list nil
org-agenda-bulk-marked-entries nil) org-agenda-bulk-marked-entries nil)