From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathaniel Nicandro Subject: Re: Bug: clocktable error in org-agenda [9.2.2 (release_9.2.2-245-g9d7b1e @ /home/dortmann/src/git-org-mode/lisp/)] Date: Sat, 09 Mar 2019 00:17:55 -0600 Message-ID: References: <998d3a9c-b6bf-85f2-4dac-46be5ce9fb1e@oracle.com> <87r2bmyvy9.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([209.51.188.92]:37543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2VJ3-0007jp-3F for emacs-orgmode@gnu.org; Sat, 09 Mar 2019 01:18:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2VJ2-0001NY-7j for emacs-orgmode@gnu.org; Sat, 09 Mar 2019 01:18:00 -0500 Received: from mail-it1-x129.google.com ([2607:f8b0:4864:20::129]:38671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h2VJ1-0001MQ-Vb for emacs-orgmode@gnu.org; Sat, 09 Mar 2019 01:18:00 -0500 Received: by mail-it1-x129.google.com with SMTP id l66so24647474itg.3 for ; Fri, 08 Mar 2019 22:17:59 -0800 (PST) In-Reply-To: (Daniel Ortmann's message of "Tue, 5 Mar 2019 12:49:36 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Daniel Ortmann Cc: emacs-orgmode@gnu.org I am also experiencing this issue. I'm assuming =org-agenda-sticky= is set to =t= in your configuration since that is what I have in mine. I've tracked the problem down to (1) the handling of =org-agenda-sticky= in =org-agenda-goto-date=, (2) how this affects what =org-agenda-mode= (called by =org-agenda-redo=) does with =org-agenda-local-vars=, and (3) the subsequent modification of variables in =org-agenda-local-vars= before another call to =org-agenda-redo=. 1. =org-agenda-goto-date= temporarily sets =org-agenda-sticky= to =nil= before it calls =org-agenda-redo=. 2. None of the variables in =org-agenda-local-vars= are made buffer local when =org-agenda-redo= calls =org-agenda-mode= during the call to =org-agenda-goto-date=. 3. Setting one of the variables in =org-agenda-local-vars= after (2) happens actually sets its global value instead of its local value. So, for example, calling =org-agenda-log-mode= will set the global value of =org-agenda-show-log= to =t=. Once =org-agenda-redo= is called, it will once again be a local variable, but now the default global value is =t=. The main reason why log mode stays on when you try to toggle it off is because the =reset-saved= function in =org-agenda-mode= (which restores the saved values of =org-agenda-local-vars= after all local variables have been killed and re-made as local variables) does not set the value of any local variable whose saved value is =nil=. Since the local value of =org-agenda-show-log= is =nil= when you try to toggle log mode off, its buffer local value is not reset to =nil= by =reset-saved=. This means that it keeps the default global value it had when it was made into a local variable and this value is now =t= due to (3). So I think the main issue here is that =org-agenda-goto-date= does not handle =org-agenda-sticky= correctly since none of the =org-agenda-local-vars= are turned back into local variables during =org-agenda-redo= when =org-agenda-sticky= is =t=. Another possible issue is that the =reset-saved= function in =org-agenda-mode= does not set the value of variables if they are =nil=, but this is not an issue if the variables it resets are guaranteed to always have a global default of =nil=. I haven't looked into why =org-agenda-goto-date= needs to temporarily set =org-agenda-sticky= to =nil. Maybe someone can answer that, but a solution until that gets figured out is to allow =reset-saved= to set =nil= values. - Nathaniel