From c4d98ab82a9edac04abdde59df4055685f17b6cb Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 18 Sep 2023 22:50:28 -0700 Subject: [PATCH 1/3] [5.6] Prefer ticks/hz pairs for erc-timestamp values on <29 * lisp/erc/erc-compat.el (erc-compat--current-lisp-time): New macro to prefer ticks/hz pairs on older Emacs versions. They're easier to compare at a glance when used as values for text properties. * lisp/erc/erc-stamp.el (erc-stamp--current-time): Use compat macro. (Bug#60936) --- lisp/erc/erc-compat.el | 6 ++++++ lisp/erc/erc-stamp.el | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 109b5d245ab..4dae578de67 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -444,6 +444,12 @@ erc-compat--29-browse-url-irc (cons '("\\`irc6?s?://" . erc-compat--29-browse-url-irc) existing)))))) +(defmacro erc-compat--current-lisp-time () + "Return `current-time' as a frequency pair." + (if (>= emacs-major-version 29) + '(let (current-time-list) (current-time)) + '(time-convert nil t))) + (provide 'erc-compat) diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index f159b6d226f..0f3163bf68d 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -215,7 +215,7 @@ erc-stamp--current-time (cl-defgeneric erc-stamp--current-time () "Return a lisp time object to associate with an IRC message. This becomes the message's `erc-timestamp' text property." - (let (current-time-list) (current-time))) + (erc-compat--current-lisp-time)) (cl-defmethod erc-stamp--current-time :around () (or erc-stamp--current-time (cl-call-next-method))) -- 2.41.0