From: Richard M. Stallman Date: Sun, 1 Sep 1996 03:24:22 +0000 (+0000) Subject: (set-hard-newline-properties): New fn. X-Git-Tag: emacs-20.1~3926 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=55741b46813a1dd2199313e45db8e99acbd08a42;p=emacs.git (set-hard-newline-properties): New fn. (newline): Use it. --- 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." (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 @@ In Auto Fill mode, if no numeric arg, break the preceding line if it's long." (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