views:

242

answers:

2

I have the following dead simple elisp functions; the first removes the fill breaks from the current paragraph, and the second loops through the current document applying the first to each paragraph in turn, in effect removing all single line-breaks from the document. It runs fast on my low-spec Puppy Linux box using emacs 22.3 (10 seconds for 600 pages of Thomas Aquinas), but when I go to a powerful Windows XP machine with emacs 21.3, it takes almost an hour to do the same document. What can I do to make it run as well on the Windows machine with emacs 21.3?

(defun remove-line-breaks () 
  "Remove line endings in a paragraph."
  (interactive) 
  (let ((fill-column 90002000)) 
    (fill-paragraph nil)))

:

(defun remove-all-line-breaks ()
  "Remove all single line-breaks in a document"
  (interactive)
  (while (not (= (point) (buffer-end 1)))
       (remove-line-breaks)
       (next-line 1)))

Forgive my poor elisp; I'm having great fun learning Lisp and starting to use the power of emacs, but I'm new to it yet.

+3  A: 

As the first try, you should download and install Emacs 22.3 for your Windows box and then compare the speed.

Speed difference shouldn't be that big after upgrade.

Dev er dev
Large download, slow connection - I'm working on it, though.
JasonFruit
Three seconds. Nice.
JasonFruit
A: 

Perhaps it is the big value you assign to fill-column (they suggest less than 80).

leppie
The point of the large value is to be larger than any rational paragraph size, so there will be under any reasonable circumstances no fill.
JasonFruit
I see, I would go with what the other answer said.
leppie