diff --git a/.emacs.d/site-lisp/eltuki.el b/.emacs.d/site-lisp/eltuki.el index cc5d1b3..4815108 100644 --- a/.emacs.d/site-lisp/eltuki.el +++ b/.emacs.d/site-lisp/eltuki.el @@ -84,8 +84,8 @@ (let ((newtime (format-time-string " %s"))) (if (re-search-forward "^#\\+TIMESTAMP:\\(.*\\)$" nil t) (replace-match newtime nil t nil 1) - (search-forward "\n\n") - (backward-char) + (when (search-forward "\n\n" nil t) + (backward-char)) (insert "#+TIMESTAMP:" newtime "\n"))))) (defun eltuki-get-tags () @@ -102,8 +102,8 @@ (goto-char (point-min)) (if (re-search-forward "^#\\+TAGS:\\(.*\\)$" nil t) (replace-match tags t t nil 1) - (search-forward "\n\n") - (backward-char) + (when (search-forward "\n\n" nil t) + (backward-char)) (insert "#+TAGS:" tags "\n")))) (defun eltuki-get-status () @@ -123,8 +123,8 @@ " draft"))) (if (re-search-forward "^#\\+STATUS:\\(.*\\)$" nil t) (replace-match newstatus t t nil 1) - (search-forward "\n\n") - (backward-char) + (when (search-forward "\n\n" nil t) + (backward-char)) (insert "#+STATUS:" newstatus "\n"))))) (defun eltuki-get-comment-status () @@ -145,8 +145,8 @@ " closed"))) (if (re-search-forward "^#\\+COMMENTSTATUS:\\(.*\\)$" nil t) (replace-match newstatus t t nil 1) - (search-forward "\n\n") - (backward-char) + (when (search-forward "\n\n" nil t) + (backward-char)) (insert "#+COMMENTSTATUS:" newstatus "\n"))))) (defun eltuki-slugify-string (str)