Questions tagged [whitespace]

for questions about handling white or blank spaces. Besides space characters, Emacs is configured to handle the following as white space characters: tabs, indents, newlines that create blank space between text, either horizontally or vertically.

Filter by
Sorted by
Tagged with
43 votes
5 answers

How to shift a selected area of text in Emacs by a certain number of spaces?

I am writing python code so shifting/moving blocks of lines is important to avoid going through each line individually. How can I do this without an add-on? Is there a type of operation keystroke ...
Vass's user avatar
  • 723
18 votes
7 answers

Easiest way to check if current line is "empty" (ignoring whitespace)?

I just want to check if the current line is empty or not (if it contains only whitespace, then I still consider it empty). Here is my initial version: (defun strip-text-properties(txt) (set-text-...
Chillar Anand's user avatar
6 votes
2 answers

Whitespace-mode tab mark disturb my indentation

I encounter this issue when i set whitespace-style to (face tabs trailing tab-mark) and turn on whitespace-mode. When whitespace-mode is turned off, everything looks well: When whitespace-mode is ...
littleqz's user avatar
  • 117
29 votes
3 answers

Match two spaces with incremental search

When searching using: C-s SPC SPC Also matches single spaces. I want to match exactly two space.
Rovanion's user avatar
  • 987
9 votes
2 answers

How can I visualize trailing whitespace like this?

I've tried to configure whitespace-mode to do what I want but with no luck. I'm trying to achieve the following (see image).
Cezar's user avatar
  • 193
7 votes
1 answer

"Format Code" like in Eclipse

In Eclipse, I can hit CTRL + SHIFT + F which not only corrects the indentation but also whitespace (for example: c=a +b ; is corrected to c = a + b;) and the line length. I am looking for a similar ...
Monkey Supersonic's user avatar
5 votes
0 answers

How to display and format leading spaces (spaces at the beginning of a line) with whitespace-mode? [closed]

I want to see all spaces at the beginning of a line as dots. Also tabs and line breaks. So I've set my init.el file as the following: (setq-default indent-tabs-mode nil) (setq whitespace-style '(...
fschuindt's user avatar
  • 161
4 votes
3 answers

Disable removal of trailing whitespace in Emacs

I'm using Emacs 25.1.50 (9.0) on OS X and am starting to get annoyed with the automatic removal of trailing whitespace. I have tried solutions from here, but to no avail as my write-file-functions and ...
GDP2's user avatar
  • 1,350
2 votes
2 answers

Automatically insert a space in some C expressions

The corporate rules about indention forces us to surround our if conditions with spaces like this (in a C and C++ codebase) : if (<space>foo == bar<space>) { } Is there any emacs tool ...
Guid's user avatar
  • 121
2 votes
1 answer

Enable whitespace-mode with Prelude in C++-mode

With a vanilla install of Prelude and with C++-mode as my major mode, M-x whitespace-mode no longer shows whitespace characters. I get a message indicating that I am toggling whitespace-mode on and ...
Praxeolitic's user avatar
0 votes
2 answers

Function that deletes redundant leading whitespaces of a region while maintaining indentation

Is there a Elisp function that deletes "redundant" leading whitespace of the region while maintaining relative indentation. This behavior is like textwrap.dedent in python.
FunkyBaby's user avatar
  • 797
0 votes
2 answers

whitespace-mode doesn't show the space characters

I need to see the space characters but I can't set it for the life of me. I went to customize the Whitespace Display Mapping and this is what I found. Notice that the mapping for the space is set to ...
Jenia Ivanov's user avatar