Prefer ticks/hz pairs for some ERC timestamps on 29+
* lisp/erc/erc-compat.el (erc-compat--current-lisp-time): New macro to prefer ticks/hz pairs on newer Emacs versions because stamps of this form are 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)
This commit is contained in:
parent
06fb8b7620
commit
8db56235cb
2 changed files with 16 additions and 1 deletions
|
@ -444,6 +444,21 @@ If START or END is negative, it counts from the end."
|
|||
(cons '("\\`irc6?s?://" . erc-compat--29-browse-url-irc)
|
||||
existing))))))
|
||||
|
||||
;; We can't store (TICKS . HZ) style timestamps on 27 and 28 because
|
||||
;; `time-less-p' and friends do
|
||||
;;
|
||||
;; message("obsolete timestamp with cdr ...", ...)
|
||||
;; decode_lisp_time(_, WARN_OBSOLETE_TIMESTAMPS, ...)
|
||||
;; lisp_time_struct(...)
|
||||
;; time_cmp(...)
|
||||
;;
|
||||
;; which spams *Messages* (and stderr when running the test suite).
|
||||
(defmacro erc-compat--current-lisp-time ()
|
||||
"Return `current-time' as a (TICKS . HZ) pair on 29+."
|
||||
(if (>= emacs-major-version 29)
|
||||
'(let (current-time-list) (current-time))
|
||||
'(current-time)))
|
||||
|
||||
|
||||
(provide 'erc-compat)
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ the stamp passed to `erc-insert-timestamp-function'.")
|
|||
(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)))
|
||||
|
|
Loading…
Add table
Reference in a new issue