From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Branham Newsgroups: gmane.emacs.bugs Subject: bug#22700: 25.0.91; `erc-echo-timestamps' no longer echoes timestamp for each line Date: Wed, 14 Aug 2019 08:49:00 -0500 Message-ID: <87ftm36enn.fsf@gmail.com> References: <87r3gcmyfc.fsf@riseup.net> <871sfh4o92.fsf@mouse.gnus.org> <87h8ocei9c.fsf@mouse.gnus.org> <87imr0u7dc.fsf@gmail.com> <877e7gvhpq.fsf@mouse.gnus.org> <875zn0r9x4.fsf@gmail.com> <874l2kio0r.fsf@gmail.com> <837e7gsc3q.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="187252"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: larsi@gnus.org, 22700@debbugs.gnu.org, npostavs@gmail.com, monnier@IRO.UMontreal.CA To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 14 15:50:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hxtfI-000maR-F7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Aug 2019 15:50:12 +0200 Original-Received: from localhost ([::1]:60882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hxtfH-0007cY-DV for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Aug 2019 09:50:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54442) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hxtfA-0007b0-AH for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 09:50:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxtf9-000411-1h for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 09:50:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hxtf8-00040n-UM for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 09:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hxtf8-0005Jy-Ni for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 09:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Branham Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Aug 2019 13:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22700 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed patch Original-Received: via spool by 22700-submit@debbugs.gnu.org id=B22700.156579055220391 (code B ref 22700); Wed, 14 Aug 2019 13:50:02 +0000 Original-Received: (at 22700) by debbugs.gnu.org; 14 Aug 2019 13:49:12 +0000 Original-Received: from localhost ([127.0.0.1]:49029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hxteK-0005Io-FY for submit@debbugs.gnu.org; Wed, 14 Aug 2019 09:49:12 -0400 Original-Received: from mail-ot1-f51.google.com ([209.85.210.51]:34732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hxteJ-0005Ib-0F for 22700@debbugs.gnu.org; Wed, 14 Aug 2019 09:49:11 -0400 Original-Received: by mail-ot1-f51.google.com with SMTP id c7so9862288otp.1 for <22700@debbugs.gnu.org>; Wed, 14 Aug 2019 06:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=zi/PGZ0sYFSN62naCpKkmvpQAw0EEDkPdfJ0ueJuK2Q=; b=QzN/sYYcOerPw89ai8sT5/1UbDgzK7d1RRM0qgPUvTWOZcWOKcPz3ijZ+VcxPbNePt tesn9ULEbciYQfInQFhvR+1X1wmKEIqW6gutKENBe9TUIc8E1Ew7rA9mBykOcnBG72JU 2yQMQdJS0DnAWCHH8+VhxndUUagIneiyIwmWAmhNB8b+2WZ2fWswPuPjY1U4yAs1NyQx zl723clq3YPdnQAyxp9aG1cIU3V9N1M29YS8MBpxZianNO7ch2C9Yu8S2kLQcmEwpqTe /qahy0lK+Vs/cGiARAHC3hczIIfAtbc8PUbsmMx6yCcbBann3mgAH3Doq6CpzrFtCsl9 0cpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=zi/PGZ0sYFSN62naCpKkmvpQAw0EEDkPdfJ0ueJuK2Q=; b=UShq4tmN5YunqKaDv9IugR8maiyFT4g16qxeClIRXfFGAdHGAD9xn7F3eV3A3bFnMX NhqOdn6nxrUTLXvqUD00qf6z/K315JAo04Oari2Ft4JhyoN3jX9wezEUa7T85ipAkaGN z+RUhpEJ508oVcIW6dSTRLm+VI/qp/Y3pvdss9aY38Ca7IsZOIC9MZekOUzrb3obAXqj i7ugVGFmDgvBX/ljIRQzciaoJSNShIGGlTcvsmfcEHKIjIz//lx0EvMWEw4CMGHt6RQr xcgBa5VssPXZKzt68/cpsWXfQFKvSAuIJ3oDiRjtEPO/3jtL7ljojXxAL37oFTsvMS7p GWnw== X-Gm-Message-State: APjAAAVxy7C37jlRLJEgEUG09NSmoj+P9zrGjFssVlchhn0qEUVlYhQl beqlDwmYqZw+JUVOu3+Lat8= X-Google-Smtp-Source: APXvYqz2gqD65HJ5xeAVahqP5FncqZxlZ42MY0KctqfeBq8/fwG/zPPBwz6p8e8CrDdA5qOioerM4g== X-Received: by 2002:a9d:5a82:: with SMTP id w2mr36264902oth.240.1565790545265; Wed, 14 Aug 2019 06:49:05 -0700 (PDT) Original-Received: from mars (cpe-70-114-192-208.austin.res.rr.com. [70.114.192.208]) by smtp.gmail.com with ESMTPSA id m21sm36081890otl.70.2019.08.14.06.49.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 06:49:01 -0700 (PDT) In-Reply-To: <837e7gsc3q.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Aug 2019 05:40:57 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164972 Archived-At: --=-=-= Content-Type: text/plain On Wed 14 Aug 2019 at 05:40, Eli Zaretskii wrote: >> AFAIR there's no way to reliably check what message (if any) is >> currently being displayed though, right? > > What's wrong with current-message? I didn't know it existed, that's what's wrong with it! New patch attached that fixes the issue by hooking erc-echo-timestamp onto post-command-hook. Thanks, Alex --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-erc-echo-timestamps.patch >From 33f3068fac5b6aad7a01e650f440afcdd965863e Mon Sep 17 00:00:00 2001 From: Alex Branham Date: Wed, 14 Aug 2019 08:39:23 -0500 Subject: [PATCH] Fix erc-echo-timestamps * lisp/erc/erc-stamp.el: Move to lexical binding. (erc-stamp-mode): Add erc-echo-timestamps to erc-mode-hook. (erc-add-timestamp, erc-munge-invisibility-spec): Don't rely on cursor-sensor-functions. (erc-echo-timestamps): New function to add erc-echo-timestamp to post-command-hook in ERC buffers. (erc-echo-timestamp): Modify to not rely on cursor-sensor-functions. Bug#22700 --- lisp/erc/erc-stamp.el | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index b48803452a..18865cab9a 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. @@ -37,6 +37,9 @@ (require 'erc) (require 'erc-compat) +(eval-when-compile + (require 'subr-x)) + (defgroup erc-stamp nil "For long conversation on IRC it is sometimes quite useful to have individual messages timestamp. This @@ -163,10 +166,12 @@ stamp "This mode timestamps messages in the channel buffers." ((add-hook 'erc-mode-hook #'erc-munge-invisibility-spec) (add-hook 'erc-insert-modify-hook #'erc-add-timestamp t) - (add-hook 'erc-send-modify-hook #'erc-add-timestamp t)) + (add-hook 'erc-send-modify-hook #'erc-add-timestamp t) + (add-hook 'erc-mode-hook #'erc-echo-timestamps)) ((remove-hook 'erc-mode-hook #'erc-munge-invisibility-spec) (remove-hook 'erc-insert-modify-hook #'erc-add-timestamp) - (remove-hook 'erc-send-modify-hook #'erc-add-timestamp))) + (remove-hook 'erc-send-modify-hook #'erc-add-timestamp) + (remove-hook 'erc-mode-hook #'erc-echo-timestamps))) (defun erc-add-timestamp () "Add timestamp and text-properties to message. @@ -186,10 +191,7 @@ erc-add-timestamp (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 'timestamp ct))))) (defvar erc-timestamp-last-inserted nil "Last timestamp inserted into the buffer.") @@ -364,8 +366,6 @@ erc-format-timestamp (defun erc-munge-invisibility-spec () (and erc-timestamp-intangible (not (bound-and-true-p cursor-intangible-mode)) (cursor-intangible-mode 1)) - (and erc-echo-timestamps (not (bound-and-true-p cursor-sensor-mode)) - (cursor-sensor-mode 1)) (if erc-hide-timestamps (add-to-invisibility-spec 'timestamp) (remove-from-invisibility-spec 'timestamp))) @@ -399,14 +399,17 @@ erc-toggle-timestamps (erc-munge-invisibility-spec))) (erc-buffer-list))) -(defun erc-echo-timestamp (window _before dir) +(defun erc-echo-timestamps () + "Add `erc-echo-timestamp' to `post-command-hook' buffer-locally." + (add-hook 'post-command-hook #'erc-echo-timestamp nil t)) + +(defun erc-echo-timestamp () "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 erc-echo-timestamps + (when-let ((stamp (get-text-property (point) 'timestamp)) + (message (format-time-string erc-echo-timestamp-format stamp))) + (unless (string= message (current-message)) + (message "%s" message))))) (provide 'erc-stamp) -- 2.22.0 --=-=-=--