unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5563: 23.1; erc reconnection should reuse existing buffers
@ 2010-02-11 17:00 Tom Tromey
  2010-02-13  2:06 ` bug#5563: zealously reacquiring orphaned erc buffers Vivek Dasmohapatra
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2010-02-11 17:00 UTC (permalink / raw)
  To: 5563


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


I connect to multiple irc servers with erc.
There are a couple of channels that have the same name on different
servers; e.g. I have two different channels named #gdb.

erc puts these into buffers named #gdb and #gdb<2>.
Ok so far.

Now, on occasion I will lose connection to the servers.  erc will
reconnect.  In this case, usually the buffer #gdb will be properly
reused by the reconnection.  However, #gdb<2> will be discarded and erc
will make a new buffer named #gdb<3>.

I wish it always reused the existing buffer instead.



If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
 of 2010-01-14 on x86-01.phx2.fedoraproject.org
Windowing system distributor `The X.Org Foundation', version 11.0.10603901
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-bu
 ffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  gnus-undo-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
SPC m y SPC o t h e r SPC b u g , SPC I ' l l SPC d 
o SPC t h a t SPC n o w <return> C-z o M-v M-v C-r 
e r c C-a = <switch-frame> <switch-frame> C-s = > C-s 
C-s C-a Q y SPC SPC n <switch-frame> <switch-frame> 
c SPC s M-x r e p o r t - e m <tab> b <tab> C-g <switch-frame> 
f l e <tab> C-a C-k C-x b i r <tab> f r <tab> <return> 
/ h e l p SPC / q u i t M-b <backspace> <return> / 
h e l p SPC d i s c o n n e c t <return> M-p M-p <return> 
C-x 1 C-c b f l <tab> I SPC c a n ' t SPC t e s t SPC 
i t SPC r i g h t SPC n o w SPC b u t SPC i f SPC / 
q u i t SPC w o r k s SPC w h i l e SPC r <backspace> 
e r c SPC <M-backspace> <M-backspace> i n SPC M-b M-b 
M-b M-b C-k b a s i c a l l y SPC I SPC w a n t SPC 
/ q u i t SPC t o SPC w o r k SPC i n t SPC h e SPC 
s i t u a t i o n SPC M-b M-b C-b C-t C-e w h e r e 
SPC C-a C-k <f10> <f10> <f10> <f10> M-v M-> C-z o M-x 
r e p o r t - e m a c s - b u g <return> <return> C-x 
1 C-x k <return> y e s <return> M-x p <return> M-p 
<return>

Recent messages:
Saving /home/tromey/.newsrc.eld...
Saving file /home/tromey/.newsrc.eld...
Wrote /home/tromey/.newsrc.eld
Saving /home/tromey/.newsrc.eld...done
Quit
Type C-x 1 to delete the help window.
Type C-x 4 C-o RET to restore the other window.  
Type C-x 4 C-o RET to restore the other window.
Mark set
Making completion list...

Tom







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5563: zealously reacquiring orphaned erc buffers
  2010-02-11 17:00 bug#5563: 23.1; erc reconnection should reuse existing buffers Tom Tromey
