bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22700: 25.0.91; `erc-echo-timestamps' no longer echoes timestamp for


From: Stefan Monnier
Subject: bug#22700: 25.0.91; `erc-echo-timestamps' no longer echoes timestamp for each line
Date: Wed, 14 Aug 2019 18:50:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> This is because cursor-sensor--detect doesn't call
> cursor-sensor-functions if the text property hasn't changed[1]. Since ERC
> applies the property to _all_ of the message, the text property remains
> `eq' and so it doesn't get called when it should.

How 'bout the patch below which makes the function different on
each message?


        Stefan


diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index b48803452a..03ea69ed4f 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -1,4 +1,4 @@
-;;; erc-stamp.el --- Timestamping for ERC messages
+;;; erc-stamp.el --- Timestamping for ERC messages  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
@@ -185,11 +185,10 @@ erc-add-timestamp
                 (not erc-timestamp-format))
        (funcall erc-insert-away-timestamp-function
                 (erc-format-timestamp ct erc-away-timestamp-format)))
-      (add-text-properties (point-min) (point-max)
-                          (list 'timestamp ct))
       (add-text-properties (point-min) (point-max)
                           (list 'cursor-sensor-functions
-                                (list #'erc-echo-timestamp))))))
+                                (list (lambda (_window _before dir)
+                                        (erc-echo-timestamp dir ct))))))))
 
 (defvar erc-timestamp-last-inserted nil
   "Last timestamp inserted into the buffer.")
@@ -399,14 +398,12 @@ erc-toggle-timestamps
            (erc-munge-invisibility-spec)))
        (erc-buffer-list)))
 
-(defun erc-echo-timestamp (window _before dir)
+(defun erc-echo-timestamp (dir stamp)
   "Print timestamp text-property of an IRC message."
   (when (and erc-echo-timestamps (eq 'entered dir))
-    (let* ((now (window-point window))
-          (stamp (get-text-property now 'timestamp)))
-      (when stamp
-       (message "%s" (format-time-string erc-echo-timestamp-format
-                                         stamp))))))
+    (when stamp
+      (message "%s" (format-time-string erc-echo-timestamp-format
+                                       stamp)))))
 
 (provide 'erc-stamp)
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]