;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/time-my-insert.el ;;; https://dataswamp.org/~incal/emacs-init/time-my-insert.el (require 'subr-x) (defun insert-shell-command (cmd) (interactive "s Command: ") (let ((pos (point)) (end (point-max)) ) (shell-command cmd 1) (goto-char (+ pos (- (point-max) end 1))) ) (delete-char 1) ) (defun get-date () (format-time-string "%F") ) (defun insert-date () (interactive) (insert (get-date)) ) (defun today-unique () (interactive) (let ((today-str (get-date)) (pt (point)) ) (goto-char (point-min)) (if (re-search-forward today-str (point-max) t) (goto-char pt) (goto-char pt) (insert today-str) ))) (defun insert-time () (interactive) (insert-shell-command "date +\"%H:%M\"") ) (defun updated () (unless (looking-at "$") (kill-line)) (insert " ") (insert-date) (save-buffer) ) ;; example file: ;; ;; list of things to study ;; --------------------------------------------- ;; ;; the Emacs manual ;; ;; Kate Moss's autobiography ;; ;; more X-Men and Alita comics ;; ;; big book on computer architecture (maybe) ;; ;; my hygrometer ;; ;; --------------------------------------------- ;; (updated) 2020-05-10 ;; ^eval me! (provide 'time-my-insert)