Przeglądaj źródła

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'.
Ihor Radchenko 2 lat temu
rodzic
commit
d4fde298b9
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7 2
      lisp/org-agenda.el

+ 7 - 2
lisp/org-agenda.el

@@ -5919,8 +5919,13 @@ displayed in agenda view."
 	(setq b (point))
 	(setq b (point))
 	(forward-sexp 1)
 	(forward-sexp 1)
 	(setq sexp (buffer-substring b (point)))
 	(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))
 	(setq result (org-diary-sexp-entry sexp sexp-entry date))
 	(when result
 	(when result