aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2002-11-13 23:32:21 +0000
committerKim F. Storm2002-11-13 23:32:21 +0000
commit1b457e183fb99d01d69628d8aab88d4cd305970b (patch)
tree0982f6547ccfc9c5573faf8e3322560c9be8ec20
parent30c91af19b2ea8c97b306c5467c2bbca39524c51 (diff)
downloademacs-1b457e183fb99d01d69628d8aab88d4cd305970b.tar.gz
emacs-1b457e183fb99d01d69628d8aab88d4cd305970b.zip
(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.
-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."
316 :type 'hook 316 :type 'hook
317 :options '(fill-french-nobreak-p fill-single-word-nobreak-p)) 317 :options '(fill-french-nobreak-p fill-single-word-nobreak-p))
318 318
319(defcustom fill-nobreak-invisible nil
320 "Non-nil means that fill command do not break lines in invisible text."
321 :type 'boolean
322 :group 'fill)
323
319(defun fill-nobreak-p () 324(defun fill-nobreak-p ()
320 "Return nil if breaking the line at point is allowed. 325 "Return nil if breaking the line at point is allowed.
321Can be customized with the variable `fill-nobreak-predicate'." 326Can be customized with the variables `fill-nobreak-predicate'
322 (unless (bolp) 327and `fill-nobreak-invisible'."
328 (or
329 (and fill-nobreak-invisible (line-move-invisible (point)))
330 (unless (bolp)
323 (or 331 (or
324 ;; Don't break after a period followed by just one space. 332 ;; Don't break after a period followed by just one space.
325 ;; Move back to the previous place to break. 333 ;; Move back to the previous place to break.
@@ -340,7 +348,7 @@ Can be customized with the variable `fill-nobreak-predicate'."
340 (unless use-hard-newlines 348 (unless use-hard-newlines
341 (save-excursion 349 (save-excursion
342 (skip-chars-forward " \t") (looking-at paragraph-start))) 350 (skip-chars-forward " \t") (looking-at paragraph-start)))
343 (run-hook-with-args-until-success 'fill-nobreak-predicate)))) 351 (run-hook-with-args-until-success 'fill-nobreak-predicate)))))
344 352
345;; Put `fill-find-break-point-function' property to charsets which 353;; Put `fill-find-break-point-function' property to charsets which
346;; require special functions to find line breaking point. 354;; require special functions to find line breaking point.
@@ -525,6 +533,11 @@ The break position will be always after LINEBEG and generally before point."
525 ;; Give newline the properties of the space(s) it replaces 533 ;; Give newline the properties of the space(s) it replaces
526 (set-text-properties (1- (point)) (point) 534 (set-text-properties (1- (point)) (point)
527 (text-properties-at (point))) 535 (text-properties-at (point)))
536 ;; If we don't want breaks in invisible text, don't insert
537 ;; an invisible newline.
538 (if fill-nobreak-invisible
539 (remove-text-properties (1- (point)) (point)
540 '(invisible t)))
528 (if (or fill-prefix 541 (if (or fill-prefix
529 (not fill-indent-according-to-mode)) 542 (not fill-indent-according-to-mode))
530 (indent-to-left-margin) 543 (indent-to-left-margin)