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

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

bug#54718: 28.0.92; rcirc channel-vs-log buffer confusion


From: Philip Kaludercic
Subject: bug#54718: 28.0.92; rcirc channel-vs-log buffer confusion
Date: Tue, 05 Apr 2022 10:03:49 +0000

Ken Raeburn <raeburn@redhat.com> writes:

> I’m using rcirc, and have logging turned on.   When I started up
> rcirc, I already had one of the log files
> (~/.emacs.d/rcirc-log/#gnucash@irc.gnome.org) being viewed in a
> buffer. That buffer, sensibly enough, was named
> “#gnucash@irc.gnome.org”.   Once rcirc connected to irc.gnome.org, and
> joined my channels, it looked for a buffer named
> “#gnucash@irc.gnome.org”, assumed that that was its own buffer for
> showing channel messages, switched it to rcirc mode, and started
> adding to it. So now, the buffer starts off:      2022-04-04T18:01:18
> *** raeburn JOIN
>    2022-04-04T18:01:18 *** ChanServ MODE +v raeburn
>    2022-04-04T18:01:18 *** TOPIC Free GPL Personal and Small Business
>    Accounting…
>    2022-04-04T18:01:18 *** NAMES …
>    2021-11-01T13:49:16 *** sbluhm JOIN     2021-11-01T13:50:25 ***
>   Mechtilde QUIT Ping timeout: 180 seconds
>    2021-11-01T14:10:13 *** jervin QUIT Quit: jervin
>

[...]

> I can probably work around this by tweaking desktop-files-not-to-save so
> I don’t accidentally hit this when restarting Emacs, but (1) I do want
> to be able to look at a log file and preserve my position in it from
> session to session, and (2) manually pulling up a log file before
> starting rcirc would still trigger the same lossage.

It might help to add rcirc-mode to desktop-modes-not-to-save, but you
are right the fundamental issue still is that rcirc can get confused by
specific buffer names.

One solution might just be to wrap the body of
rcirc-generate-new-buffer-name in a generate-new-buffer call, so as to
avoid these issue.  IIRC there should be no issue if the buffer name for
a rcirc chat buffer has a modified name, as the buffer objects all
managed via rcirc-buffer-alist and rcirc-get-buffer.

Could you try applying this patch to see if this improves the situation,
or if some other issues arise:

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 859dc175e5..1f82924d98 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1556,10 +1556,11 @@ rcirc-clean-up-buffer
 (defun rcirc-generate-new-buffer-name (process target)
   "Return a buffer name based on PROCESS and TARGET.
 This is used for the initial name given to IRC buffers."
-  (substring-no-properties
-   (if target
-       (concat target "@" (process-name process))
-     (concat "*" (process-name process) "*"))))
+  (generate-new-buffer
+   (substring-no-properties
+    (if target
+        (concat target "@" (process-name process))
+      (concat "*" (process-name process) "*")))))
 
 (defun rcirc-get-buffer (process target &optional server)
   "Return the buffer associated with the PROCESS and TARGET.
-- 
        Philip Kaludercic

reply via email to

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