unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Branham <alex.branham@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "William G. Gardella" <wgg2@member.fsf.org>,
	22700@debbugs.gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>
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	[thread overview]
Message-ID: <87imr0u7dc.fsf@gmail.com> (raw)
In-Reply-To: <87h8ocei9c.fsf@mouse.gnus.org> (Lars Ingebrigtsen's message of "Sun, 15 Apr 2018 15:01:03 +0200")

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-erc-echo-timestamps.patch --]
[-- Type: text/x-patch, Size: 1172 bytes --]

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	other threads:[~2019-08-13 20:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 16:07 bug#22700: 25.0.91; `erc-echo-timestamps' no longer echoes timestamp for each line William G. Gardella
2018-04-14 18:49 ` Lars Ingebrigtsen
2018-04-15  0:06   ` Stefan Monnier
2018-04-15 13:01     ` Lars Ingebrigtsen
2019-08-13 20:40       ` Alex Branham [this message]
2019-08-13 22:11         ` Lars Ingebrigtsen
2019-08-13 22:13           ` Noam Postavsky
2019-08-14  0:33             ` Alex Branham
2019-08-14  2:40               ` Eli Zaretskii
2019-08-14 13:49                 ` Alex Branham
2019-08-14 14:39                   ` Eli Zaretskii
2019-08-14 14:56                   ` Noam Postavsky
2019-08-14 15:16                     ` Alex Branham
2019-08-14 22:50         ` Stefan Monnier
2019-08-15 14:27           ` Alex Branham
2019-08-15 23:41             ` Lars Ingebrigtsen
2019-08-16 13:25               ` Alex Branham
2019-08-19  9:46             ` Stefan Monnier
2019-08-27 15:08               ` Alex Branham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imr0u7dc.fsf@gmail.com \
    --to=alex.branham@gmail.com \
    --cc=22700@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=wgg2@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).