[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: line/wrap-prefix patch
From: |
Stefan Monnier |
Subject: |
Re: line/wrap-prefix patch |
Date: |
Sat, 05 Jul 2008 21:05:08 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
> (defun srb-adaptive-indent (beg end)
> "Indent the region between BEG and END with adaptive filling."
> (goto-char beg)
> (let ((lbp (line-beginning-position))
> (lep (line-end-position)))
> (put-text-property lbp lep 'wrap-prefix (fill-context-prefix lbp lep)))
> (while (re-search-forward "\n" (point-max) t)
> (forward-char)
> (let ((lbp (line-beginning-position))
> (lep (line-end-position)))
> (put-text-property lbp lep 'wrap-prefix (fill-context-prefix lbp
> lep)))))
Toi avoid code-duplication:
(defun srb-adaptive-indent (beg end)
"Indent the region between BEG and END with adaptive filling."
(goto-char beg)
(while
(let ((lbp (line-beginning-position))
(lep (line-end-position)))
(put-text-property lbp lep 'wrap-prefix (fill-context-prefix lbp lep))
(search-forward "\n" end t))))
Actually this also fixes a "point-max vs end" confusion, and removes
a `forward-char' which didn't seem necessary.
> (setq word-wrap nil))
Actually, this minor-mode seems independent from word-wrap, so it had
better not touch word-wrap at all. Similarly, I'm not sure that
fringe-indicator-alist should be touched here.
> (set-buffer-modified-p mod)))))
You should use restore-buffer-modified-p instead.
Stefan