all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#17772: [PATCH] Dangling channels' buffer
@ 2014-06-13 10:41 Daimrod
  2014-06-13 18:36 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Daimrod @ 2014-06-13 10:41 UTC (permalink / raw)
  To: 17772

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

Hi,

In the attached patch, I propose a fix for the recent change of the
function `rcirc-buffer-process'. This function used to return the rcirc
server process when it existed, or nil. However, since a78d87e7ed it
raises an error.

This is a problem if the user kills the server buffer before it kills
the channels' buffer because it is not possible to kill them after that.
(The function `rcirc-clean-up-buffer' is called via `kill-buffer-hook'
and it calls `rcirc-buffer-process'.)

WDYT?

Regards,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-net-rcirc.el-rcirc-clean-up-buffer-Explicitly-c.patch --]
[-- Type: text/x-diff, Size: 1118 bytes --]

From 2ce0be284dc8830c3153d60cb0b01e082ab1c5b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@gmail.com>
Date: Fri, 13 Jun 2014 18:31:31 +0900
Subject: [PATCH] * lisp/net/rcirc.el (rcirc-clean-up-buffer): Explicitly check
 for the   `rcirc-server-buffer'

Since a78d87e7ed, `rcirc-buffer-process' raises an error instead of
returning nil when the `rcirc-server-buffer' doesn't exist.

Because of this, it was impossible to delete channels' buffer once the
`rcirc-server-buffer' has been deleted.
---
 lisp/net/rcirc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 41cc002..57a90de 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1158,7 +1158,7 @@ with it."
 (defun rcirc-clean-up-buffer (reason)
   (let ((buffer (current-buffer)))
     (rcirc-clear-activity buffer)
-    (when (and (rcirc-buffer-process)
+    (when (and (buffer-live-p rcirc-server-buffer)
 	       (rcirc--connection-open-p (rcirc-buffer-process)))
       (with-rcirc-server-buffer
        (setq rcirc-buffer-alist
-- 
1.8.0.2722.gc0242e5


[-- Attachment #3: Type: text/plain, Size: 17 bytes --]


--
Daimrod/Greg

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

* bug#17772: [PATCH] Dangling channels' buffer
  2014-06-13 10:41 bug#17772: [PATCH] Dangling channels' buffer Daimrod
@ 2014-06-13 18:36 ` Stefan Monnier
  2014-06-14  1:04   ` Daimrod
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-06-13 18:36 UTC (permalink / raw)
  To: Daimrod; +Cc: Ryan Yeske, Leo Liu, 17772

> server process when it existed, or nil. However, since a78d87e7ed it
> raises an error.

Please avoid using Git references until we actually switch to Git.
Use dates, for example, instead.

> This is a problem if the user kills the server buffer before it kills
> the channels' buffer because it is not possible to kill them after that.
> (The function `rcirc-clean-up-buffer' is called via `kill-buffer-hook'
> and it calls `rcirc-buffer-process'.)

Your patch doesn't look bad, but I wonder if a better option wouldn't be
to try and better preserve the previous behavior.  E.g. with the
patch below.

WDYT?


        Stefan


=== modified file 'lisp/net/rcirc.el'
--- lisp/net/rcirc.el	2014-05-12 16:06:13 +0000
+++ lisp/net/rcirc.el	2014-06-13 18:34:01 +0000
@@ -803,9 +804,8 @@
   "Return the process associated with channel BUFFER.
 With no argument or nil as argument, use the current buffer."
   (let ((buffer (or buffer (if (buffer-live-p rcirc-server-buffer)
-			       rcirc-server-buffer
-			     (error "Server buffer deleted")))))
-    (or (with-current-buffer buffer rcirc-process)
+			       rcirc-server-buffer))))
+    (or (if buffer (with-current-buffer buffer rcirc-process))
 	rcirc-process)))
 
 (defun rcirc-server-name (process)






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

* bug#17772: [PATCH] Dangling channels' buffer
  2014-06-13 18:36 ` Stefan Monnier
@ 2014-06-14  1:04   ` Daimrod
  2014-06-14  1:20     ` Daimrod
  0 siblings, 1 reply; 5+ messages in thread
From: Daimrod @ 2014-06-14  1:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Ryan Yeske, Leo Liu, 17772

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> server process when it existed, or nil. However, since a78d87e7ed it
>> raises an error.
>
> Please avoid using Git references until we actually switch to Git.
> Use dates, for example, instead.

