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: Alex Branham
Subject: bug#22700: 25.0.91; `erc-echo-timestamps' no longer echoes timestamp for each line
Date: Tue, 13 Aug 2019 15:40:15 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

tags 22700 patch
quit

Hi all -

This bug has been open a while, so just a quick reminder:
erc-echo-timestamps does not work except for the first and last
messages.

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.

We can fix this in ERC by not applying the text property to the whole
message. I suggest not applying it to the last character. Now whenever
you move point between messages, the timestamp gets echoed. Unless point
winds up at the very end of the line, which is possible if you're moving
from the end of a long message to a short message. Clearly not ideal,
but better than the current situation.

Patch attached.

Thanks,
Alex

Footnotes:
[1]  It's due to these lines in cursor-sensor--detect:

      (if (or (and (null new) (null (cdr old)))
              (and (eq new (cdr old))
                   (eq (next-single-char-property-change
                        start 'cursor-sensor-functions nil end)
                       end)))
          ;; Clearly nothing to do.
          nil


>From a42814e8922f4bd69e0726a6f05e55e15337c536 Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham@gmail.com>
Date: Tue, 13 Aug 2019 15:30:26 -0500
Subject: [PATCH] Fix erc-echo-timestamps

* lisp/erc/erc-stamp.el (erc-add-timestamp): Use (1- (point-max))
since `cursor-sensor--detect' skips `cursor-sensor-functions' if the
property hasn't changed since the cursor moved.  By not applying the
property to the last character of a message, we're guaranteeing that
the text property changes when we move point to a different ERC
message.

Bug#22700
---
 lisp/erc/erc-stamp.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index b48803452a..cbe9fe3e6a 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -187,7 +187,7 @@ or `erc-send-modify-hook'."
                 (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)
+      (add-text-properties (point-min) (1- (point-max))
                           (list 'cursor-sensor-functions
                                 (list #'erc-echo-timestamp))))))
 
-- 
2.22.0


reply via email to

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