bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27210: 25.2; Recovering loaddefs.el with desktop-mode hangs when lin


From: npostavs
Subject: bug#27210: 25.2; Recovering loaddefs.el with desktop-mode hangs when linum is on
Date: Sat, 03 Jun 2017 19:07:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

npostavs@users.sourceforge.net writes:

> Because the hidden "F1" frame clearly isn't actually visible (and we
> don't need to show line numbers on it).  But that just triggers
> Bug#26912 "desktop-clear with emacs as daemon results in error on C-x 5
> 0" even without desktop-clear, so it's not an acceptable solution by
> itself at least.

I've expanded on this approach, it seems to work, though it's possible
I'm overlooking some other place that assumes the initial frame is
visible.

>From 129862e0621bf16e20ecc433e427b66626ba9bb8 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 3 Jun 2017 17:59:17 -0400
Subject: [PATCH v1] Make the initial frame invisible when in daemon mode
 (Bug#27210)

* src/emacs.c (main): When starting as a daemon, add `daemonp'
parameter to the initial frame.
* src/frame.c (make_initial_frame): Set the initial frame as
nonvisible when running in daemon mode.
(other_frames): Return true if one of the other frames has a non-nil
`daemonp' frame parameter.
(delete_frame): Don't allow deleting a frame with a `daemonp'
parameter.
---
 src/emacs.c | 3 +++
 src/frame.c | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index 49ebb81767..04bdf9ecdb 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1170,6 +1170,8 @@ main (int argc, char **argv)
 #endif /* MSDOS */
       if (dname_arg)
        daemon_name = xstrdup (dname_arg);
+      Fmodify_frame_parameters (Qnil, Fcons (Fcons (Qdaemonp, Fdaemonp ()),
+                                             Fframe_parameters (Qnil)));
     }
 
 #if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC \
@@ -2486,6 +2488,7 @@ syms_of_emacs (void)
   DEFSYM (Qrisky_local_variable, "risky-local-variable");
   DEFSYM (Qkill_emacs, "kill-emacs");
   DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
+  DEFSYM (Qdaemonp, "daemonp");
 
 #ifndef CANNOT_DUMP
   defsubr (&Sdump_emacs);
diff --git a/src/frame.c b/src/frame.c
index 4d17a071dc..4c670b5c7a 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -903,7 +903,7 @@ make_initial_frame (void)
   tty_frame_count = 1;
   fset_name (f, build_pure_c_string ("F1"));
 
-  SET_FRAME_VISIBLE (f, 1);
+  SET_FRAME_VISIBLE (f, !IS_DAEMON);
 
   f->output_method = terminal->type;
   f->terminal = terminal;
@@ -1605,7 +1605,10 @@ other_frames (struct frame *f, bool invisible, bool 
force)
                      && (force
                          /* Allow deleting the terminal frame when at
                             least one X frame exists.  */
-                         || (FRAME_WINDOW_P (f1) && !FRAME_WINDOW_P (f))))))
+                          || (FRAME_WINDOW_P (f1) && !FRAME_WINDOW_P (f))
+                          /* Allow deleting the last frame if a
+                             "daemon frame" exists.  */
+                          || !NILP (Fframe_parameter (frame1, Qdaemonp))))))
            return true;
        }
     }
@@ -1685,6 +1688,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
       else
        error ("Attempt to delete the only frame");
     }
+  else if (IS_DAEMON && !NILP (Fframe_parameter (frame, Qdaemonp)))
+      error ("Attempt to delete daemon's frame");
 
   XSETFRAME (frame, f);
 
-- 
2.11.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]