From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kGJ/H9vX12URyAAAqHPOHw:P1 (envelope-from ) for ; Fri, 23 Feb 2024 00:25:15 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id kGJ/H9vX12URyAAAqHPOHw (envelope-from ) for ; Fri, 23 Feb 2024 00:25:15 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CM4e+Q0X; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708644315; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=bFsGWr2e8/TxbbWjr56ED+UFodWCrsOmLut4d+woza8=; b=SGQPzqbQG0eBBY24H+W3pnPbpbPDrcelRSW/PN5BRJ9MBadOG5BYlYYmbLxoFpQd0K7smK 7U16BUSCrjk1OMceqAt0w97u4oimdfxgK9qqEuit9X7PwyxBxfGQWHrzfGvL8IbR8UtIwT /1AyYVqF3TihIjPmkA7T/ULdQeEZxYJOz2Ep49FyfdjpCzEXmCkxNhlPlSj7W7/hVZih/e OltdRfEJ03W08AmRtYVgSyoPwZvTAxso+u9v+ObmSx7OuZAlYVUBW7VEbvFwsXSQJHS1hT hRrnYtGBJweGEXm1YyT8ffDPxOq2rCwc97Ft4qAcOVq5skILSPj5DISTQtYHfw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CM4e+Q0X; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708644315; a=rsa-sha256; cv=none; b=rUqL+pXFId/j2Z6r7ujBf0XvJmTFfqGox7y3EoUq1igkAsI1GXLgyeJLOFp0BpIrLqk1R6 ajTuklfetXffDXCX8z5ABQcKNyLe9/0NqJIl3YNyYOiSUUTvFv7a7gO79acjCsDIYJxaTt O+vnQEVKU0hqsPPoKVIJi2+LljjwFK/qcKwK1hGdO1V+9XqdxIXkfMsHRyEPgGUFXjCAq5 ECNh/YzEWzkSguh3l2tNeGjBkwn2s9ngl86/0NgScXwJCPUvwlLSe5t/KHTuvNaqsuZo6l 7dq8WnZZlVVLPsLww0krsvLPu0R4PvuFSU3uWsl+ECSmac23/5wSl9zt0/87Gg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3E2F76E550 for ; Fri, 23 Feb 2024 00:25:15 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdIQE-0006ar-G9; Thu, 22 Feb 2024 18:24:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdIQD-0006aY-10 for emacs-orgmode@gnu.org; Thu, 22 Feb 2024 18:24:09 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdIQB-0004i5-8K for emacs-orgmode@gnu.org; Thu, 22 Feb 2024 18:24:08 -0500 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6e4d0b778a2so158776b3a.2 for ; Thu, 22 Feb 2024 15:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708644245; x=1709249045; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=bFsGWr2e8/TxbbWjr56ED+UFodWCrsOmLut4d+woza8=; b=CM4e+Q0XLqV0HgsZzoRB4ghjC2uOE5+dH0StduWtlyKzC0UlVYdPi8fLZwf0WVQoyl 6RbkzdZH6f24x4//3PO1aJ17wBHOc9Ok/4ucTfnP3FIvqfQdVCA43IO1SsAWuvDImJLL 8pbOGO2jZuHbKxuPFQ/D8ZmBBc5p+gYZOSRaH0fg+lC5H+xCdhNb1MTWfOl8T/fRbxFH cK0QtoYOIGvR53xlVJJHORaNjIeqY3ZvBkr34AbZkiCpYCtc89NpC3210otdyCtvPnQ1 LWHPYfyfOdN0czrZTlKdIry3XuOsAOO5FZ0Qb4QnfK+08KxsIBdFJ07YR8rFH4wMfca1 m1uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708644245; x=1709249045; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bFsGWr2e8/TxbbWjr56ED+UFodWCrsOmLut4d+woza8=; b=cKDTuuo9jO1ToHCN/4r3eU1BhVoSNc75JxoH/GZtMdDtgSmTmdJ8aEz2CwAFHpftrC iIaGyvCK6QEVEur8dzdqa577Un4Cip01Xvku+Cx8q+xCkMaAuHdu2FlxnaBrdQmVv4MW waq8IqRn801pFvRmDQe9y3WQVd3wAFVnlclaqcF7b7DnJxQ7tIurOgxTha6/uo7N2mPf 7Vu5Bhp2niX/EMsrU2VsIyYFJ5NvW0K/apaYETcDki3EzbJaRN4EjGFxB80vgL6GB6db AYYz6Dl129mxef4EcdkTzO5VvvEcVZXY0pfeJEcl9rkQO4+LuF3iT3HGw4WnFunCgkx3 WIyw== X-Gm-Message-State: AOJu0YxGtwHOuEwq5Jsw4Fa+UE51bW7mK0thvicNWF/ygOxQ7t60avwI D0VB4PmRy/pYfM8jfklnBJr5YuUUGbpL8qm5G8MAomsfH4bbn9Md3UMQgrpGe/kI1+DMZC6a2YD 7DcMsxypGK2swTKNIKwTo0gRa8jFW3ZW+ X-Google-Smtp-Source: AGHT+IGumH+YqWa8skJBn7cGZMV9qENVm8sknr93S8c4iFM7uK0J0RR6JZ3yyrq6UITsFR4jXlSkQ5Rhk1691MiiYaA= X-Received: by 2002:a05:6a20:2307:b0:19e:c777:5c61 with SMTP id n7-20020a056a20230700b0019ec7775c61mr293019pzc.22.1708644244701; Thu, 22 Feb 2024 15:24:04 -0800 (PST) MIME-Version: 1.0 From: John Mathena Date: Thu, 22 Feb 2024 17:23:53 -0600 Message-ID: Subject: org-agenda-filter-by-category not working in block agendas due to inconsistent truncation To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=jmmathena@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -7.70 X-Spam-Score: -7.70 X-Migadu-Queue-Id: 3E2F76E550 X-TUID: hLy+vyvAVE4L The category of items in an "agenda" block view as returned by org-agenda-get-category are truncated based on the value of the prefix format; this isn't the case for e.g. the tags-todo view. For instance, if an item has a category "marathon training", and your agenda and tags-todo views both have prefix formats of " %8.8:c ", calling org-agenda-get-category on that item while it's being displayed in the agenda will yield a category of "marathon", while calling it on the same item in the tags-todo view will yield "marathon training". This poses a problem while trying to use custom commands to do a block agenda, since if you call org-agenda-filter-by-category on an entry with a given category, other entries with that same category can get filtered out if they're in a different view than the point was in when you filtered. To recreate this issue, I: 1. Started emacs with emacs -Q 2. Ran eval-defun on the following elisp (setq org-agenda-custom-commands '(("d" "demo" ((agenda "" ((org-agenda-prefix-format " %-12.12:c "))) (tags-todo "/TODO" ((org-agenda-prefix-format " %16.16:c "))) (tags-todo "/TODO" ((org-agenda-prefix-format " %-12.12:c "))))))) 3. Created an org file with the following contents and added it to org-agenda-files with C-c [ * TODO This is a small project :PROPERTIES: :CATEGORY: small proj :END: ** TODO Do foo SCHEDULED: <2024-02-22 Thu> * TODO This is a big, special project! :PROPERTIES: :CATEGORY: extra-special project :END: ** TODO Do bar SCHEDULED: <2024-02-22 Thu> ** TODO Do baz 4. Opened org-agenda with the "demo" view. Now, if you use org-agenda-filter-by-category while in the agenda block on the scheduled entry "Do foo", you'll see the category filter appropriately in the tags-todo view, only leaving items with category "small proj". However, if you use org-agenda-filter-by-category on the scheduled entry "Do bar" in the agenda block, all items are filtered out in the tags-todo views, including ones that should have the same category. Calling org-agenda-get-category on the "Do bar" item in the agenda yields "extra-speci" as the category of that entry. Note that if you instead filter on "Do bar" while on one of its entries in the tags-todo views, the entries in the other tags-todo view are filtered correctly, despite them having a different length in their prefix format; calling org-agenda-get-category on either of those both yield the full "extra-special project" category. My workflow involves giving significant projects a category, and organizing tasks underneath those headings; then, I can schedule individual tasks so that they show up on my agenda, and filter the agenda tasks by category so that I see all other tasks that belong to that project in a larger tags-todo view underneath the agenda. However, this will now only work if I don't truncate the headings at all in my agenda prefix-format so that they match the untruncated categories of the tags-todo view, which is unfortunate, since it throws others stuff in the agenda out of alignment. (Due to projects sometimes having sub-projects, org-agenda-filter-by-top-headline isn't a cure-all here). In general, it seems like org-agenda-filter-by-category should work based on the actual category of an item, rather than its display in the buffer, which I find unexpected. I wasn't able to find any configuration to change this behavior, but if I'm missing it, I'd appreciate a point in the right direction! This was recreated on GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-02-14, with Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/30.0.50/lisp/org/) Best, John