emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
@ 2019-02-13  8:16 Allen Li
  2019-02-13  8:37 ` Allen Li
  2019-02-17  1:24 ` Allen Li
  0 siblings, 2 replies; 8+ messages in thread
From: Allen Li @ 2019-02-13  8:16 UTC (permalink / raw)
  To: emacs-orgmode

0. Make /tmp/tmp.org containing

* TODO foo bar

1. emacs -Q
2. Eval (setq org-agenda-custom-commands '(("n" "n" alltodo "" ((org-agenda-overriding-columns-format "%TODO")))))
3. Eval (setq org-agenda-files '("/tmp/tmp.org"))
4. M-x org-agenda RET n
5. Move point to item
6. C-c C-x C-c (column view)
7. g

Expected:

Column format is preserved

Actual:

Column format is reset

(The example uses the version of Org shipped with Emacs, but I can
reproduce with my personal config using latest org-contrib-plus)

Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05
Package: Org mode version 9.2.1 (9.2.1-2-gc6d37c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20190204/)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-13  8:16 Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)] Allen Li
@ 2019-02-13  8:37 ` Allen Li
  2019-02-13  9:11   ` Allen Li
  2019-02-17  1:24 ` Allen Li
  1 sibling, 1 reply; 8+ messages in thread
From: Allen Li @ 2019-02-13  8:37 UTC (permalink / raw)
  To: Org Mode List

On Wed, Feb 13, 2019 at 8:17 AM Allen Li <darkfeline@felesatra.moe> wrote:
>
> 0. Make /tmp/tmp.org containing
>
> * TODO foo bar
>
> 1. emacs -Q
> 2. Eval (setq org-agenda-custom-commands '(("n" "n" alltodo "" ((org-agenda-overriding-columns-format "%TODO")))))
> 3. Eval (setq org-agenda-files '("/tmp/tmp.org"))
> 4. M-x org-agenda RET n
> 5. Move point to item
> 6. C-c C-x C-c (column view)
> 7. g
>
> Expected:
>
> Column format is preserved
>
> Actual:
>
> Column format is reset
>
> (The example uses the version of Org shipped with Emacs, but I can
> reproduce with my personal config using latest org-contrib-plus)

I'm suspicious of org-agenda-mode -> kill-all-local-variables

Debugger entered--killing local value of
org-agenda-overriding-columns-format in buffer *Org
Agenda(f:SCHEDULED>"<today>")*:
  debug--implement-debug-watch(org-agenda-overriding-columns-format
nil makunbound #<buffer *Org Agenda(f:SCHEDULED>"<today>")*>)
  kill-all-local-variables()
  org-agenda-mode()
  org-agenda-prepare("TAGS SCHEDULED>\"<today>\"")
  org-tags-view((4) "SCHEDULED>\"<today>\"")
  (let ((org-agenda-sorting-strategy '(scheduled-up))
(org-agenda-overriding-columns-format "%TODO %60ITEM %SCHEDULED"))
(org-tags-view '(4) (if current-prefix-arg nil
"SCHEDULED>\"<today>\"")))
  eval((let ((org-agenda-sorting-strategy '(scheduled-up))
(org-agenda-overriding-columns-format "%TODO %60ITEM %SCHEDULED"))
(org-tags-view '(4) (if current-prefix-arg nil
"SCHEDULED>\"<today>\""))))
  org-let(((org-agenda-sorting-strategy '(scheduled-up))
(org-agenda-overriding-columns-format "%TODO %60ITEM %SCHEDULED"))
(org-tags-view '(4) (if current-prefix-arg nil
"SCHEDULED>\"<today>\"")))
  (if series-redo-cmd (eval series-redo-cmd) (org-let lprops redo-cmd))
  (let* ((p (or (and (looking-at "\\'") (1- (point))) (point))) (cpa
(if (eq all t) nil current-prefix-arg)) (org-agenda-doing-sticky-redo
org-agenda-sticky) (org-agenda-sticky nil) (org-agenda-buffer-name (or
org-agenda-this-buffer-name org-agenda-buffer-name))
(org-agenda-keep-modes t) (tag-filter org-agenda-tag-filter)
(tag-preset (get 'org-agenda-tag-filter :preset-filter))
(top-hl-filter org-agenda-top-headline-filter) (cat-filter
org-agenda-category-filter) (cat-preset (get
'org-agenda-category-filter :preset-filter)) (re-filter
org-agenda-regexp-filter) (re-preset (get 'org-agenda-regexp-filter
:preset-filter)) (effort-filter org-agenda-effort-filter)
(effort-preset (get 'org-agenda-effort-filter :preset-filter))
(org-agenda-tag-filter-while-redo (or tag-filter tag-preset)) (cols
org-agenda-columns-active) (line (org-current-line)) (window-line (-
line (org-current-line (window-start)))) (lprops (get
'org-agenda-redo-command 'org-lprops)) (redo-cmd (get-text-property p
'org-redo-cmd)) (last-args (get-text-property p 'org-last-args))
(org-agenda-overriding-cmd (get-text-property p 'org-series-cmd))
(org-agenda-overriding-cmd-arguments (if (eq all t) nil (cond ((listp
last-args) (cons (or cpa (car last-args)) (cdr last-args))) ((stringp
last-args) last-args)))) (series-redo-cmd (get-text-property p
'org-series-redo-cmd))) (put 'org-agenda-tag-filter :preset-filter
nil) (put 'org-agenda-category-filter :preset-filter nil) (put
'org-agenda-regexp-filter :preset-filter nil) (put
'org-agenda-effort-filter :preset-filter nil) (and cols
(org-columns-quit)) (message "Rebuilding agenda buffer...") (if
series-redo-cmd (eval series-redo-cmd) (org-let lprops redo-cmd))
(setq org-agenda-undo-list nil org-agenda-pending-undo-list nil
org-agenda-tag-filter tag-filter org-agenda-category-filter cat-filter
org-agenda-regexp-filter re-filter org-agenda-effort-filter
effort-filter org-agenda-top-headline-filter top-hl-filter) (message
"Rebuilding agenda buffer...done") (put 'org-agenda-tag-filter
:preset-filter tag-preset) (put 'org-agenda-category-filter
:preset-filter cat-preset) (put 'org-agenda-regexp-filter
:preset-filter re-preset) (put 'org-agenda-effort-filter
:preset-filter effort-preset) (let ((tag (or tag-filter tag-preset))
(cat (or cat-filter cat-preset)) (effort (or effort-filter
effort-preset)) (re (or re-filter re-preset))) (if tag (progn
(org-agenda-filter-apply tag 'tag t))) (if cat (progn
(org-agenda-filter-apply cat 'category))) (if effort (progn
(org-agenda-filter-apply effort 'effort))) (if re (progn
(org-agenda-filter-apply re 'regexp)))) (and top-hl-filter
(org-agenda-filter-top-headline-apply top-hl-filter)) (and cols
(called-interactively-p 'any) (org-agenda-columns)) (org-goto-line
line) (recenter window-line))
  org-agenda-redo()

One oddity is that repeatedly reverting the buffer swaps between the
"correct" overriding column format and the default.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-13  8:37 ` Allen Li
@ 2019-02-13  9:11   ` Allen Li
  2019-02-13  9:25     ` Allen Li
  0 siblings, 1 reply; 8+ messages in thread
