branch: externals/org
commit 03caea21f60eb9fb38e079bd6deb1ccf30069077
Author: Slawomir Grochowski <[email protected]>
Commit: Slawomir Grochowski <[email protected]>
; org: Extract log note format regexp helper
* lisp/org.el (org--log-note-format-regexp): New function.
(org-skip-over-state-notes): Use it.
Refactoring: Extract Function.
No behavior change.
---
lisp/org.el | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index cb36497f4f..79419f9a02 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11040,6 +11040,21 @@ EXTRA is additional text that will be inserted into
the notes buffer."
org-log-setup t)
(add-hook 'post-command-hook 'org-add-log-note 'append))
+(defun org--log-note-format-regexp (format)
+ "Return a regexp matching log note FORMAT."
+ (replace-regexp-in-string
+ " +" " +"
+ (org-replace-escapes
+ (regexp-quote format)
+ `(("%d" . ,org-ts-regexp-inactive)
+ ("%D" . ,org-ts-regexp)
+ ("%s" . "\\(?:\"\\S-+\"\\)?")
+ ("%S" . "\\(?:\"\\S-+\"\\)?")
+ ("%t" . ,org-ts-regexp-inactive)
+ ("%T" . ,org-ts-regexp)
+ ("%u" . ".*?")
+ ("%U" . ".*?")))))
+
(defun org-skip-over-state-notes ()
"Skip past the list of State notes in an entry.
The point is assumed to be on a list of State notes, each matching
@@ -11051,18 +11066,8 @@ items are State notes."
(prevs (org-list-prevs-alist struct))
(regexp
(concat "[ \t]*- +"
- (replace-regexp-in-string
- " +" " +"
- (org-replace-escapes
- (regexp-quote (cdr (assq 'state org-log-note-headings)))
- `(("%d" . ,org-ts-regexp-inactive)
- ("%D" . ,org-ts-regexp)
- ("%s" . "\\(?:\"\\S-+\"\\)?")
- ("%S" . "\\(?:\"\\S-+\"\\)?")
- ("%t" . ,org-ts-regexp-inactive)
- ("%T" . ,org-ts-regexp)
- ("%u" . ".*?")
- ("%U" . ".*?")))))))
+ (org--log-note-format-regexp
+ (cdr (assq 'state org-log-note-headings))))))
(while (looking-at-p regexp)
(goto-char (or (org-list-get-next-item (point) struct prevs)
(org-list-get-item-end (point) struct)))))))