Emacs: fill all text except indicated regions -
using elisp within gnu emacs, i'd able fill text in buffer except text indicated special identifiers. identifers can anything, sake of question, let's assume it's text falls between [nofill] , [/nofill] tags.
for example, assume buffer looks this:
now time men come aid of party. time men come aid of party. [nofill] quick brown fox jumped on lazy sleeping dog [/nofill] when in course of human events, becomes becomes necessary 1 people dissolve political bands [nofill] baa-baa black sheep, have wool [/nofill]
after kind of filling i'm looking for, want buffer appear follows:
now time men come aid of party. time me come aid of party [nofill] quick brown fox jumped on lazy sleeping dog [/nofill] when in course of human events, becomes becomes necessary 1 people dissolve political bands [nofill] baa-baa black sheep, have wool [/nofill]
i know elisp , write this. however, before attempt "reinvent wheel", i'm wondering if knows of existing elisp modules might provide functionality.
thank in advance.
you can justify between [/nofill]
, [nofill]
(or possibly beginning/end of buffer).
(defun fill-special () "fill special" (interactive) (goto-char (point-min)) (while (< (point) (point-max)) (let ((start (point))) (if (search-forward "[nofill]" nil 1) (forward-line -1)) (fill-region start (point) 'left) (if (search-forward "[/nofill]" nil 1) (forward-line 1)))))
Comments
Post a Comment