all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem with splash screen and emacsclient
@ 2006-11-19 21:39 Lennart Borgman
  2006-11-19 21:50 ` Lennart Borgman
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2006-11-19 21:39 UTC (permalink / raw)


I have asked the question below at least once before on the list (but 
then I mentioned gnuclient):

If Emacs is showing the splash screen and you open a file with 
emacsclient then Emacs shows that it is in some kind of recursive edit 
mode. The mode line may look like this


   --\-- emacsclient.c   Top L1 CVS:1.91 [(C/l)] ----------------

Some commands does not work until the splash screens times out. The [] 
disappears then from the mode line. (You can use M-x top-level to get 
out of this state before time out.)

It seems like emacs server should remove the splash screen just as 
normal input events does. But how should that be done? The function 
showing the splash screen is doing a (sit-for 120).

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

* Re: Problem with splash screen and emacsclient
  2006-11-19 21:39 Problem with splash screen and emacsclient Lennart Borgman
@ 2006-11-19 21:50 ` Lennart Borgman
  2006-11-20  1:33   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2006-11-19 21:50 UTC (permalink / raw)


Lennart Borgman wrote:
> I have asked the question below at least once before on the list (but 
> then I mentioned gnuclient):
> 
> If Emacs is showing the splash screen and you open a file with 
> emacsclient then Emacs shows that it is in some kind of recursive edit 
> mode. The mode line may look like this
> 
> 
>   --\-- emacsclient.c   Top L1 CVS:1.91 [(C/l)] ----------------
> 
> Some commands does not work until the splash screens times out. The [] 
> disappears then from the mode line. (You can use M-x top-level to get 
> out of this state before time out.)
> 
> It seems like emacs server should remove the splash screen just as 
> normal input events does. But how should that be done? The function 
> showing the splash screen is doing a (sit-for 120).


Sorry, I sent this message too early (I thought it was stuck - some 
problems with the mail server here).

I do not know yet for sure what the splash screen is waiting for. But 
the behaviour seems similar to sit-for.

I think the server should remove the splash screen and I wonder how to 
do it. Any suggestions?

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

* Re: Problem with splash screen and emacsclient
  2006-11-19 21:50 ` Lennart Borgman
@ 2006-11-20  1:33   ` Stefan Monnier
  2006-11-20 15:57     ` Lennart Borgman
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2006-11-20  1:33 UTC (permalink / raw)
  Cc: Emacs Devel

>> If Emacs is showing the splash screen and you open a file with emacsclient
>> then Emacs shows that it is in some kind of recursive edit mode. The mode
>> line may look like this
>> 
>> 
>> --\-- emacsclient.c   Top L1 CVS:1.91 [(C/l)] ----------------
>> 
>> Some commands does not work until the splash screens times out. The []
>> disappears then from the mode line. (You can use M-x top-level to get out
>> of this state before time out.)
>> 
>> It seems like emacs server should remove the splash screen just as normal
>> input events does. But how should that be done? The function showing the
>> splash screen is doing a (sit-for 120).

Similar problem happen if you use emacsclient when Emacs is in
the minibuffer.  It's even worse when used on multiple displays since you
may be stuck with an active minibuffer in one display to which you currently
don't have access.

I use the patch below for that purpose.  I believe it should address your
problem as well.


        Stefan


--- orig/lisp/server.el
+++ mod/lisp/server.el
@@ -382,6 +397,13 @@
   ;; nothing if there is one (for multiple Emacs sessions)?
   (server-start (not server-mode)))
 \f
+(defun server-add-hook-once (hook function &optional append local)
+  "Same as `add-hook', but FUN is only run once.
+Also contrary to `add-hook', this is not idempotent."
+  (let ((code (list 'lambda)))
+    (setcdr code `(() (,function) (remove-hook ',hook ',code ',local)))
+    (add-hook hook code append local)))
+
 (defun* server-process-filter (proc string)
   "Process a request from the server to edit some files.
 PROC is the server process.  Format of STRING is \"PATH PATH PATH... \\n\"."
@@ -403,6 +425,15 @@
     (when prev
       (setq string (concat prev string))
       (process-put proc :previous-string nil)))
+  (when (> (recursion-depth) 0)
+    ;; We're inside a minibuffer already, so if the emacs-client is trying
+    ;; to open a frame on a new display, we might end up with an unusable
+    ;; frame because input from that display will be blocked (until exiting
+    ;; the minibuffer).  Better exit this minibuffer right away.
+    (process-put proc :previous-string string)
+    (server-add-hook-once 'post-command-hook
+			  `(lambda () (server-process-filter ',proc "")))
+    (top-level))
   ;; If the input is multiple lines,
   ;; process each line individually.
   (while (string-match "\n" string)

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

* Re: Problem with splash screen and emacsclient
  2006-11-20  1:33   ` Stefan Monnier
@ 2006-11-20 15:57     ` Lennart Borgman
  2006-11-20 20:14       ` Juanma Barranquero
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2006-11-20 15:57 UTC (permalink / raw)
  Cc: Emacs Devel

Stefan Monnier wrote:
>>> If Emacs is showing the splash screen and you open a file with emacsclient
>>> then Emacs shows that it is in some kind of recursive edit mode. The mode
>>> line may look like this
>>>
>>>
>>> --\-- emacsclient.c   Top L1 CVS:1.91 [(C/l)] ----------------
>>>
>>> Some commands does not work until the splash screens times out. The []
>>> disappears then from the mode line. (You can use M-x top-level to get out
>>> of this state before time out.)
>>>
>>> It seems like emacs server should remove the splash screen just as normal
>>> input events does. But how should that be done? The function showing the
>>> splash screen is doing a (sit-for 120).
> 
> Similar problem happen if you use emacsclient when Emacs is in
> the minibuffer.  It's even worse when used on multiple displays since you
> may be stuck with an active minibuffer in one display to which you currently
> don't have access.
> 
> I use the patch below for that purpose.  I believe it should address your
> problem as well.
> 
> 
>         Stefan


Yes, it does. I think it should be checked in.

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

* Re: Problem with splash screen and emacsclient
  2006-11-20 15:57     ` Lennart Borgman
@ 2006-11-20 20:14       ` Juanma Barranquero
  0 siblings, 0 replies; 5+ messages in thread
From: Juanma Barranquero @ 2006-11-20 20:14 UTC (permalink / raw)
  Cc: Stefan Monnier, Emacs Devel

On 11/20/06, Lennart Borgman <lennart.borgman.073@student.lu.se> wrote:

> Yes, it does. I think it should be checked in.

I agree.

                    /L/e/k/t/u

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

end of thread, other threads:[~2006-11-20 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-19 21:39 Problem with splash screen and emacsclient Lennart Borgman
2006-11-19 21:50 ` Lennart Borgman
2006-11-20  1:33   ` Stefan Monnier
2006-11-20 15:57     ` Lennart Borgman
2006-11-20 20:14       ` Juanma Barranquero

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.