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

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

Re: How to


From: Andreas Röhler
Subject: Re: How to
Date: Sat, 10 Oct 2009 22:06:07 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Decebal wrote:
> In a Bash script I changed:
>       local i
>       local length=${#1}
> 
>       for i in $(seq ${1}) ; do
>         printf "       Regel %${length}d voor de test\n" ${i}
>       done  >${2}
> to:
>       emacs -batch -nw --eval='
>         (let (
>               (i)
>               (nr-of-lines '${1}')
>               (nr-of-lines-length)
>               (output-file "'"${2}"'"))
>           (setq nr-of-lines-length (length (number-to-string nr-of-
> lines)))
>           (dotimes (i nr-of-lines t)
>            (insert (format (format "       Regel %%%dd voor de test\n"
> nr-of-lines-length) (1+ i))))
>           (write-file output-file))
>       ' 2>/dev/null
> 
> The Bash version took 293 seconds and the Emacs Lisp version 59
> seconds. So it is about 5 times as fast.
> The Emacs batch gives output like:
>     Saving file /home/cecil/temp/inputEmacs...

it's in files.el, save-buffer, AFAIS


    (if (and modp (buffer-file-name))
        (message "Saving file %s..." (buffer-file-name)))

commenting out these lines should cancel the message

HTH

Andreas

>     Wrote /home/cecil/temp/inputEmacs
> That is why I use the 2>/dev/null.
> Is there a way to circumvent the generation of the above output?
> Because when there is an error it is also thrown away and that is not
> nice.
> 





reply via email to

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