From 4ca025000cfd55d6fa17f6e310edfe50966eb680 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 30 Jul 2015 13:43:13 +0000 Subject: [PATCH] Refactor Zim timestamp generator as a defun --- zim.el | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/zim.el b/zim.el index e3896e0..6e53ae9 100644 --- a/zim.el +++ b/zim.el @@ -1,6 +1,19 @@ +(defun zim-timestamp () + (with-temp-buffer + (insert (format-time-string "%Y-%m-%dT%H:%M:%S%z")) + (forward-char -2) + (insert ":") + (forward-char 2))) + (defun insert-zim-timestamp () (interactive) - (insert (format-time-string "%Y-%m-%dT%H:%M:%S%z")) - (forward-char -2) - (insert ":") - (forward-char 2)) + (insert (zim-timestamp))) + +(defun insert-zim-header () + (interactive) + (save-excursion + (goto-char (point-min)) + (insert + (concat "Content-Type: text/x-zim-wiki\n" + "Wiki-Format: zim 0.4\n" + "Creation-Date: " (zim-timestamp) "\n\n"))))