i haven't traced down what exactly is causing the slow down. I thought
turning off font-lock must be it, but apparently not. Any got any idea
what exactly might it be?
btw, this is all html files, default to html-mode. And also running it
while emacs is open (e.g. load the byte compiled script in emacs; as
opposed to running it with emacs --script in terminal.)
when using find-file, after the script finished in 10 min, emacs froze
for another 8 minutes. Is this really garbage collection or is emacs
running some queue'd cleanup due to find-file?
if anyone wants to test, here's the 2 versions i used that produced
the reported timings:
;; find-file version
;; with backup turned off, font-lock-mode off, recentf off. (and no
;; tabbar mode and or anything i can think of but might have missed)
(defun my-process-file (fpath destBuff)
"process the file at fullpath fpath.
Write result to buffer destBuff."
(let (fBuf)
(when (not (string-match "/xx" fpath)) ; skip dir/file starting
with xx
(setq fBuf (find-file fpath)) ; open file
(goto-char 1)
(when (not (search-forward "<meta http-equiv=\"refresh\"" nil
"noerror"))
(with-current-buffer destBuff ; insert url to sitemap buffer
(insert "<url><loc>")
(insert (concat "
http://xahlee.org/" (substring fpath
(length webroot))))
(insert "</loc></url>\n")
))
(kill-buffer fBuf) ; close file
)))
;; with-temp-buffer version
(defun my-process-file (fPath destBuff)
"Process the file at fullpath FPATH.
Write result to buffer DESTBUFF."
(when (not (string-match "/xx" fPath)) ; dir/file starting with xx
are not public
(with-temp-buffer
(insert-file-contents fPath nil nil nil t)
(goto-char 1)
(when (not (search-forward "<meta http-equiv=\"refresh\"" nil
"noerror"))
(with-current-buffer destBuff
(insert "<url><loc>")
(insert (concat "http://" domainName "/" (substring fPath
(length webroot))))
(insert "</loc></url>\n") )) ) ) )
the code basically just open a file, see if it contains a meta refresh
string, if not, write the file name into another buffer.
GNU Emacs 23.2.1 (i386-mingw-nt6.1.7601) of 2010-05-08 on G41R2F1
Xah