unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* do it today, in a different way
@ 2022-10-19  1:17 Emanuel Berg
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2022-10-19  1:17 UTC (permalink / raw)
  To: help-gnu-emacs

What you once feared, now makes you free ...

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

(defun get-date ()
  (format-time-string "%F") )

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

(provide 'today)

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-19  1:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19  1:17 do it today, in a different way Emanuel Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).