[Top][All Lists]

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

Re: process communication help

From: Yu,Gang
Subject: Re: process communication help
Date: Wed, 30 May 2007 15:53:57 +0800

Hi, Thien-Thi :


I get a lot of instances shown in *grep* buffer, just like

cd /usr/share/emacs/21.4/lisp/
egrep -nH -e '(start|call)-process' *.el /dev/null
arc-mode.el:989:      (apply 'call-process
arc-mode.el:1011:  (apply 'call-process
arc-mode.el:1122:          (let ((exitcode (apply 'call-process
arc-mode.el:1282:  (apply 'call-process

dired-aux.el:411:(defun dired-call-process (praogram discard &rest arguments)
dired-aux.el:417:                 'dired-call-process)))
dired-aux.el:418:    (if handler (apply handler 'dired-call-process
dired-aux.el:420:      (apply 'call-process program nil (not discard) nil arguments))))
dired-aux.el:438:         (apply (function dired-call-process) program nil arguments)))

I try to rewrite the code like this:
(defun def-in-dir (dir regexp)
  "find regexp in elisp source directory"
  (setq dir (if (not (string-equal (substring dir -1) "/"))
                  (concat dir "/")
  (setq default-directory dir)
  (if (file-exists-p default-directory)
      (progn (setq files (directory-files default-directory nil "\\.el$"))
         (if files
            (setq command
               (concat "egrep -nH -e '" regexp "' "  (stringlist-to-string files " ")))
           (setq command "grep -n -e"))
         (ignore-errors (grep command))

but I cant' collect all the result in the same "*grep*" buffer, everytime only one command result can be written in this buffer, no append way?

I mean things like:

(dolist (dir load-path)
   (def-in-dir dir "(start|call)-process")

On 5/29/07, Thien-Thi Nguyen <address@hidden> wrote:
() "Yu,Gang" <address@hidden >
() Tue, 29 May 2007 19:57:42 +0800

   Where can I get resources on elisp's idiomatic programming style?

one way is to read a lot of elisp.  this is particularly easy to do
since emacs itself is distributed with a lot of elisp.

   How about these macros?? I rewrite the function like this, [...]

these are ugly.  i don't even know if they are correct, i could not
force myself to read them.

why don't you try this:

(0) make sure your emacs is properly installed, in other words, with
    full source code (for each .elc file there should be a corresponding
    .el file in the same directory).

(1) evaluate the forms:
    (require 'cl)
    (dolist (dir load-path) (ignore-errors (dired dir)))

(2) in each" dired buffer, evaluate the form:
    (grep "egrep -nH -e '(call|start)-process' *.el")

by "evaluate the form", i mean type `M-:' and then the form and then
RET.  for step (2) you can recall previous forms into the minibuffer
by typing `M-p'.

further exploration is up to you.  have fun!

help-gnu-emacs mailing list

reply via email to

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