2

My Emacs inserts whitespace on the next line if the current line starts with whitespace. IE

   a<RET>
   <--- whitespace

This happens across modes (python, text-mode, fundamental-mode), and versions (24.5, 26.3). How do I get turn this off? (to be more like nano or pico behavior)? This messing with my terminal's copy-paste

3
  • When you paste into the terminal, your terminal is supposed to tell Emacs that this is a paste which completely avoids this problem. This was supported in Emacs-24, but it should definitely work in Emacs-26, so if you see the problem when pasting into your terminal with Emacs-26, it's presumably a problem with your terminal or a bug in Emacs. Please report it.
    – Stefan
    Feb 27, 2020 at 23:17
  • It seems likely that my terminal (iterm2) treats copy/paste equivalently to typing the text manually (ie, there's an option to "paste slowly"). How is "this is a copy/paste" signaling supposed to work exactly? Feb 28, 2020 at 21:46
  • iterm2 is supposed to have support for "bracketed paste" (as do most terminal emulators nowadays) so if paste misbehaves in Emacs-26, please M-x report-emacs-bug
    – Stefan
    Feb 29, 2020 at 14:30

1 Answer 1

1

In Emacs 25, they changed the default behavior of RET. Previously (prior to Emacs 25) RET just inserted a newline char (taking you to the beginning of the next line), and C-j did what RET does now: inserts a newline char and then indents according to the previous line's code.

You can restore the previous default behavior this way (it's what I do):

(when (fboundp 'electric-indent-mode)
  (electric-indent-mode -1)) ; Use classic `C-j' and `RET'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.