org-agenda-get-sexps: Improve performance

* lisp/org-agenda.el (org-agenda-get-sexps): Remove trailing
whitespaces in SEXP-ENTRY via buffer movements.  It is faster than
re-creating string objects in `org-trim'.
This commit is contained in:
Ihor Radchenko 2022-09-22 10:57:20 +08:00
parent 4657cea495
commit d4fde298b9
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 2 deletions

View File

@ -5919,8 +5919,13 @@ displayed in agenda view."
(setq b (point))
(forward-sexp 1)
(setq sexp (buffer-substring b (point)))
(setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)")
(org-trim (match-string 1))
(setq sexp-entry (if (org-looking-at "[ \t]*\\(\\S-.*\\)")
(buffer-substring
(match-beginning 1)
(save-excursion
(goto-char (match-end 1))
(skip-chars-backward "[:blank:]")
(point)))
""))
(setq result (org-diary-sexp-entry sexp sexp-entry date))
(when result