From: Allen Li <darkfeline@felesatra.moe>
To: Allen Li <darkfeline@felesatra.moe>,
Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]
Date: Mon, 25 Feb 2019 08:01:39 +0000 [thread overview]
Message-ID: <CADbSrJy91B3ei13tGGdYBVk1ed+N1jFr9iTq0Tt_DAsvk9hD8A@mail.gmail.com> (raw)
In-Reply-To: <87r2c4sspm.fsf@nicolasgoaziou.fr>
[-- 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
next prev parent reply other threads:[~2019-02-25 8:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2019-02-25 12:48 ` 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=CADbSrJy91B3ei13tGGdYBVk1ed+N1jFr9iTq0Tt_DAsvk9hD8A@mail.gmail.com \
--to=darkfeline@felesatra.moe \
--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).