unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: "Károly Lőrentey" <karoly@lorentey.hu>
Cc: emacs-devel@gnu.org
Subject: Re: minibuffer-exit when emacsclient executes Lisp code
Date: Wed, 16 May 2007 15:51:16 +0200	[thread overview]
Message-ID: <86mz04ri5n.fsf@lola.quinscape.zz> (raw)
In-Reply-To: <f2ev68$73c$1@sea.gmane.org> ("Károly Lo"'s message of "Wed\, 16 May 2007 14\:58\:40 +0200")

"Károly Lőrentey" <karoly@lorentey.hu> writes:

> David Kastrup wrote:
>> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>> 
>>> Klaus Zeitler wrote:
>>>> My script calls emacsclient with --eval to evaluate lisp code.
>>>> Here's a simple example:
>>>> 1. in your emacs do M-x to enter the minibuffer
>>>> 2. in a shell type e.g.: emacsclient --eval cvs-emacs
>>>> => emacs quits the minibuffer
>>>>
>>> Unfortunately there is currently no way to distinguish your case
>>> from the more normal case where emacsclient is used to open a
>>> file. In the later case I think the change does what is needed, but
>>> for your (a bit more unusual) usage it breaks it.
>> 
>> --eval '(find-file "xxxx")
>
> Well said.  It is not clear to me if this bug report is for the
> multi-tty branch or the trunk, but with the multi-tty emacsclient, a
> more useful heuristic would be whether or not the client requested
> the creation of a new frame.  (Incidentally, the freeze issue was to
> be resolved by better user feedback and an elaborate C-g-based
> protocol to let the user manually return to top-level from frozen
> frames. I like this simple approach even better.)

It may be too simple (which is the common problem with simple
solutions).  And if one falls in love with the simplicity, one tends
to build complex workarounds around it in order to be able to keep
it...  More at the bottom.

> To reduce conflicts and parallel effort, I think people should look
> at the multi-tty emacsclient, and (if possible) stop enhancing the
> trunk version.  The two versions are considerably different.

To a degree that instead "conflicts" and "parallel effort", "wasted
effort" would probably be more accurate.

The multi-tty emacsclient is actually quite more similar in
functionality to "gnuclient".

>> I think we should probably try to address this in connection with
>> another issue: a suitable way for opening a tty: open a frame only
>> once it is "needed".  One problem we currently have is that it is
>> not really pleasing to specify Emacs frame geometries, colors,
>> toolbar or menubar presence by using .emacs and/or customize: that
>> way, the initial frame will first get mapped wrongly, then flicker
>> into shape/position.  So one would want to have a delayed mapping,
>> basically happening when sit-for is called.  If this point is never
>> reached, we don't need a mapping at all.
>
> The flickering issue may not be strictly relevant for the
> emacsclient case, since the parameters that apply on the new frame
> are (or at least should be) already known at the time the frame is
> created.

Sure, that's why I wrote "in connection with another issue": maybe one
problem can be solved in a way that gives an obvious solution for the
other problem.

> (Multi-tty) Emacs is dumped with a dummy (no-op) terminal, and
> creates the first real terminal only on the second run.  One way to
> reduce flickering would be to delay terminal initialization until
> after .emacs is loaded.  Is this what you mean?  Wouldn't that make
> it harder to debug .emacs errors?

Not really.  There is -debug-init (which could well cause an immediate
mapping to facilitate debugging), there is the *Message* buffer, and
there might also be stderr for messages (if the process is started
from some window manager or similar, stderr might still possible be
available in some internal log or window or console from the window
manager) while we are not yet mapped.

And even if we have the equivalent of (while t) in our .emacs, having
a mapped frame will probably not help significantly.  Probably less
than using stdin/stdout/stderr (basically, the -batch environment)
would before top-level is entered the first time.  Of course, this has
the disadvantage that communication will have to occur keeping in mind
output and keyboard locales.  Maybe Emacs should retain some minimal
knowledge about its controlling tty for that purpose?

>> In a similar vein, if emacsclient never reaches a point where it
>> would be interested in looking at tty input, maybe it is not worth
>> mapping a frame (and stealing the minibuffer).  Of course, the
>> question when to call "top-level" remains.
>
> I think something like (run-at-time 0 nil 'top-level) would work fine.

This is asking for trouble, since quite a lot of not-top-level code
may call sit-for and consequently timers.

-- 
David Kastrup

  parent reply	other threads:[~2007-05-16 13:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15 10:10 minibuffer-exit when emacsclient executes Lisp code Klaus Zeitler
2007-05-15 20:47 ` Lennart Borgman (gmail)
2007-05-16  8:28   ` Klaus Zeitler
2007-05-16 11:28     ` Lennart Borgman (gmail)
2007-05-16 11:43       ` David Kastrup
2007-05-16 11:49         ` Lennart Borgman (gmail)
2007-05-16 12:58         ` Károly Lo"rentey
2007-05-16 13:04           ` Juanma Barranquero
2007-05-16 13:51           ` David Kastrup [this message]
2007-05-16 14:15           ` Klaus Zeitler
2007-05-17 13:48           ` Stefan Monnier
2007-05-16 14:10       ` Klaus Zeitler
2007-05-16 14:47         ` Lennart Borgman (gmail)
2007-05-23  9:59       ` Klaus Zeitler
2007-05-23 10:12         ` Lennart Borgman (gmail)
2007-05-23 15:03           ` Stefan Monnier
2007-05-23 18:56           ` Richard Stallman
2007-05-23 19:42             ` Lennart Borgman (gmail)
2007-05-24 13:13             ` Stefan Monnier
2007-05-25  7:37               ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2007-05-16 14:01 karoly
2007-05-16 14:18 ` Juanma Barranquero
2007-05-16 14:35   ` Károly Lőrentey
2007-05-16 14:55     ` Juanma Barranquero
2007-05-17 13:28       ` Dan Nicolaescu
2007-05-16 14:41 ` David Kastrup
2007-05-16 14:58   ` Juanma Barranquero
2007-05-16 15:52   ` Károly Lo"rentey
2007-05-16 23:36   ` Kenichi Handa

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=86mz04ri5n.fsf@lola.quinscape.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=karoly@lorentey.hu \
    /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).