all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Fix emacsclient's handling of SIGCONT.
@ 2014-02-20  0:05 Andreas Amann
  2014-02-25 18:47 ` Glenn Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Amann @ 2014-02-20  0:05 UTC (permalink / raw
  To: emacs-devel

* emacsclient.c (handle_sigcont):  previously it was not possible
to run emacsclient in the background using "bg", because SIGCONT
was blocked in this case.  Now SIGCONT is only blocked if the
Emacs frame is opened on the current terminal.
---

There is an annoying problem with backgrounding of emacsclient
processes. 
To illustrate the problem, do the following:

>emacs -Q -f server-start &
[1] xxxPID1xxx
>emacsclient -c filename
Waiting for Emacs...^Z (press control-z)
[2]+  Stopped                 emacsclient -c filename
>bg
[2]+ emacsclient -c ~/.bashrc &

[2]+  Stopped                 emacsclient -c ~/.bashrc

At this point, emacsclient is stopped and not running in the background
as it should after receiving the SIGCONT signal through "bg". We can
still go to the second emacs frame showing "filename", finish editing
the file and leave the frame with C-x #.  After this, the emacsclient is
stalled in the "Stopped" state, and does not exit as it should.  

It will only exit after issuing
>fg

The attached patch fixes this by only stopping emacsclient, if the emacs
frame is opened in the current terminal. 


 lib-src/ChangeLog     | 8 ++++++++
 lib-src/emacsclient.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 5005e1f..1c2862f 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-19  Andreas Amann  <a.amann@ucc.ie>
+
+	Fix emacsclient's handling of SIGCONT.
+	* emacsclient.c (handle_sigcont): previously it was not possible
+	to run emacsclient in the background using "bg", because SIGCONT
+	was blocked in this case.  Now SIGCONT is only blocked if the
+	Emacs frame is opened on the current terminal.
+
 2014-01-22  Eli Zaretskii  <eliz@gnu.org>
 
 	* update-game-score.c (write_scores) [WINDOWSNT]: Use chmod
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 6593b91..fd85a50 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1111,7 +1111,7 @@ handle_sigcont (int signalnum)
       /* We are in the foreground. */
       send_to_emacs (emacs_socket, "-resume \n");
     }
-  else
+  else if (tty)
     {
       /* We are in the background; cancel the continue. */
       raise (SIGSTOP);
-- 
1.8.5.4






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

* Re: [PATCH] Fix emacsclient's handling of SIGCONT.
  2014-02-20  0:05 [PATCH] Fix emacsclient's handling of SIGCONT Andreas Amann
@ 2014-02-25 18:47 ` Glenn Morris
  2014-02-25 19:07   ` bug#16883: " Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2014-02-25 18:47 UTC (permalink / raw
  To: Andreas Amann; +Cc: emacs-devel


Filed as http://debbugs.gnu.org/16883 .



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

* bug#16883: [PATCH] Fix emacsclient's handling of SIGCONT.
  2014-02-25 18:47 ` Glenn Morris
@ 2014-02-25 19:07   ` Paul Eggert
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2014-02-25 19:07 UTC (permalink / raw
  To: a.amann, 16883-done

Thanks for the bug report.  I applied that change as part of Emacs trunk 
bzr 116558.





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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20  0:05 [PATCH] Fix emacsclient's handling of SIGCONT Andreas Amann
2014-02-25 18:47 ` Glenn Morris
2014-02-25 19:07   ` bug#16883: " Paul Eggert

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.