unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Peter Oliver <p.d.oliver@mavit.org.uk>
To: 11033@debbugs.gnu.org
Subject: bug#11033: (no subject)
Date: Tue, 8 Jun 2021 14:43:02 +0100 (BST)	[thread overview]
Message-ID: <76b34d6f-b09b-57b3-7ebe-458d860fffc@froglet.home.mavit.org.uk> (raw)
In-Reply-To: <F35C856C-8718-4B88-922F-68088892BDA8@nau.edu>

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

Attached is a patch which causes emacs to try to create a new GUI frame if there are no existing frames and the current TTY is unusable.

This only works if emacsclient tells us which display to use, and currently it only does that if --display=… is specified.  This is fine for my purposes, but we might want to look at having it pass along $DISPLAY in more situations.

I have submitted copyright assignment paperwork but am currently waiting to hear back.

-- 
Peter Oliver

[-- Attachment #2: Type: text/plain, Size: 1418 bytes --]

From 9b13571d0da02344a6fbb0a875ff0f88b9c65b18 Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Tue, 8 Jun 2021 14:31:00 +0100
Subject: [PATCH] =?UTF-8?q?If=20the=20daemon=E2=80=99s=20TTY=20is=20our=20?=
 =?UTF-8?q?only=20frame,=20create=20a=20new=20frame?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* server.el (server-process-filter): If there won't be a current frame
to use, fall back to trying to create a new one.
---
 lisp/server.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/server.el b/lisp/server.el
index 3205ba182e..ac5db197f3 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1308,7 +1308,17 @@ server-process-filter
 						       frame-parameters))
 		   ;; When resuming on a tty, tty-name is nil.
 		   (tty-name
-		    (server-create-tty-frame tty-name tty-type proc))))
+		    (server-create-tty-frame tty-name tty-type proc))
+
+                   ;; If there won't be a current frame to use, fall
+                   ;; back to trying to create a new one.
+		   ((and use-current-frame
+			 (daemonp)
+			 (null (cdr (frame-list)))
+			 (eq (selected-frame) terminal-frame)
+			 display)
+		    (setq tty-name nil tty-type nil)
+		    (server-select-display display))))
 
             (process-put
              proc 'continuation
-- 
2.31.1


  parent reply	other threads:[~2021-06-08 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 23:18 bug#11033: emacsclient: create a new frame only if one doesn't exist Eddie Hillenbrand
2021-06-08 13:36 ` bug#11033: (no subject) Peter Oliver
2021-06-08 13:43 ` Peter Oliver [this message]
2021-06-09  9:32   ` bug#11033: emacsclient: create a new frame only if one doesn't exist Lars Ingebrigtsen
2021-06-22 10:51     ` Peter Oliver
2021-06-22 13:21       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76b34d6f-b09b-57b3-7ebe-458d860fffc@froglet.home.mavit.org.uk \
    --to=p.d.oliver@mavit.org.uk \
    --cc=11033@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).