all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: stasvlasov@disroot.org
To: emacs-orgmode@gnu.org
Subject: [BUG] org-agenda passes current-prefix-arg to commands instead of arg [9.5.3 (9.5.3-g69c588 @ /Users/stas/.emacs.d/straight/build/org/)]
Date: Sun, 03 Jul 2022 14:56:19 +0200	[thread overview]
Message-ID: <m2pmimnymk.fsf@air.local.mail-host-address-is-not-set> (raw)


`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/)


             reply	other threads:[~2022-07-05 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-03 12:56 stasvlasov [this message]
2022-07-07 10:05 ` [BUG] org-agenda passes current-prefix-arg to commands instead of arg [9.5.3 (9.5.3-g69c588 @ /Users/stas/.emacs.d/straight/build/org/)] Ihor Radchenko

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pmimnymk.fsf@air.local.mail-host-address-is-not-set \
    --to=stasvlasov@disroot.org \
    --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 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.