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
0
votes
1answer
43 views

How to account for tabs in `hl-line-range-function`?

To avoid conflicts with highlighting indentation, I made the highlight line begin after the current indentation. This works well, except when tabs are used as leading white space. How could the my-...
7
votes
2answers
115 views

How to highlight preceeding space-indentation that isn't rounded to current width?

Is there a way to highlight (set the background color for example) the space before a line, when it's indentation isn't aligned to the current indentation-width? 4 spaces indentation for eg: fn ...
1
vote
0answers
61 views

auto-fill-mode fails in comment with empty second line

Consider the following comments: ;; This is the first line of a comment. ;; ;; This is the second line, which begins a paragraph. If I have ;;auto-fill-mode enabled, I lose the leading space! ;; ...
5
votes
1answer
266 views

avoiding underlined spaces between two lines

It must be very simple to get rid of but I could not find something addressing the problem : I would like to avoid underlined spaces between two lines. The following screenshot illustrates the problem ...
0
votes
1answer
165 views

modify tab length for eclim-java-format

So I'm trying to use eclim with spacemacs and I have this function called eclim-java-format which reformat the text as in eclipse. The problems is that it reformats tabs as tabs and not as space and ...
1
vote
1answer
94 views

Ignoring newline changes in smerge-diff-mine-other

For me, smerge-diff-mine-other seems to ignore changes in the number of whitespace characters where there is whitespace, but I would sometimes like it to ignore all whitespace, including newlines - ...
3
votes
2answers
204 views

Delete trailing white space from all projectile project files

Problem So the problem is pretty straight forward I'm just trying to get delete trailing spaces from all files in a projectile project. Here's what I've tried so far: (defun projectile-delete-...
2
votes
0answers
41 views

Are there any packages or configuration snippets for better whitespace traversal?

Whitespace traversal in Emacs is atrocious. By "traversal" I mean: Moving the point with C-<direction> Expanding a selection (with either a package or region mark) Deleting with C- or M- ...
2
votes
1answer
342 views

Difficulty with query-replace-regexp

I'm having trouble getting query-regex-replace to do what I want. I've read the docs several times and still can't figure it out. Here are a few examples of things I can't figure out how to do with ...
3
votes
1answer
80 views

Function to allow select a directory and run a command on its files, descending recursively?

I sometimes work on legacy code, and they have mixture of tabs and spaces. I use whitespace-cleanup function in whitespace.el to clean them up. But I have many files, so i want to run the command on ...
1
vote
1answer
164 views

Virtual space for rectangular selections (at least)

In Vim there is the virtualedit variable which can be set so that Vim allows the cursor to move past the end of the line always or only when in visual block mode. Is it possible to configure Emacs to ...
1
vote
0answers
62 views

Increase spacing between physical lines only

How can I add spacing where there are linebreaks in the file, but not where a line is word-wrapped? This would be very useful for reading log files with long lines. Here's a mockup of what I'm after: ...
1
vote
3answers
84 views

How can I switch whitespace-mode enabled/disabled by key?