From: Allen Li @ 2019-02-13  9:11 UTC (permalink / raw)
  To: Org Mode List

On Wed, Feb 13, 2019 at 8:37 AM Allen Li <darkfeline@felesatra.moe> wrote:
>
> I'm suspicious of org-agenda-mode -> kill-all-local-variables=
>
> One oddity is that repeatedly reverting the buffer swaps between the
> "correct" overriding column format and the default.

It seems like what is happening is that the org-agenda-prepare and
org-agenda-finalize calls in org-tags-view are swapping
org-agenda-overriding-columns-format (ocf) on and off.  I added debug
messages around these points, and a cycle looks like:

@@@@@@@ before prepare "%TODO %60ITEM %SCHEDULED"
@@@@@@@ after prepare "%TODO %60ITEM %SCHEDULED"
@@@@@@@ before finalize "%TODO %60ITEM %SCHEDULED"
@@@@@@@ after finalize "%TODO %60ITEM %SCHEDULED"
@@@@@@@ before prepare "%TODO %60ITEM %SCHEDULED"
@@@@@@@ after prepare nil
@@@@@@@ before finalize nil
@@@@@@@ after finalize nil

During the first cycle, prepare doesn't unset the local value for ocf
because it's not set, then in finalize the local value of ocf is set
using the current dynamic value.

