Преглед на файлове

org-agenda: make log and clockreport modes local

* lisp/org-agenda.el (org-agenda-mode): Only set `org-agenda-show-log'
  and `org-agenda-clock-report-mode' to their default values when
  constructing an agenda buffer, and not when redoing it.
* lisp/org-agenda.el (org-agenda-log-mode,
  org-agenda-clockreport-mode): Do not set the global default value
  `org-agenda-start-with-log-mode' (respectively
  `org-agenda-start-with-clockreport-mode') with the current value of
  `org-agenda-log-mode' (respectively `org-agenda-clockreport-mode'),
  which, with sticky agendas is even buffer local.

`org-agenda-show-log' indicates if the the current agenda buffer has
log-mode enabled.  When building a new agenda buffer, it gets its
value from `org-agenda-start-with-log-mode'.  It is is semantically a
buffer local variable: when creating a new agenda buffer you expect it
to be set to the value in `org-agenda-start-with-log-mode'.  However,
2e9c2d71 while fixing an issue with sticky agendas rendered the
variable `org-agenda-log-mode' effectively global: toggling log mode
in a given agenda buffer modifies the global default for all agenda
buffers.  The same reasoning holds for clockreport mode.

This change ensures that a log or clockreport mode change made in one
agenda buffer does not propagate to other agenda buffers, existing or
new.  The change is however preserved on org-agenda-redo in the
initial agenda buffer, whether using sticky agendas or not.

TINYCHANGE
Nicolas Dudebout преди 7 години
родител
ревизия
db90aadd38
променени са 1 файла, в които са добавени 3 реда и са изтрити 5 реда
  1. 3 5
      lisp/org-agenda.el

+ 3 - 5
lisp/org-agenda.el

@@ -2213,9 +2213,9 @@ The following commands are available:
 	    nil t)
   (unless org-agenda-keep-modes
     (setq org-agenda-follow-mode org-agenda-start-with-follow-mode
-	  org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode))
-  (setq org-agenda-show-log org-agenda-start-with-log-mode)
-  (setq org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode)
+	  org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode
+	  org-agenda-show-log org-agenda-start-with-log-mode
+	  org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode))
   (add-to-invisibility-spec '(org-filtered))
   (add-to-invisibility-spec '(org-link))
   (easy-menu-change
@@ -8187,7 +8187,6 @@ so that the date SD will be in that range."
   (interactive)
   (org-agenda-check-type t 'agenda)
   (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode))
-  (setq org-agenda-start-with-clockreport-mode org-agenda-clockreport-mode)
   (org-agenda-set-mode-name)
   (org-agenda-redo)
   (message "Clocktable mode is %s"
@@ -8211,7 +8210,6 @@ log items, nothing else."
 	      nil 'clockcheck))
 	 (special '(closed clock state))
 	 (t (not org-agenda-show-log))))
-  (setq org-agenda-start-with-log-mode org-agenda-show-log)
   (org-agenda-set-mode-name)
   (org-agenda-redo)
   (message "Log mode is %s" (if org-agenda-show-log "on" "off")))