Nicolas Goaziou writes: [...] > Then it's `forward-line', not `forward-char', because there could be > trailing spaces at the end of the paragraph, e.g. > > This is a paragraph. Okay, changed to `forward-line'. > Also, my question still holds, what about the last paragraph in a buffer > not ending with a newline character, e.g. > > This is the last paragraph. > > You need to insert a newline character in this case. I'm still not quite seeing this. This chunk should take care of it: (goto-char e) (if (bolp) (progn (skip-chars-backward " \n\t") (forward-line)) (end-of-line) (insert "\n")) If "e" is EOB, we do `end-of-line' and insert a newline, it should be taken care of. I added a new clause in the test for this case, and it seems to work fine... Am I missing anything? Eric