(defun switch-whitespace-mode () (interactive) (whitespace-mode) ) (global-set-key (kbd "<f6>") 'switch-whitespace-mode) Through the above configuration,I failed.
0
votes
1answer
564 views

tab and spaces shown aligned in emacs C++ mode, but not in other editors

In Emacs' C++ mode, I sometimes accidentally introduced a tab where I should use four whitespaces instead to create indentations. Adjacent lines with mixed uses of tabs and spaces for indentations are ...
6
votes
1answer
96 views

Whitespace highlighting

I've tried whitespace-mode, but I can't configure it the way I want. There are others, but some of them are obsolete and I don't want to try them all. I always indent via tabs and can't stand ...
1
vote
1answer
151 views

How to set the color for whitespace in isearch failures

I have my isearch failure face set like so: (custom-set-faces ... '(isearch-fail ((t (:background "#660c00")))) ... ) It works for the most part, highlighting text which doesn't match in that ...
2
votes
1answer
241 views

How to set whitespace-line-colum per mode?

I'm trying to have whitespace-line-column set to 80 in prog-mode and 100 in web-mode, etc. However when using hooks seems to get ignored, as is always set to 80. (require 'whitespace) (setq ...
5
votes
1answer
495 views

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 ...
1
vote
2answers
131 views

Delete all spaces+newlines but the first

Given the following buffer: foo bar nee nope If I place point on the 2nd line and execute (just-one-space -1) the result will be: foo bar nee nope Is there a way to modify the behavior such ...
4
votes
1answer
179 views

distinguish inner consecutive spaces

I'm aware of and use whitespace-mode to great effect. I don't show a glyph/character for spaces because I think it's too noisy and unnecessary. I do highlight trailing spaces red which is great. ...
1
vote
1answer
52 views

Space before \t is really inserted?

Launch Emacs with emacs -Q, insert a line contains only a \t (| represents the cursor): \t| M-x whitespace-mode, it should looks like (_ represents visual space): »________$ Insert 2 spaces at the ...
3
votes
3answers
821 views

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 ...
4
votes
2answers
2k views

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).
3
votes
0answers
353 views

How to delete all white space during save except for final new line

I am aware that it is a good idea to have one blank line at the end of each file. I am also aware that extra white space in a file is bad. Currently in my .emacs file I have (add-hook 'before-save-...
5
votes
1answer
426 views

How do I make javascript-mode not turn all 8 spaces into tabs?

This is what javascript-mode generates with standard tabbing (I never hit the space key when making it). I'd like to have the files contain no tab characters. I can't seem to find any option in the ...
1
vote
1answer
55 views

Emacsql string query with space

My sqlite database has columns which consist of TEXT objects containing spaces. I'm new to both emacs and programming, and while I want to use emacsql for reasons, it's crucial that I can select on ...
2
votes
1answer
90 views

Make spaces show as spaces in minibuffer instead of completion

The default mapping of SPC in minibuffer is (self-insert-command N). However, I prefer SPC to simply type a single space (for instance, in passing arguments to environments and commands within AuCTeX)....
6
votes
1answer
313 views

Retooling fill-paragraph to append trailing spaces

I'm using emacs as an external editor for mutt, and am hoping to get format=flowed messages to compose properly. The default behavior for fill-paragraph is to end lines without any whitespace, but the ...
3
votes
1answer
126 views

How to prevent whitespace cleanup at point?

I have hooked whitespace-cleanup to before-save-hook and there is a timer to auto save buffer every 5 seconds. When i am typing something, or coding in python, I stop once in a while and buffer ...
4
votes
1answer
387 views

How to skip forward to first whitespace character?

What is the easiest way to skip forward to the first whitespace character after the current cursor? I used to do it just by searching for a space (when I knew there was one there), but now that seems ...
2
votes
3answers
924 views

Whitespace issue in spacemacs

It seems that whitespace is no longer visible while editing files, since this github issue. Now I usually end up seeing the whitespace only after I have saved or even commited my files sometimes. ...
0
votes
1answer
39 views

query replace ingonring new lines

My text is written in paragraphs that are split into lines, which makes it difficult to search for strings that might be spanned across several lines. For instance, given the following text This is ...
3
votes
0answers
101 views

How to hide the extra period in linum mode when you have whitespace mode enabled?

I have linum mode and whitespace mode enabled. This works great except that I want padding in linum mode (which uses a space) and so, instead of there being a space (or a different colored space as I ...
13
votes
7answers
3k views

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-...
7
votes
3answers
1k views

How to delete all whitespace up to the first non-whitespace character?

I'm looking for an emacs function that will delete all whitespace from the cursor position (including newlines) until the first non-whitespace character. For example, if my cursor is positioned at ...
0
votes
2answers
765 views

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 ...
0
votes
1answer
164 views

How to customize visualization blank mode

I use blank-mode I don't want the newlines to be displayed how can I turn it off. Also long lines are shown in dark background how can I turn that off. In fact I only want to display trailing ...
7
votes
2answers
210 views

How to automatically adjust whitespace after yanks?

When editing human language text and moving text fragments around, I frequently run into the problem that whitespace moved at the beginning or end of a fragment doesn't fit into the new position. For ...
2
votes
1answer
176 views

Weird spacing with whitespace newline mark “↴” [duplicate]

I have my whitespace newline mark set to the "↴" character, (setq whitespace-display-mappings '( (newline-mark 10 [8628 10]) ))...
5
votes
1answer
899 views

Too much whitespace on setting org-mode tags

If I create the following in an org-mode buffer: * one ** two ** three then move point to the line containing "two" and do C-c C-c spam <RET>, I get this: * one ** two ...
1
vote
1answer
499 views

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 ...
26
votes
5answers
11k views

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 ...
3
votes
1answer
452 views

whitespace-mode ignores whitespace-line-column

In ~/.emacs I've globally enabled whitespace-mode: (require 'whitespace) (setq whitespace-style '(face empty tabs lines-tail trailing)) (global-whitespace-mode t) Example buffer content: -*- fill-...
2
votes
4answers
665 views

How can I stop emacs from highlighting whitespace?

After a recent update, my Perl files are rendered like this: Note that trailing spaces are shown in red and empty lines in yellow. This is happening despite my having the following in my ~/.emacs: (...
2
votes
1answer
227 views

How to activate whitespace-mode for a cc-mode buffer from .dir-locals.el?

I'd like to enable whitespace-mode from a .dir-locals.el file such that when I open a file managed by cc-mode, I will see trailing spaces highlighted with the whitespace face. I think I'm close. This ...
7
votes
1answer
3k views

“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 ...
2
votes
1answer
67 views

How can I configure incremental search to put my cursor at the start of whitespace rather than the end?

I just installed a new version of Emacs (24.3.1 through Fedora). For some reason, when I use C-s to search for a single space character, it jumps my cursor to the end of contiguous spaces rather than ...
0
votes
1answer
567 views

Interpretation of tabs in text copied from Emacs and pasted in other programs/editors

When you set Emacs to recognize 4 spaces as 1 tab, then copy text from an Emacs buffer to another program, will the other program see 4 spaces or interpret it as 1 tab (which may correspond to a ...
20
votes
3answers
2k views

Match two spaces with incremental search

When searching using: C-s SPC SPC Also matches single spaces. I want to match exactly two space.
11
votes
2answers
595 views

How can I suppress emacs' display of the final newline in a file?

One of vim's quirks is that it doesn't show an empty line at the end of a file if the file ends with the newline character. This way, if the file doesn't end with a newline, the display is the same, ...