summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2018-06-24 09:58:01 +0200
committerMarco Wahl <marcowahlsoft@gmail.com>2018-06-24 09:58:01 +0200
commit9553896b1171dc0ad0a7b1960144039de37583c5 (patch)
treeaa6f7d5df34dccf8288102294fda2017a80a09f7
parent58b512013ecc96c9a0a427fb9ad68d3fbe24eb74 (diff)
parenta6b4cec691317a903475519dc4aaf105beda1833 (diff)
downloadorg-mode-9553896b1171dc0ad0a7b1960144039de37583c5.tar.gz
Merge branch 'keep-text-scale-in-agenda-at-reload'
-rw-r--r--lisp/org-agenda.el53
-rw-r--r--testing/lisp/test-org-agenda.el21
2 files changed, 51 insertions, 23 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 6636a2a..eaeddb6 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2184,29 +2184,36 @@ The following commands are available:
\\{org-agenda-mode-map}"
(interactive)
- (cond (org-agenda-doing-sticky-redo
- ;; Refreshing sticky agenda-buffer
- ;;
- ;; Preserve the value of `org-agenda-local-vars' variables,
- ;; while letting `kill-all-local-variables' kill the rest
- (let ((save (buffer-local-variables)))
- (kill-all-local-variables)
- (mapc #'make-local-variable org-agenda-local-vars)
- (dolist (elem save)
- (pcase elem
- (`(,var . ,val) ;ignore unbound variables
- (when (and val (memq var org-agenda-local-vars))
- (set var val))))))
- (setq-local org-agenda-this-buffer-is-sticky t))
- (org-agenda-sticky
- ;; Creating a sticky Agenda buffer for the first time
- (kill-all-local-variables)
- (mapc 'make-local-variable org-agenda-local-vars)
- (setq-local org-agenda-this-buffer-is-sticky t))
- (t
- ;; Creating a non-sticky agenda buffer
- (kill-all-local-variables)
- (setq-local org-agenda-this-buffer-is-sticky nil)))
+ (let ((agenda-local-vars-to-keep
+ '(text-scale-mode-amount
+ text-scale-mode
+ text-scale-mode-lighter
+ face-remapping-alist))
+ (save (buffer-local-variables)))
+ (kill-all-local-variables)
+ (cl-flet ((reset-saved (var-set)
+ "Reset variables in VAR-SET to possibly stored value in SAVE."
+ (dolist (elem save)
+ (pcase elem
+ (`(,var . ,val) ;ignore unbound variables
+ (when (and val (memq var var-set))
+ (set var val)))))))
+ (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)
+ (reset-saved org-agenda-local-vars)
+ (setq-local org-agenda-this-buffer-is-sticky t))
+ (org-agenda-sticky
+ ;; Creating a sticky Agenda buffer for the first time
+ (mapc 'make-local-variable org-agenda-local-vars)
+ (setq-local org-agenda-this-buffer-is-sticky t))
+ (t
+ ;; Creating a non-sticky agenda buffer
+ (setq-local org-agenda-this-buffer-is-sticky nil)))
+ (mapc #'make-local-variable agenda-local-vars-to-keep)
+ (reset-saved agenda-local-vars-to-keep)))
(setq org-agenda-undo-list nil
org-agenda-pending-undo-list nil
org-agenda-bulk-marked-entries nil)
diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el
index 552792f..6aaa88f 100644
--- a/testing/lisp/test-org-agenda.el
+++ b/testing/lisp/test-org-agenda.el
@@ -124,6 +124,27 @@
(org-test-agenda--kill-all-agendas))
+;; agenda redo
+
+(require 'face-remap)
+
+(ert-deftest test-org-agenda/rescale ()
+ "Text scale survives `org-agenda-redo'."
+ (org-test-agenda--kill-all-agendas)
+ (unwind-protect
+ (let ((org-agenda-span 'day)
+ org-agenda-files)
+ (org-agenda-list)
+ (set-buffer org-agenda-buffer-name)
+ (text-scale-mode)
+ (text-scale-set 11)
+ (cl-assert (and (boundp text-scale-mode) text-scale-mode))
+ (org-agenda-redo)
+ (should text-scale-mode)
+ (should (= 11 text-scale-mode-amount)))
+ (org-test-agenda--kill-all-agendas)))
+
+
(provide 'test-org-agenda)
;;; test-org-agenda.el ends here