New answers tagged

0

You could do this -- essentially the same as @lawlist's comment: (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) (defun my-c-mode-common-hook () "Custom behaviours for `c-mode-common-hook'." (when (boundp 'whitespace-style) (setq-local whitespace-style (remq 'tabs whitespace-style)))) I constrain the indentation only to the Kernel code ...


0

FWIW (setq nlinum-format " %d") works with nlinum-mode (available from your nearest GNU ELPA repository) and still right-aligns the numbers.


2

You could customize the variable linum-format to be a format string that begins with a space. The simplest would be (setq linum-format " %d") which sticks one space in front of the formatted digit. I tried it out and it looks slightly weird: The other thing is that if you're on Emacs 26, there is a new line number mode display-line-numbers-mode which is "...


1

There's no built-in command to insert a character before the point, presumably because any key binding for it would have to include at least one key stroke in addition to the character, and if you're going to type two keystrokes then the feature already exists: SPC Left or SPC Ctrl+B. There is a built-in command open-line to insert a newline before the ...


0

I've run into the same issue. Besides using auto-formatters (which have mixed results - some aren't entirely lossless). Compare the resulting object code (bytecode, generated AST or assembly), this isn't fool proof if the language uses a preprocessor, nevertheless, it can help. (example for Python, and Rust) Write a simple function that removes or ...


0

While I personally use -- and feel like the general trend is towards -- external tooling (à la clang-format/clang-tidy, autopep8, perltidy, rustfmt, etc.) Emacs has some useful tools. While it doesn't restrict editing, have you looked at the excellent whitespace-cleanup (and its cousin whitespace-cleanup-region) that comes with Emacs? Based on your settings ...


4

I recommend reading the Emacs Lisp manual instead of Emacswiki. Here's some of it on backslash sequences in regular expressions: ‘\sCODE’ matches any character whose syntax is CODE. Here CODE is a character that represents a syntax code: thus, ‘w’ for word constituent, ‘-’ for whitespace, ‘(’ for open parenthesis, etc. To represent ...


Top 50 recent answers are included