emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-agenda-filter-by-category: fix 'no category' error
@ 2023-02-02  9:55 Liu Hui
  2023-02-03 11:30 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Hui @ 2023-02-02  9:55 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] org-agenda-filter-by-category: fix 'no category' error
  2023-02-02  9:55 [PATCH] org-agenda-filter-by-category: fix 'no category' error Liu Hui
@ 2023-02-03 11:30 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-02-03 11:30 UTC (permalink / raw)
  To: Liu Hui; +Cc: emacs-orgmode

Liu Hui <liuhui1610@gmail.com> writes:

> To reproduce the bug:
> ...
> Subject: [PATCH] org-agenda: Fix `org-agenda-filter-by-category'

Thanks for reporting and providing a fix!
Applied, onto bugfix, adding link to this message to the commit message.
Fixed.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3e23b8976

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-03 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02  9:55 [PATCH] org-agenda-filter-by-category: fix 'no category' error Liu Hui
2023-02-03 11:30 ` Ihor Radchenko

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).