Commit 72d4522b authored by Gabriel do Nascimento Ribeiro's avatar Gabriel do Nascimento Ribeiro Committed by Lars Ingebrigtsen

Add option remember-diary-regexp

* lisp/textmodes/remember.el (remember-diary-extract-entries): Use
it (bug#45808).
(remember-diary-regexp): New variable.
parent cad2c4b1
Pipeline #8864 passed with stages
in 11 minutes and 25 seconds
...@@ -1557,6 +1557,9 @@ that makes it a valid button. ...@@ -1557,6 +1557,9 @@ that makes it a valid button.
** Miscellaneous ** Miscellaneous
---
*** New user option 'remember-diary-regexp'.
*** New function 'buffer-line-statistics'. *** New function 'buffer-line-statistics'.
This function returns some statistics about the line lengths in a buffer. This function returns some statistics about the line lengths in a buffer.
......
...@@ -159,7 +159,8 @@ ...@@ -159,7 +159,8 @@
;; ;; This should be before other entries that may return t ;; ;; This should be before other entries that may return t
;; (add-to-list 'remember-handler-functions 'remember-diary-extract-entries) ;; (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: .... ;; DIARY: ....
;; ;;
...@@ -532,13 +533,18 @@ If this is nil, then `diary-file' will be used instead." ...@@ -532,13 +533,18 @@ If this is nil, then `diary-file' will be used instead."
(autoload 'diary-make-entry "diary-lib") (autoload 'diary-make-entry "diary-lib")
(defcustom remember-diary-regexp "^DIARY:\\s-*\\(.+\\)"
"Regexp to extract diary entries."
:type 'regexp
:version "28.1")
;;;###autoload ;;;###autoload
(defun remember-diary-extract-entries () (defun remember-diary-extract-entries ()
"Extract diary entries from the region." "Extract diary entries from the region based on `remember-diary-regexp'."
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(let (list) (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)) (push (remember-diary-convert-entry (match-string 1)) list))
(when list (when list
(diary-make-entry (mapconcat 'identity list "\n") (diary-make-entry (mapconcat 'identity list "\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment