unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ERC: [PATCH] use network name for server buffer name
@ 2014-07-24 12:35 Kelvin White
  2014-07-25  6:32 ` Cédric Chépied
  0 siblings, 1 reply; 3+ messages in thread
From: Kelvin White @ 2014-07-24 12:35 UTC (permalink / raw)
  To: emacs-devel


This change mainly affects users that may connect to the same server
multiple times for multiple networks. e.g. bouncers like ZNC or proxy
users. In these cases a user will have multiple server-buffers with
the same name (i.e. irc.example.net:6697, irc.example.net:6697<2> etc.)
This patch will rename the server-buffer to whatever the network name
is, if available. Otherwise, the hostname:port will be used as normal.

=== modified file 'lisp/erc/erc.el'
--- lisp/erc/erc.el     2014-07-08 19:45:24 +0000
+++ lisp/erc/erc.el     2014-07-24 12:25:24 +0000
@@ -6233,7 +6233,9 @@
     (cond ((erc-default-target)
            (concat (erc-string-no-properties (erc-default-target))
                    "@" network-name))
-          (network-name network-name)
+          (network-name
+           (rename-buffer network-name)
+           network-name)
           (t (buffer-name (current-buffer))))))



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

* Re: ERC: [PATCH] use network name for server buffer name
  2014-07-24 12:35 ERC: [PATCH] use network name for server buffer name Kelvin White
@ 2014-07-25  6:32 ` Cédric Chépied
  2014-07-25 16:11   ` Mirek Kaim
  0 siblings, 1 reply; 3+ messages in thread
From: Cédric Chépied @ 2014-07-25  6:32 UTC (permalink / raw)
  To: Kelvin White; +Cc: emacs-devel

At Thu, 24 Jul 2014 08:35:04 -0400,
Kelvin White wrote:
> 
> 
> This change mainly affects users that may connect to the same server
> multiple times for multiple networks. e.g. bouncers like ZNC or proxy
> users. In these cases a user will have multiple server-buffers with
> the same name (i.e. irc.example.net:6697, irc.example.net:6697<2> etc.)
> This patch will rename the server-buffer to whatever the network name
> is, if available. Otherwise, the hostname:port will be used as normal.
> 
> === modified file 'lisp/erc/erc.el'
> --- lisp/erc/erc.el     2014-07-08 19:45:24 +0000
> +++ lisp/erc/erc.el     2014-07-24 12:25:24 +0000
> @@ -6233,7 +6233,9 @@
>      (cond ((erc-default-target)
>             (concat (erc-string-no-properties (erc-default-target))
>                     "@" network-name))
> -          (network-name network-name)
> +          (network-name
> +           (rename-buffer network-name)
> +           network-name)
>            (t (buffer-name (current-buffer))))))
> 

I had another problem but quite similar. I'm using znc to connect to several
network and sometimes I speak to people with the same nick but on different
network so I rewrited the erc-get-buffer-create function. Network name is
appended at the end of buffer name. Sorry I have no patch for this, only the
code:

(defun erc-get-buffer-create (server port target)
  "Create a new buffer based on the arguments."
  (setq target (concat target "@" (prin1-to-string (erc-current-network))))
  (get-buffer-create (erc-generate-new-buffer-name server port target)))

It is not perfect because for server buffers I have "@nil", "@nil<1>", ... but
it works great for channels or private messages.
-- 
Cédric Chépied
<cedric.chepied@gmail.com>



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

* RE: ERC: [PATCH] use network name for server buffer name
  2014-07-25  6:32 ` Cédric Chépied
@ 2014-07-25 16:11   ` Mirek Kaim
  0 siblings, 0 replies; 3+ messages in thread
From: Mirek Kaim @ 2014-07-25 16:11 UTC (permalink / raw)
  To: Cédric Chépied, Kelvin White; +Cc: emacs-devel@gnu.org

for znc, the best solution is this, imho:
https://github.com/sshirokov/ZNC.el

perhaps someone should ask him to include it in ERC, it's more sophisticated
than simple buffer rename.


unic0rn


> Date: Fri, 25 Jul 2014 08:32:55 +0200
> From: cedric.chepied@gmail.com
> To: kwhite@gnu.org
> Subject: Re: ERC: [PATCH] use network name for server buffer name 
> CC: emacs-devel@gnu.org
> 
> At Thu, 24 Jul 2014 08:35:04 -0400,
> Kelvin White wrote:
>> 
>> 
>> This change mainly affects users that may connect to the same server
>> multiple times for multiple networks. e.g. bouncers like ZNC or proxy
>> users. In these cases a user will have multiple server-buffers with
>> the same name (i.e. irc.example.net:6697, irc.example.net:6697<2> etc.)
>> This patch will rename the server-buffer to whatever the network name
>> is, if available. Otherwise, the hostname:port will be used as normal.
>> 
>> === modified file 'lisp/erc/erc.el'
>> --- lisp/erc/erc.el     2014-07-08 19:45:24 +0000
>> +++ lisp/erc/erc.el     2014-07-24 12:25:24 +0000
>> @@ -6233,7 +6233,9 @@
>>      (cond ((erc-default-target)
>>             (concat (erc-string-no-properties (erc-default-target))
>>                     "@" network-name))
>> -          (network-name network-name)
>> +          (network-name
>> +           (rename-buffer network-name)
>> +           network-name)
>>            (t (buffer-name (current-buffer))))))
>> 
> 
> I had another problem but quite similar. I'm using znc to connect to several
> network and sometimes I speak to people with the same nick but on different
> network so I rewrited the erc-get-buffer-create function. Network name is
> appended at the end of buffer name. Sorry I have no patch for this, only the
> code:
> 
> (defun erc-get-buffer-create (server port target)
>   "Create a new buffer based on the arguments."
>   (setq target (concat target "@" (prin1-to-string (erc-current-network))))
>   (get-buffer-create (erc-generate-new-buffer-name server port target)))
> 
> It is not perfect because for server buffers I have "@nil", "@nil<1>", ... but
> it works great for channels or private messages.
> -- 
> Cédric Chépied
> <cedric.chepied@gmail.com>
> 
 		 	   		  


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

end of thread, other threads:[~2014-07-25 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-24 12:35 ERC: [PATCH] use network name for server buffer name Kelvin White
2014-07-25  6:32 ` Cédric Chépied
2014-07-25 16:11   ` Mirek Kaim

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