From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: minibuffer-exit when emacsclient executes Lisp code Date: Wed, 16 May 2007 13:28:20 +0200 Message-ID: <464AEAD4.8010102@gmail.com> References: <464A1C4B.8060504@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1179314921 20182 80.91.229.12 (16 May 2007 11:28:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 May 2007 11:28:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Klaus Zeitler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 16 13:28:38 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HoHgL-0004IB-V9 for ged-emacs-devel@m.gmane.org; Wed, 16 May 2007 13:28:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HoHoJ-0006yZ-Kl for ged-emacs-devel@m.gmane.org; Wed, 16 May 2007 07:36:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HoHoE-0006y9-Qj for emacs-devel@gnu.org; Wed, 16 May 2007 07:36:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HoHoE-0006xn-BL for emacs-devel@gnu.org; Wed, 16 May 2007 07:36:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HoHoE-0006xk-2O for emacs-devel@gnu.org; Wed, 16 May 2007 07:36:46 -0400 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HoHgE-0000Xk-Kq for emacs-devel@gnu.org; Wed, 16 May 2007 07:28:31 -0400 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:64507 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.66) (envelope-from ) id 1HoHgC-0004Y9-4x; Wed, 16 May 2007 13:28:29 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 000740-1, 2007-05-15), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1HoHgC-0004Y9-4x. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1HoHgC-0004Y9-4x f3ceae4da3befc0ebb110a8849a53789 X-detected-kernel: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:71157 Archived-At: Klaus Zeitler wrote: >>>>>> "Lennart" == Lennart Borgman (gmail) writes: > Lennart> > Lennart> Yes, it is probably due to a change a while ago to avoid problems > Lennart> if the minibuffer was active. How are you calling emacsclient? Is > Lennart> it to open files or to eval some elisp code? > > 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 > > Klaus 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. One way to solve this problem would be to try to distinguish the two cases by the use of "-eval". If "-eval" is present in the command (as seen from the server) then your case is perhaps more common. Then something like the patch below could be used. I do believe however that a more explicit way to handle this would be better. Anyway here is a patch you might use for now: *** c:/DOCUME~1/LENNAR~1/LOCALS~1/Temp/ediff972Kmu 2007-05-16 13:22:50.109375000 +0200 --- c:/emacs/p/070515/emacs/lisp/server.el 2007-05-16 13:22:19.750000000 +0200 *************** *** 1,3 **** ;;; server.el --- Lisp code for GNU Emacs running as server process ;; Copyright (C) 1986, 1987, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, --- 1,3 ---- *************** *** 405,411 **** (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 --- 404,424 ---- (when prev (setq string (concat prev string)) (process-put proc :previous-string nil))) ! (when (and (> (recursion-depth) 0) ! (not ! (catch 'eval-found ! (let ((str string) ! arg) ! (save-match-data ! (while (string-match ! (rx line-start ! (0+ (not (any space))) ! (1+ space)) ! str) ! (setq arg (substring str (match-beginning 0) (1- (match-end 0)))) ! (when (string= arg "-eval") ! (throw 'eval-found t)) ! (setq str (substring str (match-end 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