unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / Atom feed
* bug#45809: 28.0.50; [PATCH] Add option remember-text-format-function
@ 2021-01-12  3:53 Gabriel do Nascimento Ribeiro
  0 siblings, 0 replies; only message in thread
From: Gabriel do Nascimento Ribeiro @ 2021-01-12  3:53 UTC (permalink / raw)
  To: 45809

[-- Attachment #1: Type: text/plain, Size: 80 bytes --]

Add option to configure a custom format of text being remembered in
remember.el

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-option-remember-text-format-function.patch --]
[-- Type: text/x-diff, Size: 1831 bytes --]

From 436ed1be3a5a44c712468dc98ab222679d3be7ba Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br>
Date: Tue, 12 Jan 2021 00:50:05 -0300
Subject: [PATCH] Add option remember-text-format-function

---
 lisp/textmodes/remember.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index 98d3a3856e..0b6baba62c 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -410,13 +410,24 @@ remember-time-format
   :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)))
-- 
2.27.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-12  3:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12  3:53 bug#45809: 28.0.50; [PATCH] Add option remember-text-format-function Gabriel do Nascimento Ribeiro

unofficial mirror of bug-gnu-emacs@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/emacs-bugs/0 emacs-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 emacs-bugs emacs-bugs/ https://yhetil.org/emacs-bugs \
		bug-gnu-emacs@gnu.org
	public-inbox-index emacs-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.bugs
	nntp://news.gmane.io/gmane.emacs.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git