Emacs: Simplify my/message-with-timestamp.

This commit is contained in:
tastytea 2020-01-03 03:50:53 +01:00
parent 6bd6e9f5c3
commit 6ea6a99c87

View File

@ -1,6 +1,6 @@
;;; misc.el --- Basic things that do not fit any other category. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-01-01T03:42:07+0100>
;; Time-stamp: <2020-01-03T03:50:12+0100>
;;; Commentary:
@ -10,13 +10,11 @@
:ensure nil
:config
(defun my/message-with-timestamp (old-func fmt-string &rest args)
"Prepend current timestamp to a message"
(apply old-func
(concat (format-time-string "[%FT%T%z] ") fmt-string)
args))
(defun my/message-with-timestamp (args)
"Prepend current timestamp to a `message' output."
(push (concat (format-time-string "[%FT%T] ") (car args)) (cdr args)))
(advice-add 'message :around #'my/message-with-timestamp)
(advice-add 'message :filter-args 'my/message-with-timestamp)
)
(provide 'basics/misc)