What is the elisp idiom for do until end of buffer?
Posted: Fri Aug 10, 2012 7:30 am
I have this function which fails with newline processing
(defun fmt-tbl ()
"format Word tables for wiki"
(interactive)
(goto-char (point-min))
(insert "{||-")
(while (search-forward "\t")
(delete-backward-char 1)
(insert "|")
)
(goto-char (point-min))
(while (search-forward "\n")
(insert "|-")
)
(goto-char (point-max))
(insert "|}")
)
I also tried this:
(while (end-of-line)
(insert "|-")
)
But that didn't work either.
It would be ok to repeatedly move to end of next line checking for end of buffer. How could I do that?
(defun fmt-tbl ()
"format Word tables for wiki"
(interactive)
(goto-char (point-min))
(insert "{||-")
(while (search-forward "\t")
(delete-backward-char 1)
(insert "|")
)
(goto-char (point-min))
(while (search-forward "\n")
(insert "|-")
)
(goto-char (point-max))
(insert "|}")
)
I also tried this:
(while (end-of-line)
(insert "|-")
)
But that didn't work either.
It would be ok to repeatedly move to end of next line checking for end of buffer. How could I do that?