emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix docstring of `org-at-timestamp-p'
@ 2023-08-23  6:31 Liu Hui
  2023-08-24  7:20 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Hui @ 2023-08-23  6:31 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

I find that the doc string of `org-at-timestamp-p' about match groups
is not consistent with the behavior. The doc string says

When matching, the match groups are the following:
  group 1: year, if any
  group 2: month, if any
  group 3: day number, if any
  group 4: day name, if any
  group 5: hours, if any
  group 6: minutes, if any

but for timestamps like <2023-08-23 Wed>, (when (org-at-timestamp-p)
(match-string 2)) will return the year 2023 instead of the month. This
patch corrects the group numbers.

[-- Attachment #2: 0001-lisp-org.el-org-at-timestamp-p-fix-doc-string.patch --]
[-- Type: text/x-patch, Size: 986 bytes --]

From a3c31e4f8f40202fcef61fc7c4b16acaf006e24f Mon Sep 17 00:00:00 2001
From: Liu Hui <liuhui1610@gmail.com>
Date: Wed, 23 Aug 2023 14:27:21 +0800
Subject: [PATCH] * lisp/org.el (org-at-timestamp-p): fix doc string

---
 lisp/org.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3d9d61f69..6b89e14c4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14843,12 +14843,12 @@ (defun org-at-timestamp-p (&optional extended)
 values are possible).
 
 When matching, the match groups are the following:
-  group 1: year, if any
-  group 2: month, if any
-  group 3: day number, if any
-  group 4: day name, if any
-  group 5: hours, if any
-  group 6: minutes, if any"
+  group 2: year, if any
+  group 3: month, if any
+  group 4: day number, if any
+  group 5: day name, if any
+  group 7: hours, if any
+  group 8: minutes, if any"
   (let* ((regexp
           (if extended
               (if (eq extended 'agenda)
-- 
2.25.1


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

* Re: [PATCH] Fix docstring of `org-at-timestamp-p'
  2023-08-23  6:31 [PATCH] Fix docstring of `org-at-timestamp-p' Liu Hui
@ 2023-08-24  7:20 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-08-24  7:20 UTC (permalink / raw)
  To: Liu Hui; +Cc: emacs-orgmode

Liu Hui <liuhui1610@gmail.com> writes:

> I find that the doc string of `org-at-timestamp-p' about match groups
> is not consistent with the behavior. The doc string says
>
> ...
> but for timestamps like <2023-08-23 Wed>, (when (org-at-timestamp-p)
> (match-string 2)) will return the year 2023 instead of the month. This
> patch corrects the group numbers.

Thanks!
Applied, onto bugfix, adding slightly more details to the commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=973e50c83

The docstring did not correspond to the actual match data since group
info was added there. So, no actual regression in the code occurred.
Pure bug in the docstring. That's why bugfix.

-- 
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-08-24  7:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23  6:31 [PATCH] Fix docstring of `org-at-timestamp-p' Liu Hui
2023-08-24  7:20 ` 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).