]> git.eshelyaron.com Git - emacs.git/commitdiff
Add option remember-diary-regexp
authorGabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br>
Wed, 20 Jan 2021 16:45:08 +0000 (17:45 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 20 Jan 2021 16:45:08 +0000 (17:45 +0100)
* lisp/textmodes/remember.el (remember-diary-extract-entries): Use
it (bug#45808).
(remember-diary-regexp): New variable.

etc/NEWS
lisp/textmodes/remember.el

index 7a012b48912b68152284dba95191957f4cbfe125..a0e1e3b2a18b1d9264c9cdfabfd308515c1c52bb 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1557,6 +1557,9 @@ that makes it a valid button.
 
 ** Miscellaneous
 
+---
+*** New user option 'remember-diary-regexp'.
+
 *** New function 'buffer-line-statistics'.
 This function returns some statistics about the line lengths in a buffer.
 
index 98d3a3856ea0306c96d0e09e569d296aaad18c75..92706e3807347a7a92135a1bdfae9a86b8aed174 100644 (file)
 ;;   ;; This should be before other entries that may return t
 ;;   (add-to-list 'remember-handler-functions 'remember-diary-extract-entries)
 ;;
-;; This module recognizes entries of the form
+;; This module recognizes entries of the form (defined by
+;; `remember-diary-regexp')
 ;;
 ;;   DIARY: ....
 ;;
@@ -532,13 +533,18 @@ If this is nil, then `diary-file' will be used instead."
 
 (autoload 'diary-make-entry "diary-lib")
 
+(defcustom remember-diary-regexp "^DIARY:\\s-*\\(.+\\)"
+  "Regexp to extract diary entries."
+  :type 'regexp
+  :version "28.1")
+
 ;;;###autoload
 (defun remember-diary-extract-entries ()
-  "Extract diary entries from the region."
+  "Extract diary entries from the region based on `remember-diary-regexp'."
   (save-excursion
     (goto-char (point-min))
     (let (list)
-      (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t)
+      (while (re-search-forward remember-diary-regexp nil t)
         (push (remember-diary-convert-entry (match-string 1)) list))
       (when list
         (diary-make-entry (mapconcat 'identity list "\n")