From 7a2ac61b5d3adbfa7c54434056b9b772f83078af Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Mon, 21 Sep 2020 16:35:31 +0200 Subject: [PATCH] Fix check in `newline' for blank lines * lisp/simple.el (newline): Clarify doc string and fix check for blank lines (bug#13810). --- lisp/simple.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 7dc695848bf..d7486e51ddc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -516,7 +516,7 @@ This hook is run by `delete-selection-uses-region-p', which see.") "Propertized string representing a hard newline character.") (defun newline (&optional arg interactive) - "Insert a newline, and move to left margin of the new line if it's blank. + "Insert a newline, and move to left margin of the new line. With prefix argument ARG, insert that many newlines. If `electric-indent-mode' is enabled, this indents the final new line @@ -553,7 +553,7 @@ A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'." (save-excursion (goto-char beforepos) (beginning-of-line) - (and (looking-at "[ \t]$") + (and (looking-at "[ \t]+$") (> (current-left-margin) 0) (delete-region (point) (line-end-position)))) -- 2.39.5