[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: |
Sun, 11 Oct 2009 03:14:27 -0700 (PDT) |
User-agent: |
G2/1.0 |
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/
☄