all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Yu,Gang" <wuhanyugang@gmail.com>
To: "Thien-Thi Nguyen" <ttn@gnuvola.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: process communication help
Date: Wed, 30 May 2007 15:53:57 +0800	[thread overview]
Message-ID: <48378d570705300053g312524dbx2da09b79657a4806@mail.gmail.com> (raw)
In-Reply-To: <87tztvk6qg.fsf@ambire.localdomain>


[-- Attachment #1.1: Type: text/plain, Size: 2933 bytes --]

Hi, Thien-Thi :

   thanks!!

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"
  (interactive)
  (setq dir (if (not (string-equal (substring dir -1) "/"))
                  (concat dir "/")
                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 <ttn@gnuvola.org> wrote:
>
> () "Yu,Gang" <wuhanyugang@gmail.com>
> () 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!
>
> thi
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>



-- 
YuGang

[-- Attachment #1.2: Type: text/html, Size: 4756 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

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

  reply	other threads:[~2007-05-30  7:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1377.1180419176.32220.help-gnu-emacs@gnu.org>
2007-05-29  8:00 ` process communication help Thien-Thi Nguyen
2007-05-29  9:08   ` Yu,Gang
2007-05-29 10:19     ` Yu,Gang
     [not found]   ` <mailman.1381.1180429716.32220.help-gnu-emacs@gnu.org>
2007-05-29 10:22     ` Thien-Thi Nguyen
2007-05-29 11:57       ` Yu,Gang
     [not found]       ` <mailman.1388.1180439874.32220.help-gnu-emacs@gnu.org>
2007-05-29 15:08         ` Thien-Thi Nguyen
2007-05-30  7:53           ` Yu,Gang [this message]
2007-05-29  6:12 Yu,Gang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48378d570705300053g312524dbx2da09b79657a4806@mail.gmail.com \
    --to=wuhanyugang@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ttn@gnuvola.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.