emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Liu Hui <liuhui1610@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix docstring of `org-at-timestamp-p'
Date: Wed, 23 Aug 2023 14:31:32 +0800	[thread overview]
Message-ID: <CAOQTW-Pr-_WX-HPvSfVycND_frRnmN5t-wAf5J0rGz-goWmtLQ@mail.gmail.com> (raw)

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


             reply	other threads:[~2023-08-23  6:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  6:31 Liu Hui [this message]
2023-08-24  7:20 ` [PATCH] Fix docstring of `org-at-timestamp-p' 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-Pr-_WX-HPvSfVycND_frRnmN5t-wAf5J0rGz-goWmtLQ@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).