Commit 3db1e3b5 authored by Boris Goldowsky's avatar Boris Goldowsky
Browse files

(open-line): indent when inserting fil-prefix.

(do-auto-fill): Use unjustify-current-line when necessary.
(indent-new-comment-line): Indent before fill-prefix.
parent 34c3f2b8
......@@ -27,13 +27,15 @@
(defun open-line (arg)
"Insert a newline and leave point before it.
If there is a fill prefix, insert the fill prefix on the new line
If there is a fill prefix and/or a left-margin, insert them on the new line
if the line would have been empty.
With arg N, insert N newlines."
(interactive "*p")
(let* ((do-fill-prefix (and fill-prefix (bolp)))
(do-left-margin (and (bolp) (> (current-left-margin) 0)))
(loc (point)))
(while (> arg 0)
(if do-left-margin (indent-to (current-left-margin)))
(if do-fill-prefix (insert-and-inherit fill-prefix))
(newline 1)
(setq arg (1- arg)))
......@@ -2185,13 +2187,8 @@ Setting this variable automatically makes it local to the current buffer.")
(and auto-fill-inhibit-regexp
(looking-at auto-fill-inhibit-regexp))))
nil ;; Auto-filling not required
;; Remove justification-introduced whitespace before filling
(cond ((eq 'left justify) nil)
((eq 'full justify) ; full justify: remove extra spaces
(point) (save-excursion (end-of-line) (point))))
;; right or center justify: remove extra indentation.
(t (save-excursion (indent-according-to-mode))))
(if (memq justify '(full center right))
(save-excursion (unjustify-current-line)))
(while (and (not give-up) (> (current-column) fc))
;; Determine where to split the line.
(let ((fill-point
......@@ -2359,9 +2356,10 @@ unless optional argument SOFT is non-nil."
;; Make sure we delete the newline inserted above.
(delete-char 1)))
(if fill-prefix
(insert-and-inherit fill-prefix)
(if (null fill-prefix)
(insert-and-inherit fill-prefix)))))
(defun set-selective-display (arg)
"Set `selective-display' to ARG; clear it if no arg.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment