From: Stephen Berman Date: Mon, 21 Sep 2020 14:35:31 +0000 (+0200) Subject: Fix check in `newline' for blank lines X-Git-Tag: emacs-28.0.90~5960 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7a2ac61b5d3adbfa7c54434056b9b772f83078af;p=emacs.git Fix check in `newline' for blank lines * lisp/simple.el (newline): Clarify doc string and fix check for blank lines (bug#13810). --- 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))))