'Emacs Org-mode: org-agenda-custom-commands and hiding future scheduled tasks

I have set my org-agenda-custom-commands to (among others) this:

(setq org-agenda-custom-commands
      `(
        ("x"
         "Scheduled tasks with Prio"
         ((tags-todo "+PRIORITY={A}"
                     ((org-agenda-overriding-header "Scheduled Prio-A TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (tags-todo "+PRIORITY={B}"
                     ((org-agenda-overriding-header "Scheduled Prio-B TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (tags-todo "+PRIORITY={C}"
                     ((org-agenda-overriding-header "Scheduled Prio-C TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (tags-todo "+PRIORITY={D}"
                     ((org-agenda-overriding-header "Scheduled Prio-D TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (agenda)))
;; snip

Now I would like to hide all tasks scheduled in the future. I can do this via

(progn
  (setq org-agenda-todo-ignore-scheduled 'future)
  (setq org-agenda-tags-todo-honor-ignore-options t))

But this affects all of my other org-agenda-custom-commands. I would like to limit it to just one custom command.

So how can I modify my custom command so that it hides the future tasks?



Solution 1:[1]

The doc string for org-agenda-custome-commands says, among other things, the following:

...
settings  A list of option settings, similar to that in a let form, so like
          this: ((opt1 val1) (opt2 val2) ...).   The values will be
          evaluated at the moment of execution, so quote them when needed.
...
You can also define a set of commands, to create a composite agenda buffer.
In this case, an entry looks like this:

  (key desc (cmd1 cmd2 ...) general-settings-for-whole-set files)
...

So all you need to do is add your settings at the end of the custom command:

(setq org-agenda-custom-commands
      `(
        ("x"
         "Scheduled tasks with Prio"
         ((tags-todo "+PRIORITY={A}"
                     ((org-agenda-overriding-header "Scheduled Prio-A TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (tags-todo "+PRIORITY={B}"
                     ((org-agenda-overriding-header "Scheduled Prio-B TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (tags-todo "+PRIORITY={C}"
                     ((org-agenda-overriding-header "Scheduled Prio-C TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (tags-todo "+PRIORITY={D}"
                     ((org-agenda-overriding-header "Scheduled Prio-D TODOs")
                      (org-agenda-skip-function
                       '(org-agenda-skip-entry-if 'unscheduled))))
          (agenda))
         ;; settings for the above composite custom command
         ((org-agenda-todo-ignore-scheduled 'future)
          (org-agenda-tags-todo-honor-ignore-options t)))
;; snip
;; other commands
...
))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1