emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Liu Hui <liuhui1610@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-agenda-filter-by-category: fix 'no category' error
Date: Thu, 2 Feb 2023 17:55:02 +0800	[thread overview]
Message-ID: <CAOQTW-MHsnEak_Oj_iyKBsnm6_j4WzOgThM_58a__uu10KenbQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

Hello,

To reproduce the bug:

1. emacs -Q --eval "(require 'org-habit)"
2. Open the following org file:

---------------begin----------------------
* TODO foo
SCHEDULED: <2023-02-01 Wed .+2d/4d>
:PROPERTIES:
:STYLE:    habit
:CATEGORY: foo
:END:

* TODO bar
SCHEDULED: <2023-02-01 Wed>
------------- end ----------------------

3. M-x org-agenda, then press < a to create an agenda buffer
4. Go to the line containing foo, press <

Expected result: the agenda buffer shows only foo

Actual result:
org-agenda-filter-by-category: No category at point

[-- Attachment #2: 0001-org-agenda-Fix-org-agenda-filter-by-category.patch --]
[-- Type: text/x-patch, Size: 951 bytes --]

From 2ac07aeb64d0b12708b54ec8ef26265c64af630e Mon Sep 17 00:00:00 2001
From: Liu Hui <liuhui1610@gmail.com>
Date: Wed, 1 Feb 2023 13:35:49 +0800
Subject: [PATCH] org-agenda: Fix `org-agenda-filter-by-category'

* lisp/org-agenda.el (org-agenda-filter-by-category): Use
`org-agenda-get-category' to get the category at current line.
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 4396efe81..1d1f2271b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8210,7 +8210,7 @@ (defun org-agenda-filter-by-category (strip)
   (if (and org-agenda-filtered-by-category
 	   org-agenda-category-filter)
       (org-agenda-filter-show-all-cat)
-    (let ((cat (org-no-properties (org-get-at-eol 'org-category 1))))
+    (let ((cat (org-no-properties (org-agenda-get-category))))
       (cond
        ((and cat strip)
         (org-agenda-filter-apply
-- 
2.25.1


             reply	other threads:[~2023-02-02  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02  9:55 Liu Hui [this message]
2023-02-03 11:30 ` [PATCH] org-agenda-filter-by-category: fix 'no category' error 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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=CAOQTW-MHsnEak_Oj_iyKBsnm6_j4WzOgThM_58a__uu10KenbQ@mail.gmail.com \
    --to=liuhui1610@gmail.com \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).