all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* After years without issues,  Orgmode now fails to apply agenda filters to preset templates
@ 2024-05-25 19:08 Tory S. Anderson
  2024-05-25 19:26 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Tory S. Anderson @ 2024-05-25 19:08 UTC (permalink / raw)
  To: orgmode list

Hello,

After years without issue where I could choose, for example, to see my daily work agenda, the filters are now failing to be applied. This is in org 9.6.15, as shipped with my emacs 29.3. I have verified that this problem is the same in =emacs -Q= without any other packages: when I choose my agenda view, such as "C-a w d" for my daily work agenda, I still get an agenda buffer named "Org_Agenda(wd)", but none of my preset filters have applied. I skimmed the documentation and I haven't seen any changed syntax. Here is my definition from my =use-package org= =:custom= section:

#+begin_src lisp
      (org-agenda-custom-commands
	    '(("w" . "Work")
	      ("wd" "Work Day"
	       ((agenda ""
			((org-agenda-span 1)
			 (org-agenda-start-on-weekday nil)
			 (org-agenda-regexp-filter-preset
			  '("+ODH\\|AGENDA\\|CONFERENCE" "-TSA\\|PRIESTHOOD")))))
	       nil)))
#+end_src

Why has this stopped applying my filter when it worked for so long? Is it a bug, or do I need to change something to make it up-to-date?

(I'm cross-posting this to both reddit and the orgmode mailing list since the two audiences might not overlap much)


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

* Re: After years without issues,  Orgmode now fails to apply agenda filters to preset templates
  2024-05-25 19:08 After years without issues, Orgmode now fails to apply agenda filters to preset templates Tory S. Anderson
@ 2024-05-25 19:26 ` Ihor Radchenko
  2024-05-30 11:17   ` Pedro
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-05-25 19:26 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: orgmode list

webdev@toryanderson.com (Tory S. Anderson) writes:

> After years without issue where I could choose, for example, to see my
> daily work agenda, the filters are now failing to be applied. This is
> in org 9.6.15, as shipped with my emacs 29.3. I have verified that
> this problem is the same in =emacs -Q= without any other packages:
> when I choose my agenda view, such as "C-a w d" for my daily work
> agenda, I still get an agenda buffer named "Org_Agenda(wd)", but none
> of my preset filters have applied. I skimmed the documentation and I
> haven't seen any changed syntax. Here is my definition from my
> =use-package org= =:custom= section:
>
> #+begin_src lisp
>       (org-agenda-custom-commands
> 	    '(("w" . "Work")
> 	      ("wd" "Work Day"
> 	       ((agenda ""
> 			((org-agenda-span 1)
> 			 (org-agenda-start-on-weekday nil)
> 			 (org-agenda-regexp-filter-preset
> 			  '("+ODH\\|AGENDA\\|CONFERENCE" "-TSA\\|PRIESTHOOD")))))
> 	       nil)))
> #+end_src

According to the docstring of `org-agenda-regexp-filter-preset',

    ...The preset filter is a global property of
    the entire agenda view.  In a block agenda, it will not work reliably to
    define a filter for one of the individual blocks.  You need to set it in
    the global options and expect it to be applied to the entire view.

So, you should set this variable as a part of global agenda command
settings, not inside individual block.

Not a bug.
Canceled.

> Why has this stopped applying my filter when it worked for so long? Is
> it a bug, or do I need to change something to make it up-to-date?

I have no idea because you did not tell which Org mode version had your
settings working. I suspect that it could have happened around the time
Org mode switched from dynamic binding to lexical binding, but it is
just a blind guess.

-- 
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] 5+ messages in thread

* Re: After years without issues, Orgmode now fails to apply agenda filters to preset templates
  2024-05-25 19:26 ` Ihor Radchenko
@ 2024-05-30 11:17   ` Pedro
  2024-05-30 16:15     ` Tory S. Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro @ 2024-05-30 11:17 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 2287 bytes --]

Hi Tory,

I use the same version emacs and orgmode version as you, and I have 
similar needs as you: filtering org-agenda by tags, etc.

I will share my whole section of org-agenda-custom-commands as it is, I 
hope you can followup it nicely. Find it attached in file: 
agenda-filters.org

Cheers,
Pedro

On 5/25/24 21:26, Ihor Radchenko wrote:
> webdev@toryanderson.com (Tory S. Anderson) writes:
>
>> After years without issue where I could choose, for example, to see my
>> daily work agenda, the filters are now failing to be applied. This is
>> in org 9.6.15, as shipped with my emacs 29.3. I have verified that
>> this problem is the same in =emacs -Q= without any other packages:
>> when I choose my agenda view, such as "C-a w d" for my daily work
>> agenda, I still get an agenda buffer named "Org_Agenda(wd)", but none
>> of my preset filters have applied. I skimmed the documentation and I
>> haven't seen any changed syntax. Here is my definition from my
>> =use-package org= =:custom= section:
>>
>> #+begin_src lisp
>>        (org-agenda-custom-commands
>> 	    '(("w" . "Work")
>> 	      ("wd" "Work Day"
>> 	       ((agenda ""
>> 			((org-agenda-span 1)
>> 			 (org-agenda-start-on-weekday nil)
>> 			 (org-agenda-regexp-filter-preset
>> 			  '("+ODH\\|AGENDA\\|CONFERENCE" "-TSA\\|PRIESTHOOD")))))
>> 	       nil)))
>> #+end_src
> According to the docstring of `org-agenda-regexp-filter-preset',
>
>      ...The preset filter is a global property of
>      the entire agenda view.  In a block agenda, it will not work reliably to
>      define a filter for one of the individual blocks.  You need to set it in
>      the global options and expect it to be applied to the entire view.
>
> So, you should set this variable as a part of global agenda command
> settings, not inside individual block.
>
> Not a bug.
> Canceled.
>
>> Why has this stopped applying my filter when it worked for so long? Is
>> it a bug, or do I need to change something to make it up-to-date?
> I have no idea because you did not tell which Org mode version had your
> settings working. I suspect that it could have happened around the time
> Org mode switched from dynamic binding to lexical binding, but it is
> just a blind guess.
>


[-- Attachment #1.1.2: agenda-filters.org --]
[-- Type: text/org, Size: 4549 bytes --]

(setq my/org-agenda_pro-filter ":2024_12_masked:\\|:2024_29_masked:\\|:2024_16_masked:\\|:2023_101_masked:\\|:2024_17_masked:")
(setq my/org-agenda_org-filter ":2023_47_masked:\\|:2023_53_masked:\\|:2024_8_masked:\\|:2024_9_masked:\\|:2024_13_masked:\\|:2024_20_masked:\\|:2024_10_masked:\\|:2024_11_masked:")
(setq my/org-agenda_home-filter ":2024_2_masked:\\|:2024_1_masked:\\|:2024_4_masked:\\|:2024_3_masked:\\|:2022_39_masked:")
(setq my/org-agenda_vol-filter ":2023_47_masked:\\|:2023_53_masked:\\|:2024_8_masked:\\|:2024_9_masked:\\|:2024_13_masked:\\|:2024_20_masked:\\|:2024_10_masked:\\|:2024_11_masked:")
(setq my/org-agenda_exp-filter ":2022_9_masked:\\|:2024_25_masked:\\|:2022_83_masked:\\|:2024_24_masked:\\|:2024_23_masked:\\|:2023_57_masked:\\|:2024_7_masked:\\|:2024_15_masked:\\|:2024_14_masked:")
(setq my/org-agenda_mus-filter ":2024_22_masked:\\|:2024_21_masked:")
(setq my/org-agenda_viaje-filter ":2023_114_masked:\\|:2022_74_masked:")

(defun my/org-agenda-skip-with-filter (filter)
  (or
   (org-agenda-skip-entry-if 'todo '("DONE" "CLOSED"))
   (org-agenda-skip-entry-if 'notregexp (concat ":appt:\\|" filter))
   ))

;; by default I only want a list of the todo items
(setq org-agenda-custom-commands
      '(("t" "list all TICKLER items" todo "TICKLER")
        ("n" "list all NEXT items" todo "NEXT")
        ("h" "list all HOLD items" todo "HOLD")
        ("b" "Agenda for board.org"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-files '("~/org/board.org"))))
        ;; thanks chatgpt
        ("d" "Daily agenda without DONE and CLOSED (responde a pregunta: qué queda por hacer hoy)"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function
           (lambda ()
             (or (org-agenda-skip-entry-if 'todo '("DONE" "CLOSED")))))))
        ;; trabajos profesionales
        ;;   https://emacs.stackexchange.com/questions/18179/org-agenda-command-with-org-agenda-filter-by-tag-not-working/78066#78066
        ("w" "Context 1: pro/Work"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function '(my/org-agenda-skip-with-filter (concat ":pro:\\|" my/org-agenda_pro-filter)))
           ))
        ("o" "Context 2: Org"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function '(my/org-agenda-skip-with-filter (concat ":org:\\|" my/org-agenda_org-filter)))
           ))
        ;; special case, includes habitos
        ("c" "Context 3: home (Casa)"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function
           (lambda ()
             (let ((category (org-get-category)))
               ;; debug
               ;;(print category)
               (or
                (org-agenda-skip-entry-if 'todo '("DONE" "CLOSED"))
                (org-agenda-skip-entry-if 'notregexp (concat
                                                      ":appt:\\|"
                                                      ":nutricion:\\|"
                                                      ":home:\\|"
                                                      my/org-agenda_home-filter))
                ))))))
        ("v" "Context 4: Vol"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function '(my/org-agenda-skip-with-filter (concat ":vol:\\|" my/org-agenda_vol-filter)))
           ))
        ("x" "Context 5: eXp"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function '(my/org-agenda-skip-with-filter (concat ":exp:\\|" my/org-agenda_exp-filter)))
           ))
        ("u" "Context 6: mUs"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function '(my/org-agenda-skip-with-filter (concat ":mus:\\|" my/org-agenda_mus-filter)))
           ))
        ("v" "Context 7: Viaje"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function '(my/org-agenda-skip-with-filter (concat ":viaje:\\|" my/org-agenda_viaje-filter)))
           ))
        ;; free: special case, negation of work filter
        ("f" "Freedom, no pro/work"
         agenda ""
         ((org-agenda-span 'day)
          (org-agenda-skip-function
           (lambda ()
             (or
              (org-agenda-skip-entry-if 'todo '("DONE" "CLOSED"))
              (org-agenda-skip-entry-if 'regexp (concat
                                                    ":appt:\\|"
                                                    my/org-agenda_pro-filter))
              )))))
         ))

[-- Attachment #1.1.3: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2847 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

* Re: After years without issues, Orgmode now fails to apply agenda filters to preset templates
  2024-05-30 11:17   ` Pedro
@ 2024-05-30 16:15     ` Tory S. Anderson
  2024-05-30 16:29       ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Tory S. Anderson @ 2024-05-30 16:15 UTC (permalink / raw)
  To: Pedro; +Cc: emacs-orgmode

Pedro <pinmacs@cas.cat> writes:

> I use the same version emacs and orgmode version as you, and I have
> similar needs as you: filtering org-agenda by tags, etc.
>
> I will share my whole section of org-agenda-custom-commands as it
> is, I hope you can followup it nicely. Find it attached in file:
> agenda-filters.org


Thanks for your reply! it appears that you that the org-agenda-filter-preset that have been working in my emacs 28.3 (I try to use whatever ships with the emacs version for stability reasons) and earlier are not functioning anymore. At least, I see your approach is making heavy use of org-agenda-skip-function and org-agenda-skip-enty-if. I will rethink my setup to use those things. Thanks for your response!

- Tory


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

* Re: After years without issues, Orgmode now fails to apply agenda filters to preset templates
  2024-05-30 16:15     ` Tory S. Anderson
@ 2024-05-30 16:29       ` Ihor Radchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2024-05-30 16:29 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: Pedro, emacs-orgmode

"Tory S. Anderson" <tory_anderson@byu.edu> writes:

> ... I will rethink my setup to use those things. Thanks for your response!

You do not need to rethink your setup. Just move the filter to global
settings. It is how it is supposed to be used.

(org-agenda-custom-commands
 '(("w" . "Work")
   ("wd" "Work Day"
    ((agenda ""
	     ((org-agenda-span 1)
	      (org-agenda-start-on-weekday nil))))
    ;; Filter applies globally to the whole view.
    ((org-agenda-regexp-filter-preset
      '("+ODH\\|AGENDA\\|CONFERENCE" "-TSA\\|PRIESTHOOD"))))))

-- 
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] 5+ messages in thread

end of thread, other threads:[~2024-05-30 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-25 19:08 After years without issues, Orgmode now fails to apply agenda filters to preset templates Tory S. Anderson
2024-05-25 19:26 ` Ihor Radchenko
2024-05-30 11:17   ` Pedro
2024-05-30 16:15     ` Tory S. Anderson
2024-05-30 16:29       ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.