During the second cycle, ocf is set locally so prepare wipes the local
value.  It looks like this also wipes the current let-bound dynamic
value for ocf, so during finalize ocf is not (re)set as a local value.

Go back to first cycle.

I don't see an easy good fix due to how Emacs's dynamic variable
binding works with respect to buffer local variables.

One way to fix is redefine:

(defun org-let (list &rest body)
  (eval `(with-temp-buffer ,(cons 'let (cons list body)))))

That way, the let doesn't use the buffer local value for ocf, so the
kill-all-local-variables doesn't wipe it.

I can confirm that this fixes this bug.  However, I have no idea what
effect this may have on all of Org mode.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-13  9:11   ` Allen Li
@ 2019-02-13  9:25     ` Allen Li
  0 siblings, 0 replies; 8+ messages in thread
From: Allen Li @ 2019-02-13  9:25 UTC (permalink / raw)
  To: Org Mode List

Apologies for the spam.

On Wed, Feb 13, 2019 at 9:11 AM Allen Li <darkfeline@felesatra.moe> wrote:
> I don't see an easy good fix due to how Emacs's dynamic variable
> binding works with respect to buffer local variables.
>
> One way to fix is redefine:
>
> (defun org-let (list &rest body)
>   (eval `(with-temp-buffer ,(cons 'let (cons list body)))))

This does not work for obvious reasons, please don't use it.  I'll
shut up now since I clearly need sleep.

>
> That way, the let doesn't use the buffer local value for ocf, so the
> kill-all-local-variables doesn't wipe it.
>
> I can confirm that this fixes this bug.  However, I have no idea what
> effect this may have on all of Org mode.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-13  8:16 Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)] Allen Li
  2019-02-13  8:37 ` Allen Li
@ 2019-02-17  1:24 ` Allen Li
  2019-02-18 21:16   ` Nicolas Goaziou
  1 sibling, 1 reply; 8+ messages in thread
From: Allen Li @ 2019-02-17  1:24 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

On Wed, Feb 13, 2019 at 8:17 AM Allen Li <darkfeline@felesatra.moe> wrote:
>
> 0. Make /tmp/tmp.org containing
>
> * TODO foo bar
>
> 1. emacs -Q
> 2. Eval (setq org-agenda-custom-commands '(("n" "n" alltodo "" ((org-agenda-overriding-columns-format "%TODO")))))
> 3. Eval (setq org-agenda-files '("/tmp/tmp.org"))
> 4. M-x org-agenda RET n
> 5. Move point to item
> 6. C-c C-x C-c (column view)
> 7. g
>
> Expected:
>
> Column format is preserved
>
> Actual:
>
> Column format is reset
>
> (The example uses the version of Org shipped with Emacs, but I can
> reproduce with my personal config using latest org-contrib-plus)

I think the right way to fix this is by using a separate variable for
setting buffer local values.

I have attached a patch implementing this on maint.

>
> Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
>  of 2018-07-05
> Package: Org mode version 9.2.1 (9.2.1-2-gc6d37c-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20190204/)

[-- Attachment #2: 0001-Fix-buffer-local-org-agenda-overriding-columns-forma.patch --]
[-- Type: text/x-patch, Size: 2725 bytes --]

From eba87f9de87cc661c99d12ef31b961c36b3d528b Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Sat, 16 Feb 2019 17:21:04 -0800
Subject: [PATCH] Fix buffer local org-agenda-overriding-columns-format bug

Setting org-agenda-overriding-columns-format as a buffer local value
interferes with how it is used as a dynamically scoped var, so use a
separate variable for buffer local setting.
---
 lisp/org-agenda.el  | 3 ++-
 lisp/org-colview.el | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 489ecec95..054c0b268 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3768,6 +3768,7 @@ FILTER-ALIST is an alist of filters we need to apply when
       (setq buffer-read-only nil))))
 
 (defvar org-agenda-overriding-columns-format)  ; From org-colview.el
+(defvar org-agenda-local-overriding-columns-format)  ; From org-colview.el
 (defun org-agenda-finalize ()
   "Finishing touch for the agenda buffer, called just before displaying it."
   (unless org-agenda-multi
@@ -3783,7 +3784,7 @@ FILTER-ALIST is an alist of filters we need to apply when
 	(unless org-agenda-with-colors
 	  (remove-text-properties (point-min) (point-max) '(face nil)))
 	(when (bound-and-true-p org-agenda-overriding-columns-format)
-	  (setq-local org-agenda-overriding-columns-format
+	  (setq-local org-agenda-local-overriding-columns-format
 		      org-agenda-overriding-columns-format))
 	(when org-agenda-view-columns-initially
 	  (org-agenda-columns))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 746426bc7..2fbb5aa6c 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -567,7 +567,13 @@ for the duration of the command.")
 
 (defvar org-agenda-overriding-columns-format nil
   "When set, overrides any other format definition for the agenda.
-Don't set this, this is meant for dynamic scoping.")
+Don't set this, this is meant for dynamic scoping.  Set
+`org-agenda-local-overriding-columns-format' instead.")
+
+(defvar-local org-agenda-local-overriding-columns-format nil
+  "When set, overrides any other format definition for the agenda.
+This can be set as a buffer local value to avoid interfering with
+dynamic scoping for `org-agenda-overriding-columns-format'.")
 
 (defun org-columns-edit-value (&optional key)
   "Edit the value of the property at point in column view.
@@ -1564,6 +1570,7 @@ PARAMS is a property list of parameters:
 	 (fmt
 	  (cond
 	   ((bound-and-true-p org-agenda-overriding-columns-format))
+	   ((bound-and-true-p org-agenda-local-overriding-columns-format))
 	   ((let ((m (org-get-at-bol 'org-hd-marker)))
 	      (and m
 		   (or (org-entry-get m "COLUMNS" t)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-17  1:24 ` Allen Li
@ 2019-02-18 21:16   ` Nicolas Goaziou
  2019-02-25  8:01     ` Allen Li
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2019-02-18 21:16 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

Hello,

Allen Li <darkfeline@felesatra.moe> writes:

> I have attached a patch implementing this on maint.

Thank you. Some comments follow.

> Subject: [PATCH] Fix buffer local org-agenda-overriding-columns-format bug
>
> Setting org-agenda-overriding-columns-format as a buffer local value
> interferes with how it is used as a dynamically scoped var, so use a
> separate variable for buffer local setting.

You need to include variables and functions modified in the commit
message, so grepping through them more fruitful.

>  (defvar org-agenda-overriding-columns-format)  ; From org-colview.el
> +(defvar org-agenda-local-overriding-columns-format)  ; From org-colview.el

You can remove the inline comment at the end of the line (and the one
above).

>  (defun org-agenda-finalize ()
>    "Finishing touch for the agenda buffer, called just before displaying it."
>    (unless org-agenda-multi
> @@ -3783,7 +3784,7 @@ FILTER-ALIST is an alist of filters we need to apply when
>  	(unless org-agenda-with-colors
>  	  (remove-text-properties (point-min) (point-max) '(face nil)))
>  	(when (bound-and-true-p org-agenda-overriding-columns-format)
> -	  (setq-local org-agenda-overriding-columns-format
> +	  (setq-local org-agenda-local-overriding-columns-format

Since this is a local variable, `setq' is enough, isn't it?

>  		      org-agenda-overriding-columns-format))
>  	(when org-agenda-view-columns-initially
>  	  (org-agenda-columns))
> diff --git a/lisp/org-colview.el b/lisp/org-colview.el
> index 746426bc7..2fbb5aa6c 100644
> --- a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -567,7 +567,13 @@ for the duration of the command.")
>  
>  (defvar org-agenda-overriding-columns-format nil
>    "When set, overrides any other format definition for the agenda.
> -Don't set this, this is meant for dynamic scoping.")
> +Don't set this, this is meant for dynamic scoping.  Set
> +`org-agenda-local-overriding-columns-format' instead.")

The first line of a docstring cannot contain an incomplete sentence (due
to `apropos` design).

> +(defvar-local org-agenda-local-overriding-columns-format nil
> +  "When set, overrides any other format definition for the agenda.
> +This can be set as a buffer local value to avoid interfering with
> +dynamic scoping for `org-agenda-overriding-columns-format'.")

The two variable names are somewhat confusing. Could
`org-agenda-local-overriding-columns-format' be renamed into
`org-local-columns-format'? Since it is defined in "org-colview.el", it
doesn't deserve the "org-agenda" prefix (and neither does the original
`org-agenda-overriding-columns-format'.).

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-18 21:16   ` Nicolas Goaziou
@ 2019-02-25  8:01     ` Allen Li
  2019-02-25 12:48       ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Allen Li @ 2019-02-25  8:01 UTC (permalink / raw)
  To: Allen Li, Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

Thank you for the comments, attached new patch.

On Mon, Feb 18, 2019 at 9:16 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> >  (defun org-agenda-finalize ()
> >    "Finishing touch for the agenda buffer, called just before displaying it."
> >    (unless org-agenda-multi
> > @@ -3783,7 +3784,7 @@ FILTER-ALIST is an alist of filters we need to apply when
> >       (unless org-agenda-with-colors
> >         (remove-text-properties (point-min) (point-max) '(face nil)))
> >       (when (bound-and-true-p org-agenda-overriding-columns-format)
> > -       (setq-local org-agenda-overriding-columns-format
> > +       (setq-local org-agenda-local-overriding-columns-format
>
> Since this is a local variable, `setq' is enough, isn't it?

I don't know if the defvar-local in org-colview will be loaded before
this point,
so I think it's safer to just use setq-local.

> >  (defvar org-agenda-overriding-columns-format nil
> >    "When set, overrides any other format definition for the agenda.
> > -Don't set this, this is meant for dynamic scoping.")
> > +Don't set this, this is meant for dynamic scoping.  Set
> > +`org-agenda-local-overriding-columns-format' instead.")
>
> The first line of a docstring cannot contain an incomplete sentence (due
> to `apropos` design).

I think you misread?  I didn't touch the first line.

>
> > +(defvar-local org-agenda-local-overriding-columns-format nil
> > +  "When set, overrides any other format definition for the agenda.
> > +This can be set as a buffer local value to avoid interfering with
> > +dynamic scoping for `org-agenda-overriding-columns-format'.")
>
> The two variable names are somewhat confusing. Could
> `org-agenda-local-overriding-columns-format' be renamed into
> `org-local-columns-format'? Since it is defined in "org-colview.el", it
> doesn't deserve the "org-agenda" prefix (and neither does the original
> `org-agenda-overriding-columns-format'.).
>
> Regards,
>
> --
> Nicolas Goaziou

[-- Attachment #2: 0001-Fix-buffer-local-org-agenda-overriding-columns-forma.patch --]
[-- Type: text/x-patch, Size: 5488 bytes --]

From a8814962e73af61ebbbdeb20eceb53e09d030b06 Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Sat, 16 Feb 2019 17:21:04 -0800
Subject: [PATCH] Fix buffer local org-agenda-overriding-columns-format bug

Setting org-agenda-overriding-columns-format as a buffer local value
interferes with how it is used as a dynamically scoped var, so use a
separate variable for buffer local setting.

* doc/org-manual.org (Using Column View in the Agenda): Updated
  reference to variable.
* lisp/org-agenda.el (org-agenda-finalize): Set buffer local variable
  instead.
* lisp/org-colview.el (org-overriding-columns-format): Renamed.
(org-agenda-overriding-columns-format): Renamed.
(org-local-columns-format): New buffer local variable.
(org-columns-edit-value): Updated reference to variable.
(org-columns-next-allowed-value): Updated reference to variable.
(org-agenda-columns): Updated reference to variable.
---
 doc/org-manual.org  |  2 +-
 lisp/org-agenda.el  |  9 +++++----
 lisp/org-colview.el | 20 +++++++++++++++-----
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index a1cc35608..a8c52681b 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -10477,7 +10477,7 @@ environment.  This causes the following issues:
    the entries in the agenda are collected from different files, and
    different files may have different columns formats, this is
    a non-trivial problem.  Org first checks if the variable
-   ~org-agenda-overriding-columns-format~ is currently set, and if so,
+   ~org-overriding-columns-format~ is currently set, and if so,
    takes the format from there.  Otherwise it takes the format
    associated with the first item in the agenda, or, if that item does
    not have a specific format (defined in a property, or in its file),
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c1a8a44f2..4a0604a9b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3766,7 +3766,8 @@ FILTER-ALIST is an alist of filters we need to apply when
 	     (setq-local org-agenda-name name)))
       (setq buffer-read-only nil))))
 
-(defvar org-agenda-overriding-columns-format)  ; From org-colview.el
+(defvar org-overriding-columns-format)
+(defvar org-local-columns-format)
 (defun org-agenda-finalize ()
   "Finishing touch for the agenda buffer, called just before displaying it."
   (unless org-agenda-multi
@@ -3781,9 +3782,9 @@ FILTER-ALIST is an alist of filters we need to apply when
 	  (org-agenda-align-tags))
 	(unless org-agenda-with-colors
 	  (remove-text-properties (point-min) (point-max) '(face nil)))
-	(when (bound-and-true-p org-agenda-overriding-columns-format)
-	  (setq-local org-agenda-overriding-columns-format
-		      org-agenda-overriding-columns-format))
+	(when (bound-and-true-p org-overriding-columns-format)
+	  (setq-local org-local-columns-format
+		      org-overriding-columns-format))
 	(when org-agenda-view-columns-initially
 	  (org-agenda-columns))
 	(when org-agenda-fontify-priorities
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 746426bc7..a7a441649 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -565,9 +565,18 @@ for the duration of the command.")
       (org-columns-next-allowed-value)
     (org-columns-edit-value "TAGS")))
 
-(defvar org-agenda-overriding-columns-format nil
+(define-obsolete-variable-alias 'org-agenda-overriding-columns-format
+  'org-overriding-columns-format "Org 9.2.2")
+
+(defvar org-overriding-columns-format nil
+  "When set, overrides any other format definition for the agenda.
+Don't set this, this is meant for dynamic scoping.  Set
+`org-local-columns-format' instead.")
+
+(defvar-local org-local-columns-format nil
   "When set, overrides any other format definition for the agenda.
-Don't set this, this is meant for dynamic scoping.")
+This can be set as a buffer local value to avoid interfering with
+dynamic scoping for `org-overriding-columns-format'.")
 
 (defun org-columns-edit-value (&optional key)
   "Edit the value of the property at point in column view.
@@ -628,7 +637,7 @@ Where possible, use the standard interface for changing this line."
       (org-columns--call action)
       ;; The following let preserves the current format, and makes
       ;; sure that in only a single file things need to be updated.
-      (let* ((org-agenda-overriding-columns-format org-columns-current-fmt)
+      (let* ((org-overriding-columns-format org-columns-current-fmt)
 	     (buffer (marker-buffer pom))
 	     (org-agenda-contributing-files
 	      (list (with-current-buffer buffer
@@ -722,7 +731,7 @@ an integer, select that value."
 	(org-columns--call action)
 	;; The following let preserves the current format, and makes
 	;; sure that in only a single file things need to be updated.
-	(let* ((org-agenda-overriding-columns-format org-columns-current-fmt)
+	(let* ((org-overriding-columns-format org-columns-current-fmt)
 	       (buffer (marker-buffer pom))
 	       (org-agenda-contributing-files
 		(list (with-current-buffer buffer
@@ -1563,7 +1572,8 @@ PARAMS is a property list of parameters:
   (let* ((org-columns--time (float-time))
 	 (fmt
 	  (cond
-	   ((bound-and-true-p org-agenda-overriding-columns-format))
+	   ((bound-and-true-p org-overriding-columns-format))
+	   ((bound-and-true-p org-local-columns-format))
 	   ((let ((m (org-get-at-bol 'org-hd-marker)))
 	      (and m
 		   (or (org-entry-get m "COLUMNS" t)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
  2019-02-25  8:01     ` Allen Li
@ 2019-02-25 12:48       ` Nicolas Goaziou
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2019-02-25 12:48 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

Hello,

Allen Li <darkfeline@felesatra.moe> writes:

> Subject: [PATCH] Fix buffer local org-agenda-overriding-columns-format bug
>
> Setting org-agenda-overriding-columns-format as a buffer local value
> interferes with how it is used as a dynamically scoped var, so use a
> separate variable for buffer local setting.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-02-25 12:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-13  8:16 Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)] Allen Li
2019-02-13  8:37 ` Allen Li
2019-02-13  9:11   ` Allen Li
2019-02-13  9:25     ` Allen Li
2019-02-17  1:24 ` Allen Li
2019-02-18 21:16   ` Nicolas Goaziou
2019-02-25  8:01     ` Allen Li
2019-02-25 12:48       ` Nicolas Goaziou

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