Ok, I'll keep this in mind.

>> This is a problem if the user kills the server buffer before it kills
>> the channels' buffer because it is not possible to kill them after that.
>> (The function `rcirc-clean-up-buffer' is called via `kill-buffer-hook'
>> and it calls `rcirc-buffer-process'.)
>
> Your patch doesn't look bad, but I wonder if a better option wouldn't be
> to try and better preserve the previous behavior.  E.g. with the
> patch below.
>
> WDYT?

Fine for me, but you don't need the `or'.

> === modified file 'lisp/net/rcirc.el'
> --- lisp/net/rcirc.el	2014-05-12 16:06:13 +0000
> +++ lisp/net/rcirc.el	2014-06-13 18:34:01 +0000
> @@ -803,9 +804,8 @@
>    "Return the process associated with channel BUFFER.
>  With no argument or nil as argument, use the current buffer."
>    (let ((buffer (or buffer (if (buffer-live-p rcirc-server-buffer)
> -			       rcirc-server-buffer
> -			     (error "Server buffer deleted")))))
> -    (or (with-current-buffer buffer rcirc-process)
> +			       rcirc-server-buffer))))

+    (if buffer
+        (with-current-buffer buffer rcirc-process)
+      rcirc-process)))

> +    (or (if buffer (with-current-buffer buffer rcirc-process))
>  	rcirc-process)))
>  
>  (defun rcirc-server-name (process)
>

-- 
Daimrod/Greg





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

* bug#17772: [PATCH] Dangling channels' buffer
  2014-06-14  1:04   ` Daimrod
@ 2014-06-14  1:20     ` Daimrod
  2014-06-30  2:59       ` Leo Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Daimrod @ 2014-06-14  1:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Ryan Yeske, Leo Liu, 17772

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Daimrod <daimrod@gmail.com> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> server process when it existed, or nil. However, since a78d87e7ed it
>>> raises an error.
>>
>> Please avoid using Git references until we actually switch to Git.
>> Use dates, for example, instead.
>
> Ok, I'll keep this in mind.

Here is a new patch with your proposal:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-net-rcirc.el-rcirc-buffer-process-Return-the-pr.patch --]
[-- Type: text/x-diff, Size: 1327 bytes --]

From af9d16684d8449cfb006f70c4c2c1fe228e737fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@gmail.com>
Date: Sat, 14 Jun 2014 10:10:59 +0900
Subject: [PATCH] * lisp/net/rcirc.el (rcirc-buffer-process): Return the
 process   associated with the channel, or nil if it doesn't exit.

Since 2014-04-09, the current behavior was to raise an error if the
process didn't exist. This restore the previous behavior.
---
 lisp/net/rcirc.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 41cc002..73a6395 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -803,10 +803,10 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
   "Return the process associated with channel BUFFER.
 With no argument or nil as argument, use the current buffer."
   (let ((buffer (or buffer (if (buffer-live-p rcirc-server-buffer)
-			       rcirc-server-buffer
-			     (error "Server buffer deleted")))))
-    (or (with-current-buffer buffer rcirc-process)
-	rcirc-process)))
+			       rcirc-server-buffer))))
+    (if buffer
+        (with-current-buffer buffer rcirc-process)
+      rcirc-process)))
 
 (defun rcirc-server-name (process)
   "Return PROCESS server name, given by the 001 response."
-- 
1.8.0.2722.gc0242e5


[-- Attachment #3: Type: text/plain, Size: 19 bytes --]



-- 
Daimrod/Greg

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

* bug#17772: [PATCH] Dangling channels' buffer
  2014-06-14  1:20     ` Daimrod
@ 2014-06-30  2:59       ` Leo Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Leo Liu @ 2014-06-30  2:59 UTC (permalink / raw)
  To: Daimrod; +Cc: 17772-done, Ryan Yeske

Version: 24.5

On 2014-06-14 10:20 +0900, Daimrod wrote:
> Here is a new patch with your proposal:

Committed and thanks,

Leo





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

end of thread, other threads:[~2014-06-30  2:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 10:41 bug#17772: [PATCH] Dangling channels' buffer Daimrod
2014-06-13 18:36 ` Stefan Monnier
2014-06-14  1:04   ` Daimrod
2014-06-14  1:20     ` Daimrod
2014-06-30  2:59       ` Leo Liu

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.