문제

i am using emacs 23.2 and reference configurations from purcell https://github.com/purcell/emacs.d i met a problem when i am edit ruby file and rails file, see belowenter image description here

steps:
1. move the cursor to somewhere
2. hit "RET" key to add more new line, then move the cursor to somewhere
3. the red space happened at the last new line.

do you know how to turn this mark off?

도움이 되었습니까?

해결책

What's your problem with this feature? The red space goes away as soon as you start typing doesn't it?

The feature is show-trailing-whitespace, and it's meant to help you see spurious space at EOL. Which is very helpful for team development environment, as checking in such code will annoy your teammates.

What you should do is add a before-save-hook that removes spurious whitespace see:

http://www.emacswiki.org/emacs/DeletingWhitespace#toc3

code:

(add-hook 'before-save-hook 'delete-trailing-whitespace)

If you want to disable show-trailing-whitespace as well:

(add-hook 'ruby-mode-hook (lambda ()
                            (setq show-trailing-whitespace nil)))

다른 팁

You might like to look at the ws-trim.el library, which removes trailing whitespace from lines which you edit, but by default does not remove them from other lines*.

I find this best for version-control (compared to deleting all trailing whitespace upon saving), as you do not introduce changes in other people's work if you edit the same file.

(*) although it is also nicely configurable if you want it to do more than that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top