From: Decebal <cldwesterhof@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: How to
Date: Sat, 10 Oct 2009 11:33:17 -0700 (PDT) [thread overview]
Message-ID: <afa23e97-b571-4fa5-8f53-3c211ed308bb@k19g2000yqc.googlegroups.com> (raw)
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...
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.
next reply other threads:[~2009-10-10 18:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-10 18:33 Decebal [this message]
2009-10-10 20:06 ` How to Andreas Röhler
2009-10-10 20:55 ` How to [write sequentially numbered lines] Vassil Nikolov
2009-10-10 21:20 ` Decebal
[not found] ` <mailman.8511.1255205222.2239.help-gnu-emacs@gnu.org>
2009-10-10 20:57 ` How to Decebal
2009-10-11 1:41 ` Decebal
2009-10-11 8:11 ` Andreas Röhler
[not found] ` <mailman.8527.1255248737.2239.help-gnu-emacs@gnu.org>
2009-10-11 16:20 ` Decebal
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=afa23e97-b571-4fa5-8f53-3c211ed308bb@k19g2000yqc.googlegroups.com \
--to=cldwesterhof@gmail.com \
--cc=help-gnu-emacs@gnu.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.