summaryrefslogtreecommitdiff
path: root/lisp/textmodes/remember.el
diff options
context:
space:
mode:
authorBastien Guerry <bzg@gnu.org>2013-04-24 16:35:59 +0200
committerBastien Guerry <bzg@gnu.org>2013-04-24 16:35:59 +0200
commit1ffefcf908c9452b752a35306d29eca48c723149 (patch)
treeea4434efd70ccbabe339e44c1f388f5582ee5ac5 /lisp/textmodes/remember.el
parent4391916c58d5d2fb09b7a505161f37401f2542d2 (diff)
downloademacs-1ffefcf908c9452b752a35306d29eca48c723149.tar.gz
* textmodes/remember.el (remember-handler-functions): Add an
option for a new handler `remember-store-in-files'. (remember-data-directory, remember-directory-file-name-format): New options. (remember-store-in-files): New function to store remember notes as separate files within a directory.
Diffstat (limited to 'lisp/textmodes/remember.el')
-rw-r--r--lisp/textmodes/remember.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index 16b99627400..1286e5d803e 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -216,10 +216,11 @@ All functions are run in the remember buffer."
Each function is called with the current buffer narrowed to what the
user wants remembered.
If any function returns non-nil, the data is assumed to have been
-recorded somewhere by that function. "
+recorded somewhere by that function."
:type 'hook
:options '(remember-store-in-mailbox
remember-append-to-file
+ remember-store-in-files
remember-diary-extract-entries
org-remember-handler)
:group 'remember)
@@ -429,6 +430,27 @@ If you want to remember a region, supply a universal prefix to
(run-hook-with-args-until-success 'remember-handler-functions))
(remember-destroy))))
+(defcustom remember-data-directory "~/remember"
+ "The directory in which to store remember data as files."
+ :type 'file
+ :group 'remember)
+
+(defcustom remember-directory-file-name-format "%Y-%m-%d_%T-%z"
+ "Format string for the file name in which to store unprocessed data."
+ :type 'file
+ :group 'remember)
+
+(defun remember-store-in-files ()
+ "Store remember data in a file in `remember-data-directory'.
+The file is named after `remember-directory-file-name-format'."
+ (let ((name (format-time-string
+ remember-directory-file-name-format (current-time)))
+ (text (buffer-string)))
+ (with-temp-buffer
+ (insert text)
+ (write-file (convert-standard-filename
+ (format "%s/%s" remember-data-directory name))))))
+
;;;###autoload
(defun remember-clipboard ()
"Remember the contents of the current clipboard.