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

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

Re: Disable undo in batch mode


From: Xah Lee
Subject: Re: Disable undo in batch mode
Date: Tue, 13 Oct 2009 10:05:29 -0700 (PDT)
User-agent: G2/1.0

On Oct 11, 7:22 am, Decebal <cldwester...@gmail.com> wrote:
> On Oct 11, 12:14 pm,XahLee <xah...@gmail.com> wrote:
>
> > (defun my-process-file (fpath)
> >   "Process the file at path FPATH ..."
> >   (let ()
> >     ;; create temp buffer without undo record.
> >     ;; first space in temp buff name is necessary
> >     (set-buffer (get-buffer-create " myTemp"))
> >     (insert-file-contents fpath nil nil nil t)
>
> I am afraid that this does not work. When using:
>         (switch-to-buffer (find-file-noselect input-file t t))
>         (buffer-disable-undo)
> my script takes 24 seconds.
> When I change those two lines to:
>         (set-buffer (get-buffer-create " myTemp"))
>         (insert-file-contents input-file nil nil nil t)
> it takes 592 seconds. About 25 times as long.

am annoyed by your feedback.

you asked for some tips about batch text processing. I gave you quite
a few, including a explicit answer to you question of how to disable
undo, and a explicit method to locate that answer, as well as a full
tutorial on batch text processing.

you shot back by saying a specific code i suggested, that it “does not
work”, in comparsion to a code you have used but have not disclosed
before, nor what exactly what your code is doing, and no mention of
thanks nor whether my other tips was or was not helpful.

What is the purpose of your message?

technically, the entire content of your message is about my code “does
not work”, with a specific timing result in seconds. Huh? Is this
supposed to be a helpful info for me? If so, perhaps you would be more
specific. For example, do some research, and do a conclusive report
on:

why this code:

>         (switch-to-buffer (find-file-noselect input-file t t))
>         (buffer-disable-undo)

is “25 times” faster than

>         (set-buffer (get-buffer-create " myTemp"))
>         (insert-file-contents input-file nil nil nil t)

For example, in what condition? why it is so? what tips you might
give, as a choice between these two? and further, i suggested with-
temp-buffer, with-temp-file, have you explored them?

  Xah
∑ http://xahlee.org/

reply via email to

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