Skip to main content
Share Your Experience: Take the 2024 Developer Survey
10 votes
Accepted

magit-status does not open, when using (global-whitespace-mode 1)

I just added the following to my init.el: (defun prevent-whitespace-mode-for-magit () (not (derived-mode-p 'magit-mode))) (add-function :before-while whitespace-enable-predicate 'prevent-...
Julian Kniephoff's user avatar
5 votes
Accepted

Whitespace highlighting

This should do what you want. Define regexps that match what you want, and faces. Then match the subgroups in the function you add to font-lock-keywords. The subgroups are used to say that you want ...
Drew's user avatar
  • 77.9k
4 votes

Custom whitespace-line-column for specific modes in whitespace-mode

As erikstokes correctly points out, the variable that controls this behaviour is whitespace-line-column. If you unconditionally set this variable in your user-init-file, however, it will affect all ...
Basil's user avatar
  • 12.4k
4 votes
Accepted

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

There is a set of conventions for minor modes documented in the docstring of define-minor-mode: The defined mode command takes one optional (prefix) argument. Interactively with no prefix ...
wasamasa's user avatar
  • 22.2k
3 votes
Accepted

What kinds of whitespace are visualized in Whitespace mode?

If you look at the docstring of whitespace-mode (emphasis mine): whitespace-mode is an interactive autoloaded compiled Lisp function in ‘whitespace.el’. (whitespace-mode &optional ARG) ...
JeanPierre's user avatar
  • 7,475
3 votes

Disable whitespace-mode for single mode

You can do like that: (define-global-minor-mode my-global-whitespace-mode whitespace-mode (lambda () (unless (derived-mode-p 'rmail-mode 'term-mode) (whitespace-mode)))) (my-global-...
djangoliv's user avatar
  • 3,199
3 votes

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

whitespace-mode is already an interactive function and, if called interactively, toggles the mode. So the simplest answer to your question is: (global-set-key (kbd "<f6>") 'whitespace-mode)
phils's user avatar
  • 51.5k
3 votes
Accepted

distinguish inner consecutive spaces

Indeed you can't specify different glyphs for different kinds of spaces because this feature makes use of a display table. The relevant values in variable whitespace-style are (emacs manual): space-...
JeanPierre's user avatar
  • 7,475
3 votes
Accepted

disable whitespace mode on new buffers

Prelude's own prelude-whitespace was causing the behavior. You can disable it using: M-x customize-group RET prelude Set Prelude Whitespace (prelude-whitespace) to off/nil (default is on). According ...
Drew's user avatar
  • 161
2 votes
Accepted

How to set whitespace-line-colum per mode?

You probably have to restart whitespace mode for the changes to take effect. Try the following: (add-hook 'prog-mode-hook '(lambda () (interactive) ...
Jesse's user avatar
  • 1,994
2 votes
Accepted

Highlight useless whitespace at end of file

Is this not supported out of the box? It is; see (emacs) Useless Whitespace. My current settings are: (global-whitespace-mode) (setq whitespace-style '(face trailing lines tabs big-indent)) As ...
Basil's user avatar
  • 12.4k
2 votes

How can I disable font-lock-mode but have the whitespace mode highlighting

having the trailing whitespaces highlighted in red C-hv show-trailing-whitespace does not depend upon font-lock-mode. Enabling that and disabling font-lock-mode is fine, AFAICS. Parts of whitespace-...
phils's user avatar
  • 51.5k
1 vote

How to apply different whitespace settings for different buffer portions?

To get this Highlight tab in coments in yard-mode on this (Remember to do M-x tabify on the snippet below) example.ru # Reverses the contents of a String or IO object. # # @param ...
mxnt's user avatar
  • 686
1 vote
Accepted

How to set the column number from which on the text is marked as exceeding line length limit?

start Emacs with emacs -q to skip your init files paste the following code into the *scratch* (Lisp interaction) buffer: (setq-default whitespace-line-column 73 whitespace-style '(face lines-...
nega's user avatar
  • 3,276
1 vote

whitespace-style "face" activates highlighting of quoted string in fundamental mode

The following will do it. It's source is from font-lock.el which is included in emacs. (setq font-lock-string-face nil)
Greenbeard's user avatar
1 vote
Accepted

Disable white-space mode emacs-26.3

whitespace-mode is local to a buffer. If you put (whitespace-mode 0) in your init file it affects only the buffer than happens to be current at the time that sexp is evaluated. Don't do that. ...
Drew's user avatar
  • 77.9k
1 vote
Accepted

whitespace-cleanup stopped working

Ok I narrowed it down to the following line (setq whitespace-style ' (face space-mark tab-mark)) If I remove it whitespace-cleanup works. Probably I'm overwriting something that is necessary for it ...
daeda's user avatar
  • 439
1 vote

Highlight useless whitespace at end of file

The following lisp code defines a new minor mode hl-ws-eob-mode. If you have installed the code in your init files you can try it by M-x hl-ws-eob-mode RET. It works for buffers that are fontified by ...
Tobias's user avatar
  • 33.2k
1 vote

magit-status does not open, when using (global-whitespace-mode 1)

Looking at whitespace.el I see we could also do this: (with-eval-after-load 'whitespace (setq whitespace-enable-predicate `(lambda () (and (funcall ,whitespace-enable-predicate) ...
phils's user avatar
  • 51.5k
1 vote

magit-status does not open, when using (global-whitespace-mode 1)

You could customize the whitespace-global-modes variable to be: (not magit-mode) Edit: In fact, as pointed out by Julian Kniephoff in the comments, this would have to be a more complete list of ...
phils's user avatar
  • 51.5k
1 vote
Accepted

Space and line-end indicators stay after switching off whitespace-mode

It turns out that the set up with a multitude of additional packages is responsible for this problem. (Vanilla Emacs does not have this issue.) But it is hard to determine what exactly causes the ...
halloleo's user avatar
  • 1,345
1 vote
Accepted

How to toggle whitespace mode in evil insert state?

One workaround I'd found is to temporarily change the face background color. ;; Don't show trailing space in insert mode. (defvar i42/whitespace-trailing-bg (face-attribute 'whitespace-trailing :...
ideasman42's user avatar
  • 8,826
1 vote

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

C-h f whitespace-mode tells you what your problem is: whitespace-mode is an interactive autoloaded Lisp function in whitespace.el. (whitespace-mode &optional ARG) Toggle whitespace ...
Drew's user avatar
  • 77.9k

Only top scored, non community-wiki answers of a minimum length are eligible