Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Indenting is used to organize code by indicating blocks, closures, conditionals, and other constructs. It makes code easier to read, and in some languages is used to handle control flow.
3
votes
Accepted
Why is code indentation in the current codebase of Emacs so difficult to read?
It has mixed tabs and spaces for indentation, and assumes that tabs are 8 characters wide. You’ve probably configured your Emacs to display tabs as a different width. …
6
votes
Accepted
Weird indentation behavior in C++ mode
Edit: I forgot to mention, but you can customize c-default-style to choose a different indentation style, and you can add your own entries to c-style-alist to make one that's exactly to your liking. …
1
vote
Accepted
What is the best way to redefine the indentation rules of a major mode
You will probably want to use defadvice to provide a wrapper around js--proper-indentation, rather than cometely redefining it. … This will allow you to handle the indentation for arrow functions yourself, while calling through to the original function to handle everything else. …
1
vote
Completely disable all auto-indentation
Not only does this prevent the indentation from getting messed up, it also prevents a rogue paste from running commands in your emacs session using M-x. …
1
vote
Need help with JavaScript `{` indentation
Indentation in js2-mode is not as customizable as indentation in C mode. As such it's not possible to do this outside of changing the source code for js2-mode itself. … Note especially the "second likely point", which looks for " = " on the previous line to choose an indentation point; adjusting this will let you do what you want. …
3
votes
How to set the default indentation width globally?
There is no global setting for the indentation width. Instead, each mode has it’s own setting. In c-mode it is called c-basic-offset. In js2-mode it is js2-basic-offset. …
1
vote
In Doom Emacs, when cursor is highlighting a line, it indents a few pixels in. How to turn o...
There is no setting to deliberately visually indent the highlighted line merely because it is highlighted. Instead it sounds like the face used during highlighting doesn’t match the face used for the …
3
votes
Accepted
ctrl-backspace behaves differently across emacs environments, though .init file is same
Use C-h k to find out what function <C-Backspace> is bound to on the two computers.
After troubleshooting, the solution turns out to be that clean-aindent-mode is not installed on the non-working mach …
3
votes
Always show the last lines with a lower indentation than the first line that's visible in a ...
Some are keyed off of indentation, others off of syntax elements (such as curly braces or parentheses). …
3
votes
Accepted
Why Emacs creates multiples whitespaces after I create a comment and jump to a new line?
Lisp has a more complex convention for comments than most languages, and automatic formatting respects this convention. It is documented in appendix D.7 Tips on Writing Comments of the Elisp manual (w …
-1
votes
Change `standard-indent` for 1 specific major mode
(add-hook 'web-mode-hook
(lambda () (setq standard-indent 2)))
99% of all modes define at least one hook variable. Hook variables just hold a list of functions that will be called in the ca …
2
votes
Accepted
Can't set indentation to 4 spaces because hook is not called
add-hook takes only a single hook function to add, plus two other optional arguments.
Do this instead:
(add-hook 'c++-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'init-c-cpp)
(add-hook 'c++-mode-hook (la …
3
votes
Accepted
How to set python indent offset to 2 spaces in elpy emacs?
Is python-indent-guess-indent-offset set to t? If so, then it's probably looking at your file and deciding to set the python-indent-offset to some other value. Try setting it to nil in the :init for t …
2
votes
Accepted
Changing indent-tabs-mode and electric-indent-mode in a buffer
Again, you can use C-h f to look up the documentation for each of these functions. When you do, you will find that setq-local makes a variable buffer–local and then sets the value of that variable in …
2
votes
Accepted
C offset is 2 with treesit
You are probably in c-ts-mode, so the correct variable is c-ts-mode-indent-offset. c-basic-offset is only for buffers that are in c-mode.