org-read-date-get-relative: Assure case-insensitive weekday matching

* lisp/org.el (org-read-date-get-relative): Bind `case-fold-search' to
non-nil when matching weekdays.  This is to avoid breakage for
non-default value of `case-fold-search'.
This commit is contained in:
Ihor Radchenko 2022-10-17 20:28:58 +08:00
parent cb1359a3ce
commit c0d629b5bd
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 8 additions and 6 deletions

View File

@ -13988,12 +13988,14 @@ DEF-FLAG is t when a double ++ or -- indicates shift relative to
the DEFAULT date rather than TODAY."
(require 'parse-time)
(when (and
(string-match
(concat
"\\`[ \t]*\\([-+]\\{0,2\\}\\)"
"\\([0-9]+\\)?"
"\\([hdwmy]\\|\\(" (mapconcat 'car parse-time-weekdays "\\|") "\\)\\)?"
"\\([ \t]\\|$\\)") s)
;; Force case-insensitive.
(let ((case-fold-search t))
(string-match
(concat
"\\`[ \t]*\\([-+]\\{0,2\\}\\)"
"\\([0-9]+\\)?"
"\\([hdwmy]\\|\\(" (mapconcat 'car parse-time-weekdays "\\|") "\\)\\)?"
"\\([ \t]\\|$\\)") s))
(or (> (match-end 1) (match-beginning 1)) (match-end 4)))
(let* ((dir (if (> (match-end 1) (match-beginning 1))
(string-to-char (substring (match-string 1 s) -1))