From: Allen Li <darkfeline@felesatra.moe>
To: 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: Sun, 17 Feb 2019 01:24:59 +0000 [thread overview]
Message-ID: <CADbSrJxokrUyMTXM8cOrY+TMut0Yg5Kr6TRK=FO-WeU4PLRVdA@mail.gmail.com> (raw)
In-Reply-To: <808syk5cis.fsf@felesatra.moe>
[-- 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
next prev parent reply other threads:[~2019-02-17 1:25 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 [this message]
2019-02-18 21:16 ` Nicolas Goaziou
2019-02-25 8:01 ` Allen Li
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='CADbSrJxokrUyMTXM8cOrY+TMut0Yg5Kr6TRK=FO-WeU4PLRVdA@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).