*** simple.el.old 2015-06-08 19:19:20.484397387 -0400 --- simple.el.new 2015-06-08 19:18:58.340305301 -0400 *************** *** 6559,6575 **** (setq fill-prefix prefix)))) (while (and (not give-up) (> (current-column) fc)) ! ;; Determine where to split the line. ! (let* (after-prefix (fill-point (save-excursion (beginning-of-line) ! (setq after-prefix (point)) ! (and fill-prefix ! (looking-at (regexp-quote fill-prefix)) ! (setq after-prefix (match-end 0))) (move-to-column (1+ fc)) ! (fill-move-to-break-point after-prefix) (point)))) ;; See whether the place we found is any good. --- 6559,6581 ---- (setq fill-prefix prefix)))) (while (and (not give-up) (> (current-column) fc)) ! ;; Determine where to split the line. ! (let* (line-start ! after-prefix (fill-point (save-excursion (beginning-of-line) ! (setq line-start (point)) ! ;; Skip the fill-prefix. Note that we might be on the first line of the ! ;; paragraph, and the fist line can differ in adaptive-fill-mode. ! (when (or (and adaptive-fill-mode ! adaptive-fill-first-line-regexp ! (looking-at adaptive-fill-first-line-regexp)) ! (and fill-prefix ! (looking-at (regex-quote fill-prefix)))) ! (setq after-prefix (match-end 0))) (move-to-column (1+ fc)) ! (fill-move-to-break-point (or after-prefix line-start)) (point)))) ;; See whether the place we found is any good. *************** *** 6578,6586 **** (or (bolp) ;; There is no use breaking at end of line. (save-excursion (skip-chars-forward " ") (eolp)) ! ;; It is futile to split at the end of the prefix ! ;; since we would just insert the prefix again. ! (and after-prefix (<= (point) after-prefix)) ;; Don't split right after a comment starter ;; since we would just make another comment starter. (and comment-start-skip --- 6584,6592 ---- (or (bolp) ;; There is no use breaking at end of line. (save-excursion (skip-chars-forward " ") (eolp)) ! ;; It is futile to split earlier in the line than the length of the ! ;; prefix, since we would just insert the prefix again. ! (and fill-prefix (<= (point) (+ line-start (length fill-prefix)))) ;; Don't split right after a comment starter ;; since we would just make another comment starter. (and comment-start-skip