emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix match/maxlevel conflict in colview dynblock
@ 2021-07-12  3:51 Nick Dokos
  2021-08-31 14:33 ` Timothy
  2022-10-25  9:02 ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Dokos @ 2021-07-12  3:51 UTC (permalink / raw)
  To: emacs-orgmode

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


Specifying both `maxlevel' and `match' in a columnview dynamic block
was broken: the `match' argument is ignored in that case. See the link
below for a (not so minimal) ECM.

Reported-by: Pablo A Perez-Fernandez
Link: https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Fix match/maxlevel conflict in colview dynblock --]
[-- Type: text/x-patch, Size: 1410 bytes --]

From 8bcff482e59c24758f87b9b5cdef3bc123dc12f8 Mon Sep 17 00:00:00 2001
From: Nick Dokos <ndokos@gmail.com>
Date: Sun, 11 Jul 2021 22:30:22 -0400
Subject: [PATCH] Fix match/maxlevel conflict in colview dynblock

* lisp/org-coplview.el (org-columns--capture-view): Combine the match
and maxlevel arguments properly to construct the MATCH argument of
`org-map-entries'.

Specifying both `maxlevel' and `match' in a columnview dynamic block
does not work: the `match' argument is ignored in that case. See the
link below for a (not so minimal) ECM.

Reported-by: Pablo A Perez-Fernandez
Link: https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags
---
 lisp/org-colview.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 2e1c29a99..7144308ff 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1398,8 +1398,9 @@ other rows.  Each row is a list of fields, as strings, or
 				  (org-get-tags))))
 	     (push (cons (org-reduced-level (org-current-level)) (nreverse row))
 		   table)))))
-     (or (and maxlevel (format "LEVEL<=%d" maxlevel))
-	 (and match match))
+     (if match
+         (concat match (and maxlevel (format "+LEVEL<=%d" maxlevel)))
+       (and maxlevel (format "LEVEL<=%d" maxlevel)))
      (and local 'tree)
      'archive 'comment)
     (org-columns-quit)
-- 
2.31.1


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

* Re: [PATCH] Fix match/maxlevel conflict in colview dynblock
  2021-07-12  3:51 [PATCH] Fix match/maxlevel conflict in colview dynblock Nick Dokos
@ 2021-08-31 14:33 ` Timothy
  2021-08-31 18:19   ` Nick Dokos
  2022-10-25  9:02 ` Ihor Radchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Timothy @ 2021-08-31 14:33 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

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

Hi Nick,

Thanks for reporting this issue here, and providing a patch. Unfortunately the
“main maintainers” seem to be rather busy as of late, leaving you hanging for
quite a while. I’ve had a look at the issue and your patch, and it the issue
seems clear, and your patch small and straightforward enough that I feel
confident pushing it should be fine :) it’s now on master with a small tweak to
the commit message.

Thanks for your efforts.

> Specifying both `maxlevel’ and `match’ in a columnview dynamic block
> was broken: the `match’ argument is ignored in that case. See the link
> below for a (not so minimal) ECM.
>
> Reported-by: Pablo A Perez-Fernandez
> Link: <https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags>
>
> –
> Nick
>
> “There are only two hard problems in computer science: cache
> invalidation, naming things, and off-by-one errors.” -Martin Fowler
>
> From 8bcff482e59c24758f87b9b5cdef3bc123dc12f8 Mon Sep 17 00:00:00 2001
> From: Nick Dokos <ndokos@gmail.com>
> Date: Sun, 11 Jul 2021 22:30:22 -0400
> Subject: [PATCH] Fix match/maxlevel conflict in colview dynblock
>
> * lisp/org-coplview.el (org-columns–capture-view): Combine the match
> and maxlevel arguments properly to construct the MATCH argument of
> `org-map-entries’.
>
> Specifying both `maxlevel’ and `match’ in a columnview dynamic block
> does not work: the `match’ argument is ignored in that case. See the
> link below for a (not so minimal) ECM.
>
> Reported-by: Pablo A Perez-Fernandez
> Link: <https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags>
> —
>  lisp/org-colview.el | 5 +++–
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff –git a/lisp/org-colview.el b/lisp/org-colview.el
> index 2e1c29a99..7144308ff 100644
> — a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -1398,8 +1398,9 @@ other rows.  Each row is a list of fields, as strings, or
>  				  (org-get-tags))))
>  	     (push (cons (org-reduced-level (org-current-level)) (nreverse row))
>  		   table)))))
> -     (or (and maxlevel (format “LEVEL<=%d” maxlevel))
> -	 (and match match))
> +     (if match
> +         (concat match (and maxlevel (format “+LEVEL<=%d” maxlevel)))
> +       (and maxlevel (format “LEVEL<=%d” maxlevel)))
>       (and local ’tree)
>       ’archive ’comment)
>      (org-columns-quit)


All the best,
Timothy

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

* Re: [PATCH] Fix match/maxlevel conflict in colview dynblock
  2021-08-31 14:33 ` Timothy
@ 2021-08-31 18:19   ` Nick Dokos
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Dokos @ 2021-08-31 18:19 UTC (permalink / raw)
  To: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> Hi Nick,
>
> Thanks for reporting this issue here, and providing a patch. Unfortunately the
> “main maintainers” seem to be rather busy as of late, leaving you hanging for
> quite a while. I’ve had a look at the issue and your patch, and it the issue
> seems clear, and your patch small and straightforward enough that I feel
> confident pushing it should be fine :) it’s now on master with a small tweak to
> the commit message.
>
> Thanks for your efforts.
>

Hi Timothy,

Thanks and no worries! And thanks for working through the backlog!

--
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



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

* Re: [PATCH] Fix match/maxlevel conflict in colview dynblock
  2021-07-12  3:51 [PATCH] Fix match/maxlevel conflict in colview dynblock Nick Dokos
  2021-08-31 14:33 ` Timothy
@ 2022-10-25  9:02 ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-10-25  9:02 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Specifying both `maxlevel' and `match' in a columnview dynamic block
> was broken: the `match' argument is ignored in that case. See the link
> below for a (not so minimal) ECM.
>
> Reported-by: Pablo A Perez-Fernandez
> Link: https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags

Thanks for the patch, and sorry for the late reply.
Would you also be able to supply a test for testing/lisp/test-org-colview.el?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2022-10-25  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12  3:51 [PATCH] Fix match/maxlevel conflict in colview dynblock Nick Dokos
2021-08-31 14:33 ` Timothy
2021-08-31 18:19   ` Nick Dokos
2022-10-25  9:02 ` Ihor Radchenko

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