help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

today's goal - no goals allowed


From: Emanuel Berg
Subject: today's goal - no goals allowed
Date: Tue, 08 Nov 2022 03:42:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/today.el

(defun date (&optional fmt)
  (or fmt (setq fmt "%F"))
  (format-time-string fmt) )

(defun today (&optional no-insert)
  (interactive "P")
  (let ((date (date)))
    (if no-insert
        (prog1 date
          (message date) )
      (save-excursion
        (if (looking-at 
"[[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}")
            (replace-match date)
          (insert date) )
        (save-buffer) ))))

(provide 'today)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]