aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-11 02:41:46 +0200
committerTeddy Wing2018-04-11 02:41:46 +0200
commit8924a9d277ae8bd52ac9c9b47f8b27c8f40bed4d (patch)
treec9d2ebb66b4b32a9ae3a593bf17e92fe14dbfae6
parent348f1a987e248bb83d9c4c188333b67a2b3470cc (diff)
downloadw3m-session-backup-8924a9d277ae8bd52ac9c9b47f8b27c8f40bed4d.tar.bz2
Replace hard-coded filename with a generated one
Generate a filename using the current date and time. Still saves to the home directory. That's the next step, we'll need to find a way to customise the save directory.
-rw-r--r--w3m-session-backup.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/w3m-session-backup.el b/w3m-session-backup.el
index 47710d5..2f8fda4 100644
--- a/w3m-session-backup.el
+++ b/w3m-session-backup.el
@@ -38,7 +38,7 @@
(defun save-backup ()
"TODO"
- (with-temp-file "~/tmp-w3m-session.yml"
+ (with-temp-file (concat "~/" (filename))
(insert
(string-join
(mapcar
@@ -50,4 +50,9 @@
(my-w3m-session-backup))
"\n"))))
+(defun filename ()
+ "Generates a default filename using the current date & time."
+ (format "w3m-tabs-%s.yml"
+ (format-time-string "%Y%m%d-%Hh%M")))
+
(save-backup)