changeset 16018:9a12ac7707c9

(set-hard-newline-properties): New fn. (newline): Use it.
author Richard M. Stallman <rms@gnu.org>
date Sun, 01 Sep 1996 03:24:22 +0000
parents 96edeb283515
children 99cc9a8dd157
files lisp/simple.el
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Sep 01 02:43:58 1996 +0000
+++ b/lisp/simple.el	Sun Sep 01 03:24:22 1996 +0000
@@ -68,13 +68,8 @@
     (if flag (backward-char 1))
     ;; Mark the newline(s) `hard'.
     (if use-hard-newlines
-	(let* ((from (- (point) (if arg (prefix-numeric-value arg) 1)))
-	       (sticky (get-text-property from 'rear-nonsticky)))
-	  (put-text-property from (point) 'hard 't)
-	  ;; If rear-nonsticky is not "t", add 'hard to rear-nonsticky list
-	  (if (and (listp sticky) (not (memq 'hard sticky)))
-	      (put-text-property from (point) 'rear-nonsticky
-				 (cons 'hard sticky)))))
+	(set-hard-newline-properties 
+	 (- (point) (if arg (prefix-numeric-value arg) 1)) (point)))
     ;; If the newline leaves the previous line blank,
     ;; and we have a left margin, delete that from the blank line.
     (or flag
@@ -92,6 +87,14 @@
 	(move-to-left-margin nil t)))
   nil)
 
+(defun set-hard-newline-properties (from to)
+  (let ((sticky (get-text-property from 'rear-nonsticky)))
+    (put-text-property from to 'hard 't)
+    ;; If rear-nonsticky is not "t", add 'hard to rear-nonsticky list
+    (if (and (listp sticky) (not (memq 'hard sticky)))
+	(put-text-property from (point) 'rear-nonsticky
+			   (cons 'hard sticky)))))
+
 (defun open-line (arg)
   "Insert a newline and leave point before it.
 If there is a fill prefix and/or a left-margin, insert them on the new line