summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2002-11-13 23:32:21 +0000
committerKim F. Storm <storm@cua.dk>2002-11-13 23:32:21 +0000
commit1b457e183fb99d01d69628d8aab88d4cd305970b (patch)
tree0982f6547ccfc9c5573faf8e3322560c9be8ec20 /lisp/textmodes/fill.el
parent30c91af19b2ea8c97b306c5467c2bbca39524c51 (diff)
downloademacs-1b457e183fb99d01d69628d8aab88d4cd305970b.tar.gz
(fill-nobreak-invisible): New var.
(fill-nobreak-p): Test it; return t if set and point invisible. (fill-newline): Test it; remove invisible prop on newline if set.
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 26785673c74..727e8e1d137 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -316,10 +316,18 @@ be tested. If it returns t, fill commands do not break the line there."
:type 'hook
:options '(fill-french-nobreak-p fill-single-word-nobreak-p))
+(defcustom fill-nobreak-invisible nil
+ "Non-nil means that fill command do not break lines in invisible text."
+ :type 'boolean
+ :group 'fill)
+
(defun fill-nobreak-p ()
"Return nil if breaking the line at point is allowed.
-Can be customized with the variable `fill-nobreak-predicate'."
- (unless (bolp)
+Can be customized with the variables `fill-nobreak-predicate'
+and `fill-nobreak-invisible'."
+ (or
+ (and fill-nobreak-invisible (line-move-invisible (point)))
+ (unless (bolp)
(or
;; Don't break after a period followed by just one space.
;; Move back to the previous place to break.
@@ -340,7 +348,7 @@ Can be customized with the variable `fill-nobreak-predicate'."
(unless use-hard-newlines
(save-excursion
(skip-chars-forward " \t") (looking-at paragraph-start)))
- (run-hook-with-args-until-success 'fill-nobreak-predicate))))
+ (run-hook-with-args-until-success 'fill-nobreak-predicate)))))
;; Put `fill-find-break-point-function' property to charsets which
;; require special functions to find line breaking point.
@@ -525,6 +533,11 @@ The break position will be always after LINEBEG and generally before point."
;; Give newline the properties of the space(s) it replaces
(set-text-properties (1- (point)) (point)
(text-properties-at (point)))
+ ;; If we don't want breaks in invisible text, don't insert
+ ;; an invisible newline.
+ (if fill-nobreak-invisible
+ (remove-text-properties (1- (point)) (point)
+ '(invisible t)))
(if (or fill-prefix
(not fill-indent-according-to-mode))
(indent-to-left-margin)