`org-agenda' function passes `current-prefix-arg' to its commands (e.g., `org-agenda-tags') instead of `arg'
This might create unexpected behaviour if one uses `org-agenda' function inside another interactive function that accepts on universal prefix. For example if I define `my/agenda-done-todos' it wont show any DONE todos if I call it with prefix to restrict it to current buffer because `org-agenda-tags' will be limited only to active todos by `current-prefix-arg' and this will always produce empty set: (add-to-list 'org-agenda-custom-commands '("d" "DONE todos" tags "TODO=\"DONE\"")) (defun my/agenda-done-todos (arg) "Show agenda for keyword 'd' (DONE todos). With ARG prefix restrict to current buffer." (interactive "P") (if arg (org-agenda nil "d" 'buffer) (org-agenda nil "d"))) Emacs : GNU Emacs 28.1 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H1519)) of 2022-05-07 Package: Org mode version 9.5.3 (9.5.3-g69c588 @ /Users/stas/.emacs.d/straight/build/org/)