emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Dudebout <nicolas.dudebout@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-agenda: make log and clockreport modes local
Date: Wed, 21 Feb 2018 21:42:19 -0500	[thread overview]
Message-ID: <CA+TMmKm=s1Wei=QE4gLZOQPqAVsvd1kwGgaqBWarcqV1RGvTUw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 878 bytes --]

`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.

Nicolas

[-- Attachment #1.2: Type: text/html, Size: 1004 bytes --]

[-- Attachment #2: 0001-org-agenda-make-log-and-clockreport-modes-local.patch --]
[-- Type: application/octet-stream, Size: 3248 bytes --]

From 73615019adc5f55215cd0cedde72aea97624ece4 Mon Sep 17 00:00:00 2001
From: Nicolas Dudebout <nicolas.dudebout@gmail.com>
Date: Wed, 21 Feb 2018 20:43:24 -0500
Subject: [PATCH] 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.
---
 lisp/org-agenda.el | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 67f590731..81c37f6ba 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2230,9 +2230,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
@@ -8204,7 +8204,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"
@@ -8228,7 +8227,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")))
-- 
2.16.1


             reply	other threads:[~2018-02-22  2:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22  2:42 Nicolas Dudebout [this message]
2018-02-22 13:39 ` [PATCH] org-agenda: make log and clockreport modes local Nicolas Goaziou
2018-02-22 14:20   ` Nicolas Dudebout
2018-02-22 20:41     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+TMmKm=s1Wei=QE4gLZOQPqAVsvd1kwGgaqBWarcqV1RGvTUw@mail.gmail.com' \
    --to=nicolas.dudebout@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).