From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Yu,Gang" Newsgroups: gmane.emacs.help Subject: Re: process communication help Date: Tue, 29 May 2007 17:08:27 +0800 Message-ID: <48378d570705290208m5b13d036v3121d8e3679777e3@mail.gmail.com> References: <878xb8kqje.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0562127997==" X-Trace: sea.gmane.org 1180429755 28714 80.91.229.12 (29 May 2007 09:09:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 May 2007 09:09:15 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Thien-Thi Nguyen" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 29 11:09:13 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HsxhZ-0008Cb-0V for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 11:09:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HsxhX-0006ls-W4 for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 05:09:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hsxgw-0006b3-Pg for help-gnu-emacs@gnu.org; Tue, 29 May 2007 05:08:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hsxgu-0006V7-5e for help-gnu-emacs@gnu.org; Tue, 29 May 2007 05:08:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hsxgt-0006US-S4 for help-gnu-emacs@gnu.org; Tue, 29 May 2007 05:08:31 -0400 Original-Received: from nz-out-0506.google.com ([64.233.162.238]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hsxgt-0008DW-BD for help-gnu-emacs@gnu.org; Tue, 29 May 2007 05:08:31 -0400 Original-Received: by nz-out-0506.google.com with SMTP id z3so1399157nzf for ; Tue, 29 May 2007 02:08:28 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=HJPtPLhhMV3E36QPC8Twn2juZ8Y1204q/dgSRr2IHntk2+Iwbkso1J8szegZEsHnzmNITDraTLMha4CZYVZ0T2QVXhKGP37/Mu0/2MysxDaByCaKfjwRhguciQfhjgQtMJPStZZ6SREJpdAs64B2ahR+Kpr9FyT5OZzCVgX2hFk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=oryF6yuyOpwW+lkxfcri59WcUAnIUNAFNQjL09FMx6lFLhgJmGCZhOAhsheOtafFzAVpzTeHkuz9qghluCAxzxeS35VkHmo1fdV8kymZy7CpQDlmS7PbjUki1VENnmSPbHJVtGnlCArq7eW8bMe3rbXhRsPNW7pTAKJW6ec8bVw= Original-Received: by 10.115.89.1 with SMTP id r1mr3342959wal.1180429707962; Tue, 29 May 2007 02:08:27 -0700 (PDT) Original-Received: by 10.114.60.1 with HTTP; Tue, 29 May 2007 02:08:27 -0700 (PDT) In-Reply-To: <878xb8kqje.fsf@ambire.localdomain> X-detected-kernel: Linux 2.4-2.6 (Google crawlbot) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44520 Archived-At: --===============0562127997== Content-Type: multipart/alternative; boundary="----=_Part_3900_20939331.1180429707913" ------=_Part_3900_20939331.1180429707913 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks! Yes, I add the statement , but result the same. So, I believe it's not the problem of (buffer-string) ------------------------------- (defun startup (check-command wanted start-command) "check whether the 'wanted' state satisfied, if not, launch the start-command" (interactive) (save-excursion (let* ((d-buf (get-buffer-create "diagnose")) (process-connection-type nil) (process-status (eval `(call-process (car check-command) nil d-buf t ,@(cdr check-command))))) (switch-to-buffer d-buf) (print `(,(buffer-modified-p) ,(buffer-size) ,(point-min) ,(point) ,(point-max)) d-buf) ;;(debug) (if (not (string-match wanted (buffer-string))) (progn (print (concat "starting command " (stringlist-to-string start-command " ")) d-buf) (eval `(start-process "start up" d-buf (car start-command) ,@(cdr start-command))) ) (print (concat wanted " matched! no need to start " (stringlist-to-string start-command " ")) d-buf) )))) and aux function (defun stringlist-to-string (list connector) "translate string list to string , cons using connector" (let ((result "")) (mapcar (lambda (string) (setq result (concat result string connector)) ) list) (substring result 0 -1))) On 5/29/07, Thien-Thi Nguyen wrote: > > () "Yu,Gang" > () Tue, 29 May 2007 14:12:46 +0800 > > How can I solve the problem? thanks > > determine the current buffer at the moment `(buffer-string)' is > evaluated. if it is not as you expect, learn how to make it so. > > thi > _______________________________________________ > help-gnu-emacs mailing list > help-gnu-emacs@gnu.org > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs > -- YuGang ------=_Part_3900_20939331.1180429707913 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks!

Yes, I add the statement , but result the same. So, I believe it's not the problem of (buffer-string)

-------------------------------
(defun startup (check-command wanted start-command)
  "check whether the 'wanted' state satisfied, if not, launch the start-command"
  (interactive)
  (save-excursion
    (let* ((d-buf (get-buffer-create "diagnose"))
       (process-connection-type nil)
       (process-status (eval `(call-process (car check-command) nil d-buf t ,@(cdr check-command)))))
      (switch-to-buffer d-buf)
      (print `(,(buffer-modified-p) ,(buffer-size) ,(point-min) ,(point) ,(point-max)) d-buf)
      ;;(debug)
      (if (not (string-match wanted (buffer-string)))
      (progn
        (print (concat "starting command " (stringlist-to-string start-command " ")) d-buf)
        (eval `(start-process "start up" d-buf (car start-command) ,@(cdr start-command)))
        )
    (print
     (concat wanted " matched! no need to start " (stringlist-to-string start-command " ")) d-buf)
    ))))
 
and aux function

(defun stringlist-to-string (list connector)
  "translate string list to string , cons using connector"
  (let ((result ""))
    (mapcar (lambda (string)
          (setq result (concat result string connector))
          ) list)
    (substring result 0 -1)))

On 5/29/07, Thien-Thi Nguyen < ttn@gnuvola.org> wrote:
() "Yu,Gang" < wuhanyugang@gmail.com>
() Tue, 29 May 2007 14:12:46 +0800

   How can I solve the problem? thanks

determine the current buffer at the moment `(buffer-string)' is
evaluated.  if it is not as you expect, learn how to make it so.

thi
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs



--
YuGang ------=_Part_3900_20939331.1180429707913-- --===============0562127997== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============0562127997==--