diff lisp/simple.el @ 21122:912cc3491589

(do-auto-fill): Obey fill-nobreak-predicate.
author Richard M. Stallman <rms@gnu.org>
date Mon, 09 Mar 1998 06:36:42 +0000
parents 926d7b2358dc
children e260c4389363
line wrap: on
line diff
--- a/lisp/simple.el	Mon Mar 09 06:36:25 1998 +0000
+++ b/lisp/simple.el	Mon Mar 09 06:36:42 1998 +0000
@@ -338,17 +338,17 @@
 and KILLP is t if a prefix arg was specified."
   (interactive "*p\nP")
   (when (eq backward-delete-char-untabify-method 'untabify)
-  (let ((count arg))
-    (save-excursion
-      (while (and (> count 0) (not (bobp)))
-	(if (= (preceding-char) ?\t)
-	    (let ((col (current-column)))
-	      (forward-char -1)
-	      (setq col (- col (current-column)))
-	      (insert-char ?\ col)
-	      (delete-char 1)))
-	(forward-char -1)
-        (setq count (1- count))))))
+    (let ((count arg))
+      (save-excursion
+	(while (and (> count 0) (not (bobp)))
+	  (if (= (preceding-char) ?\t)
+	      (let ((col (current-column)))
+		(forward-char -1)
+		(setq col (- col (current-column)))
+		(insert-char ?\ col)
+		(delete-char 1)))
+	  (forward-char -1)
+	  (setq count (1- count))))))
   (delete-backward-char
    (if (eq backward-delete-char-untabify-method 'hungry)
        (let ((wh (- (point) (save-excursion (skip-chars-backward " \t")
@@ -2683,9 +2683,11 @@
 
 Setting this variable automatically makes it local to the current buffer.")
 
-;; This function is the auto-fill-function of a buffer
+;; This function is used as the auto-fill-function of a buffer
 ;; when Auto-Fill mode is enabled.
 ;; It returns t if it really did any work.
+;; (Actually some major modes use a different auto-fill function,
+;; but this one is the default one.)
 (defun do-auto-fill ()
   (let (fc justify bol give-up
 	   (fill-prefix fill-prefix))
@@ -2725,11 +2727,11 @@
 			 (looking-at (regexp-quote fill-prefix))
 			 (setq after-prefix (match-end 0)))
 		    (move-to-column (1+ fc))
-		    ;; Move back to the point where we can break the
-		    ;; line at.  We break the line between word or
+		    ;; Move back to the point where we can break the line.
+		    ;; We break the line between word or
 		    ;; after/before the character which has character
 		    ;; category `|'.  We search space, \c| followed by
-		    ;; a character, or \c| follwoing a character.  If
+		    ;; a character, or \c| following a character.  If
 		    ;; not found, place the point at beginning of line.
 		    (while (or first
 			       ;; If this is after period and a single space,
@@ -2741,7 +2743,11 @@
 				    sentence-end-double-space
 				    (save-excursion (forward-char -1)
 						    (and (looking-at "\\. ")
-							 (not (looking-at "\\.  "))))))
+							 (not (looking-at "\\.  ")))))
+			       (and (not (bobp))
+				    (not bounce)
+				    fill-nobreak-predicate
+				    (funcall fill-nobreak-predicate)))
 		      (setq first nil)
 		      (re-search-backward "[ \t]\\|\\c|.\\|.\\c|\\|^")
 		      ;; If we find nowhere on the line to break it,