mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-25 19:11:56 +00:00
Tweak how auto-fill fills after a period
* lisp/textmodes/fill.el (fill-nobreak-p): Don't break immediately after a space after a period (bug#17321).
This commit is contained in:
parent
0b63b7e60a
commit
85b8609f95
@ -396,12 +396,8 @@ and `fill-nobreak-invisible'."
|
|||||||
(save-excursion
|
(save-excursion
|
||||||
(skip-chars-backward " ")
|
(skip-chars-backward " ")
|
||||||
(and (eq (preceding-char) ?.)
|
(and (eq (preceding-char) ?.)
|
||||||
(looking-at " \\([^ ]\\|$\\)"))))
|
;; There's something more after the space.
|
||||||
;; Another approach to the same problem.
|
(looking-at " [^ \n]"))))
|
||||||
(save-excursion
|
|
||||||
(skip-chars-backward " ")
|
|
||||||
(and (eq (preceding-char) ?.)
|
|
||||||
(not (progn (forward-char -1) (looking-at (sentence-end))))))
|
|
||||||
;; Don't split a line if the rest would look like a new paragraph.
|
;; Don't split a line if the rest would look like a new paragraph.
|
||||||
(unless use-hard-newlines
|
(unless use-hard-newlines
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -76,6 +76,28 @@
|
|||||||
(buffer-string)
|
(buffer-string)
|
||||||
"aaa = baaaaaaaa aaaaaaaaaa\n aaaaaaaaaa\n")))))
|
"aaa = baaaaaaaa aaaaaaaaaa\n aaaaaaaaaa\n")))))
|
||||||
|
|
||||||
|
(ert-deftest test-fill-end-period ()
|
||||||
|
(should
|
||||||
|
(equal
|
||||||
|
(with-temp-buffer
|
||||||
|
(text-mode)
|
||||||
|
(auto-fill-mode)
|
||||||
|
(insert "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius.")
|
||||||
|
(self-insert-command 1 ?\s)
|
||||||
|
(buffer-string))
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius. "))
|
||||||
|
(should
|
||||||
|
(equal
|
||||||
|
(with-temp-buffer
|
||||||
|
(text-mode)
|
||||||
|
(auto-fill-mode)
|
||||||
|
(insert "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eius.Foo")
|
||||||
|
(forward-char -3)
|
||||||
|
(self-insert-command 1 ?\s)
|
||||||
|
(buffer-string))
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|
||||||
|
eius. Foo")))
|
||||||
|
|
||||||
(provide 'fill-tests)
|
(provide 'fill-tests)
|
||||||
|
|
||||||
;;; fill-tests.el ends here
|
;;; fill-tests.el ends here
|
||||||
|
Loading…
Reference in New Issue
Block a user