emacs-devel
[Top][All Lists]
Advanced

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

Re: minibuffer-exit when emacsclient executes Lisp code


From: Lennart Borgman (gmail)
Subject: Re: minibuffer-exit when emacsclient executes Lisp code
Date: Wed, 16 May 2007 13:28:20 +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

Klaus Zeitler wrote:
"Lennart" == Lennart Borgman (gmail) <address@hidden> 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




reply via email to

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