comparison lisp/simple.el @ 10813:bccf0295c66e

(open-line): indent when inserting fil-prefix. (do-auto-fill): Use unjustify-current-line when necessary. (indent-new-comment-line): Indent before fill-prefix.
author Boris Goldowsky <boris@gnu.org>
date Thu, 23 Feb 1995 18:38:42 +0000
parents 7b7874738e7c
children 55552df3bd18
comparison
equal deleted inserted replaced
10812:cd0a341fd620 10813:bccf0295c66e
25 25
26 ;;; Code: 26 ;;; Code:
27 27
28 (defun open-line (arg) 28 (defun open-line (arg)
29 "Insert a newline and leave point before it. 29 "Insert a newline and leave point before it.
30 If there is a fill prefix, insert the fill prefix on the new line 30 If there is a fill prefix and/or a left-margin, insert them on the new line
31 if the line would have been empty. 31 if the line would have been empty.
32 With arg N, insert N newlines." 32 With arg N, insert N newlines."
33 (interactive "*p") 33 (interactive "*p")
34 (let* ((do-fill-prefix (and fill-prefix (bolp))) 34 (let* ((do-fill-prefix (and fill-prefix (bolp)))
35 (do-left-margin (and (bolp) (> (current-left-margin) 0)))
35 (loc (point))) 36 (loc (point)))
36 (while (> arg 0) 37 (while (> arg 0)
38 (if do-left-margin (indent-to (current-left-margin)))
37 (if do-fill-prefix (insert-and-inherit fill-prefix)) 39 (if do-fill-prefix (insert-and-inherit fill-prefix))
38 (newline 1) 40 (newline 1)
39 (setq arg (1- arg))) 41 (setq arg (1- arg)))
40 (goto-char loc)) 42 (goto-char loc))
41 (end-of-line)) 43 (end-of-line))
2183 (save-excursion (beginning-of-line) 2185 (save-excursion (beginning-of-line)
2184 (setq bol (point)) 2186 (setq bol (point))
2185 (and auto-fill-inhibit-regexp 2187 (and auto-fill-inhibit-regexp
2186 (looking-at auto-fill-inhibit-regexp)))) 2188 (looking-at auto-fill-inhibit-regexp))))
2187 nil ;; Auto-filling not required 2189 nil ;; Auto-filling not required
2188 ;; Remove justification-introduced whitespace before filling 2190 (if (memq justify '(full center right))
2189 (cond ((eq 'left justify) nil) 2191 (save-excursion (unjustify-current-line)))
2190 ((eq 'full justify) ; full justify: remove extra spaces
2191 (canonically-space-region
2192 (point) (save-excursion (end-of-line) (point))))
2193 ;; right or center justify: remove extra indentation.
2194 (t (save-excursion (indent-according-to-mode))))
2195 (while (and (not give-up) (> (current-column) fc)) 2192 (while (and (not give-up) (> (current-column) fc))
2196 ;; Determine where to split the line. 2193 ;; Determine where to split the line.
2197 (let ((fill-point 2194 (let ((fill-point
2198 (let ((opoint (point)) 2195 (let ((opoint (point))
2199 bounce 2196 bounce
2357 (indent-for-comment) 2354 (indent-for-comment)
2358 (save-excursion 2355 (save-excursion
2359 ;; Make sure we delete the newline inserted above. 2356 ;; Make sure we delete the newline inserted above.
2360 (end-of-line) 2357 (end-of-line)
2361 (delete-char 1))) 2358 (delete-char 1)))
2362 (if fill-prefix 2359 (if (null fill-prefix)
2363 (insert-and-inherit fill-prefix) 2360 (indent-according-to-mode)
2364 (indent-according-to-mode))))) 2361 (indent-to-left-margin)
2362 (insert-and-inherit fill-prefix)))))
2365 2363
2366 (defun set-selective-display (arg) 2364 (defun set-selective-display (arg)
2367 "Set `selective-display' to ARG; clear it if no arg. 2365 "Set `selective-display' to ARG; clear it if no arg.
2368 When the value of `selective-display' is a number > 0, 2366 When the value of `selective-display' is a number > 0,
2369 lines whose indentation is >= that value are not displayed. 2367 lines whose indentation is >= that value are not displayed.