aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-01 03:24:22 +0000
committerRichard M. Stallman1996-09-01 03:24:22 +0000
commit55741b46813a1dd2199313e45db8e99acbd08a42 (patch)
treee01429b35d453ba077eb5eae4e48d3a2d1c5324f
parentb1878f450868365f27af0c71900237056a44f900 (diff)
downloademacs-55741b46813a1dd2199313e45db8e99acbd08a42.tar.gz
emacs-55741b46813a1dd2199313e45db8e99acbd08a42.zip
(set-hard-newline-properties): New fn.
(newline): Use it.
-rw-r--r--lisp/simple.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index f44ed221449..6a838e691e1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -68,13 +68,8 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long."
68 (if flag (backward-char 1)) 68 (if flag (backward-char 1))
69 ;; Mark the newline(s) `hard'. 69 ;; Mark the newline(s) `hard'.
70 (if use-hard-newlines 70 (if use-hard-newlines
71 (let* ((from (- (point) (if arg (prefix-numeric-value arg) 1))) 71 (set-hard-newline-properties
72 (sticky (get-text-property from 'rear-nonsticky))) 72 (- (point) (if arg (prefix-numeric-value arg) 1)) (point)))
73 (put-text-property from (point) 'hard 't)
74 ;; If rear-nonsticky is not "t", add 'hard to rear-nonsticky list
75 (if (and (listp sticky) (not (memq 'hard sticky)))
76 (put-text-property from (point) 'rear-nonsticky
77 (cons 'hard sticky)))))
78 ;; If the newline leaves the previous line blank, 73 ;; If the newline leaves the previous line blank,
79 ;; and we have a left margin, delete that from the blank line. 74 ;; and we have a left margin, delete that from the blank line.
80 (or flag 75 (or flag
@@ -92,6 +87,14 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long."
92 (move-to-left-margin nil t))) 87 (move-to-left-margin nil t)))
93 nil) 88 nil)
94 89
90(defun set-hard-newline-properties (from to)
91 (let ((sticky (get-text-property from 'rear-nonsticky)))
92 (put-text-property from to 'hard 't)
93 ;; If rear-nonsticky is not "t", add 'hard to rear-nonsticky list
94 (if (and (listp sticky) (not (memq 'hard sticky)))
95 (put-text-property from (point) 'rear-nonsticky
96 (cons 'hard sticky)))))
97
95(defun open-line (arg) 98(defun open-line (arg)
96 "Insert a newline and leave point before it. 99 "Insert a newline and leave point before it.
97If there is a fill prefix and/or a left-margin, insert them on the new line 100If there is a fill prefix and/or a left-margin, insert them on the new line