all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alex Branham <alex.branham@gmail.com>
Cc: "William G. Gardella" <wgg2@member.fsf.org>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	22700@debbugs.gnu.org
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	[thread overview]
Message-ID: <jwvh86j4b2s.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87imr0u7dc.fsf@gmail.com> (Alex Branham's message of "Tue, 13 Aug 2019 15:40:15 -0500")

> 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)
 






  parent reply	other threads:[~2019-08-14 22:50 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=jwvh86j4b2s.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=22700@debbugs.gnu.org \
    --cc=alex.branham@gmail.com \
    --cc=larsi@gnus.org \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.