diff options
| -rw-r--r-- | lisp/simple.el | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index d6583c8f963..f93b819e351 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -181,7 +181,6 @@ With arg N, insert N newlines." | |||
| 181 | (goto-char loc) | 181 | (goto-char loc) |
| 182 | (end-of-line))) | 182 | (end-of-line))) |
| 183 | 183 | ||
| 184 | |||
| 185 | (defun split-line (&optional arg) | 184 | (defun split-line (&optional arg) |
| 186 | "Split current line, moving portion beyond point vertically down. | 185 | "Split current line, moving portion beyond point vertically down. |
| 187 | If the current line starts with `fill-prefix', insert it on the new | 186 | If the current line starts with `fill-prefix', insert it on the new |
| @@ -190,17 +189,19 @@ line as well. With prefix arg, don't insert fill-prefix on new line. | |||
| 190 | When called from Lisp code, the arg may be a prefix string to copy." | 189 | When called from Lisp code, the arg may be a prefix string to copy." |
| 191 | (interactive "*P") | 190 | (interactive "*P") |
| 192 | (skip-chars-forward " \t") | 191 | (skip-chars-forward " \t") |
| 193 | (let ((col (current-column)) | 192 | (let* ((col (current-column)) |
| 194 | (pos (point)) | 193 | (pos (point)) |
| 195 | (beg (line-beginning-position)) | 194 | ;; What prefix should we check for (nil means don't). |
| 196 | (prefix (cond ((stringp arg) arg) | 195 | (prefix (cond ((stringp arg) arg) |
| 197 | (arg nil) | 196 | (arg nil) |
| 198 | (t fill-prefix)))) | 197 | (t fill-prefix))) |
| 198 | ;; Does this line start with it? | ||
| 199 | (have-prfx (and prefix | ||
| 200 | (save-excursion | ||
| 201 | (beginning-of-line) | ||
| 202 | (looking-at (regexp-quote prefix)))))) | ||
| 199 | (newline 1) | 203 | (newline 1) |
| 200 | (if (and (stringp prefix) | 204 | (if have-prfx (insert-and-inherit prefix)) |
| 201 | (string-equal prefix | ||
| 202 | (buffer-substring beg (+ beg (length prefix))))) | ||
| 203 | (insert-and-inherit prefix)) | ||
| 204 | (indent-to col 0) | 205 | (indent-to col 0) |
| 205 | (goto-char pos))) | 206 | (goto-char pos))) |
| 206 | 207 | ||