From 6ea6a99c875d95517ef3e2b193e6db20ae8f907c Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 3 Jan 2020 03:50:53 +0100 Subject: [PATCH] Emacs: Simplify `my/message-with-timestamp`. --- init.d/basics/misc.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/init.d/basics/misc.el b/init.d/basics/misc.el index 4fdb37f..9aa05d4 100644 --- a/init.d/basics/misc.el +++ b/init.d/basics/misc.el @@ -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)