]> git.eshelyaron.com Git - emacs.git/commitdiff
Add option remember-text-format-function
authorGabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
Wed, 20 Jan 2021 16:53:04 +0000 (17:53 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 20 Jan 2021 16:53:04 +0000 (17:53 +0100)
* lisp/textmodes/remember.el (remember-text-format-function): New
variable (bug#45809).
(remember-append-to-file): Use it.

etc/NEWS
lisp/textmodes/remember.el

index a0e1e3b2a18b1d9264c9cdfabfd308515c1c52bb..c8cbce1882a9ee78b9606b80cac85544740a273d 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1560,6 +1560,9 @@ that makes it a valid button.
 ---
 *** New user option 'remember-diary-regexp'.
 
+---
+*** New user option 'remember-text-format-function'.
+
 *** New function 'buffer-line-statistics'.
 This function returns some statistics about the line lengths in a buffer.
 
index 92706e3807347a7a92135a1bdfae9a86b8aed174..6c94f8d03c816eaf6a9875692afc835e3e5578e2 100644 (file)
@@ -411,13 +411,24 @@ The default emulates `current-time-string' for backward compatibility."
   :group 'remember
   :version "27.1")
 
+(defcustom remember-text-format-function nil
+  "The function to format the remembered text.
+The function receives the remembered text as argument and should
+return the text to be remembered."
+  :type 'function
+  :group 'remember
+  :version "28.1")
+
 (defun remember-append-to-file ()
   "Remember, with description DESC, the given TEXT."
   (let* ((text (buffer-string))
          (desc (remember-buffer-desc))
-         (remember-text (concat "\n" remember-leader-text
-                                (format-time-string remember-time-format)
-                                " (" desc ")\n\n" text
+         (remember-text (concat "\n"
+                                (if remember-text-format-function
+                                    (funcall remember-text-format-function text)
+                                  (concat remember-leader-text
+                                          (format-time-string remember-time-format)
+                                          " (" desc ")\n\n" text))
                                 (save-excursion (goto-char (point-max))
                                                 (if (bolp) nil "\n"))))
          (buf (find-buffer-visiting remember-data-file)))