help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unformat buffer


From: Decebal
Subject: unformat buffer
Date: Mon, 27 Apr 2009 11:01:21 -0700 (PDT)
User-agent: G2/1.0

Sometimes I work in refill-mode, but I need to use the text
unformatted. For this I wrote the following function.

    (defun buffer-unformat(begin end)
      (interactive "r")
      (save-excursion
        (save-restriction
          (narrow-to-region begin end)
          (goto-char (point-min))
          (while (re-search-forward "\\([^\C-j]\\)\C-j\\([^\C-j]\\)"
nil t)
            (replace-match "\\1 \\2"))
          (while (re-search-forward "\C-j\C-j\\(\C-j*\\)" nil t)
            (replace-match "\C-j\\1")))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]