help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to defun body in procedural manner


From: Kevin Rodgers
Subject: Re: How to defun body in procedural manner
Date: Mon, 20 Apr 2009 18:57:36 -0600
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

thierry.volpiatto@gmail.com wrote:
`shell-command' is a synchronous process, so you have just to wait it
finish.May be just add a message to tell you that the compile process is
started:

(defun update-cvs-dir-and-compile ()
  "Cvs update current dir and compile it."
  (interactive)
  (let ((dir default-directory))
    (cvs-update dir nil)
    (while (not (equal cvs-mode-line-process "exit"))
      (sit-for 1))
    (message "Wait compiling %s..." dir)
    (shell-command "make")))

But if you want to run the compile process asynchronous,
you have to use `start-process' instead of `shell-command' and set a
sentinel on this process like this:

(progn
  (start-process "my-compil" nil "sleep"
               "12")
  (set-process-sentinel (get-process "my-compil")
                        #'(lambda (process event)
                            (message "Process:%s State:%s" process event))))

Replace "sleep" with "make" and "12" with make args ;-)

NOTE:If you have more than one arg to the make command, it's may be
convenient to use apply on start-process.

If you want be able to run more than 1 process (after all, it is
asynchronous):

(let ((this-process (start-process "my-compil" nil "sleep"
                                   "12")))
  (set-process-sentinel this-process
                        #'(lambda (process event)
(message "Process:%s State:%s" process event))))

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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