unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Disable undo in batch mode
Date: Sun, 11 Oct 2009 03:14:27 -0700 (PDT)	[thread overview]
Message-ID: <3849881f-9ad2-4e36-b514-4bf7b4b364bc@m3g2000pri.googlegroups.com> (raw)
In-Reply-To: aa21d609-9162-48c9-b9e0-32fced7a19d1@a32g2000yqm.googlegroups.com

On Oct 10, 6:49 pm, Decebal <cldwester...@gmail.com> wrote:
> I am doing a lot of work on a big buffer (65 MB). I understood that
> there is a possibility to disable the undo functionality. Something
> that is not used in batch-mode. So this could give a performance
> boost.
> How can I disable undo?
> Are there other things that could be usefull performance wise?

buffer-disable-undo

you find it by calling “elisp-index-search” with search word “undo”.

for batch processing, you want to disable undo, also turn off syntax
coloring, possibly turn off auto save, auto back up, auto major mode
selection, ...etc.

best do it with temp buffer

e.g.

(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)

    ;; process it ...
    ;; (goto-char 0) ; move to begining of file's content
    ;; ...
    ;; (write-file fpath) ;; write back to the file

    (kill-buffer " myTemp")))

or use with-temp-buffer or with-temp-file.

for more tips on using elisp as a text processing lang like perl,
python, see:

• Text Processing with Emacs Lisp
  http://xahlee.org/emacs/elisp_idioms_batch.html

  Xah
∑ http://xahlee.org/

  parent reply	other threads:[~2009-10-11 10:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-11  1:49 Disable undo in batch mode Decebal
2009-10-11  3:18 ` Vassil Nikolov
2009-10-11 12:51   ` Decebal
2009-10-11 10:14 ` Xah Lee [this message]
2009-10-11 14:22   ` Decebal
2009-10-13 17:05     ` Xah Lee

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=3849881f-9ad2-4e36-b514-4bf7b4b364bc@m3g2000pri.googlegroups.com \
    --to=xahlee@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).