@ 2010-02-13  2:06 ` Vivek Dasmohapatra
  2011-07-03 19:44   ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Dasmohapatra @ 2010-02-13  2:06 UTC (permalink / raw)
  To: 5563

[-- Attachment #1: Type: TEXT/PLAIN, Size: 246 bytes --]

Tags: patch

This patch should address the case you are seeing - you'll still get
orphaned buffers if you connect to the same server on different ports,
but the patch is trivially extendable to cover that case, should we
decide we care about it.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-diff; name=0001-Be-smarter-about-reacquiring-orphaned-erc-buffers.patch, Size: 2584 bytes --]

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1566,26 +1566,33 @@ symbol, it may have these values:
 (defun erc-generate-new-buffer-name (server port target &optional proc)
   "Create a new buffer name based on the arguments."
   (when (numberp port) (setq port (number-to-string port)))
-  (let* ((buf-name (or target
-		       (or (let ((name (concat server ":" port)))
-			     (when (> (length name) 1)
-			       name))
-			   ; This fallback should in fact never happen
-			   "*erc-server-buffer*"))))
+  (let ((buf-name (or target
+                      (or (let ((name (concat server ":" port)))
+                            (when (> (length name) 1)
+                              name))
+                          ;; This fallback should in fact never happen
+                          "*erc-server-buffer*")))
+        buffer-name)
     ;; Reuse existing buffers, but not if the buffer is a connected server
     ;; buffer and not if its associated with a different server than the
     ;; current ERC buffer.
-    (if (and erc-reuse-buffers
-	     (get-buffer buf-name)
-	     (or target
-		 (with-current-buffer (get-buffer buf-name)
-		   (and (erc-server-buffer-p)
-			(not (erc-server-process-alive)))))
-	     (with-current-buffer (get-buffer buf-name)
-	       (and (string= erc-session-server server)
-		    (erc-port-equal erc-session-port port))))
-	buf-name
-      (generate-new-buffer-name buf-name))))
+    ;; if buf-name is taken by a different connection (or by something !erc)
+    ;; then see if "buf-name/server" meets the same criteria
+    (dolist (candidate (list buf-name (concat buf-name "/" server))) 
+      (if (and (not buffer-name)
+               erc-reuse-buffers
+               (get-buffer candidate)
+               (or target
+                   (with-current-buffer (get-buffer candidate)
+                     (and (erc-server-buffer-p)
+                          (not (erc-server-process-alive)))))
+               (with-current-buffer (get-buffer candidate)
+                 (and (string= erc-session-server server)
+                      (erc-port-equal erc-session-port port))))
+          (setq buffer-name candidate)))
+    ;; if buffer-name is unset, neither candidate worked out for us,
+    ;; fallback to the old <N> uniquification method:
+    (or buffer-name (generate-new-buffer-name buf-name)) ))
 
 (defun erc-get-buffer-create (server port target &optional proc)
   "Create a new buffer based on the arguments."



^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5563: zealously reacquiring orphaned erc buffers
  2010-02-13  2:06 ` bug#5563: zealously reacquiring orphaned erc buffers Vivek Dasmohapatra
@ 2011-07-03 19:44   ` Lars Magne Ingebrigtsen
  2011-07-04 13:01     ` Vivek Dasmohapatra
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-03 19:44 UTC (permalink / raw)
  To: Vivek Dasmohapatra; +Cc: 5563

Vivek Dasmohapatra <vivek@etla.org> writes:

> Tags: patch
>
> This patch should address the case you are seeing - you'll still get
> orphaned buffers if you connect to the same server on different ports,
> but the patch is trivially extendable to cover that case, should we
> decide we care about it.
>
> diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el

Apparently this patch was never applied?  If it is still applicable, I
can apply it now.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5563: zealously reacquiring orphaned erc buffers
  2011-07-03 19:44   ` Lars Magne Ingebrigtsen
@ 2011-07-04 13:01     ` Vivek Dasmohapatra
  2011-07-04 13:23       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Dasmohapatra @ 2011-07-04 13:01 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 5563

> Apparently this patch was never applied?  If it is still applicable, I
> can apply it now.

Still applies cleanly, code doesn't seem to have changed so should still
be applicable.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#5563: zealously reacquiring orphaned erc buffers
  2011-07-04 13:01     ` Vivek Dasmohapatra
@ 2011-07-04 13:23       ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-04 13:23 UTC (permalink / raw)
  To: Vivek Dasmohapatra; +Cc: 5563

Vivek Dasmohapatra <vivek@etla.org> writes:

> Still applies cleanly, code doesn't seem to have changed so should still
> be applicable.

Ok; I've now applied it to Emacs 24.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-04 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-11 17:00 bug#5563: 23.1; erc reconnection should reuse existing buffers Tom Tromey
2010-02-13  2:06 ` bug#5563: zealously reacquiring orphaned erc buffers Vivek Dasmohapatra
2011-07-03 19:44   ` Lars Magne Ingebrigtsen
2011-07-04 13:01     ` Vivek Dasmohapatra
2011-07-04 13:23       ` Lars Magne Ingebrigtsen

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