Skip to main content
10 votes
Accepted

How to detect tabs or spaces in Emacs

By default I want all indentation (when I hit the tab key) to be 2 spaces. This can be achieved for many modes with settings such as (setq-default indent-tabs-mode nil tab-stop-list ...
Basil's user avatar
  • 12.5k
8 votes

Confusion about space and tab characters in Emacs

Like most things in emacs, the tabs policy is configurable. It sounds to me that you'd like to follow the most common apporach and use the tab key as an indentation tool and not have tab characters in ...
Heikki's user avatar
  • 3,076
7 votes
Accepted

css-mode: use tabs and not spaces

The built-in CSS mode should support this just fine by giving indent-tabs-mode a non-nil value. Note that spaces will still be used for padding if the number of indentation spaces isn't a multiple of ...
simenheg's user avatar
  • 121
6 votes

Emacs Lisp to view text file like a table

One way to do (much of) what you want is as follows: You can force org-mode on the buffer visiting the file with M-x org-mode and use C-u C-u M-x org-table-convert-region to convert each line ...
NickD's user avatar
  • 32.5k
5 votes

Confusion about space and tab characters in Emacs

To make tabs and spaces visible, you can enable whitespace-mode with M-x whitespace-mode RET or M-x global-whitespace-mode RET. Have a look at variable whitespace-style (e.g. M-x customize RET ...
Croad Langshan's user avatar
5 votes
Accepted

Org external link - can I indicate which browser/tab to be used

You can set up your own protocols in org-link-parameters with org-link-set-parameters. If you run (org-link-set-parameters "chrome" :follow (lambda (path) (browse-url-chrome (concat "http:" path)))) ...
Tobias's user avatar
  • 33.5k
5 votes
Accepted

Python mode indentation

I feel kind of ridiculous for not having seen this before, but I found the answer on the EmacsWiki: No Tabs page under the "Smart inference of indentation style" section. Putting that code in my init....
Andrew Lamarra's user avatar
5 votes
Accepted

How to change shell-script-mode indentation not to use tabs?

Shell script mode does not have any setting that relates to using tabs vs spaces (at least as of Emacs 25.2). It obeys the default Emacs setting which is given by indent-tabs-mode and tab-width: 8 ...
Gilles 'SO- stop being evil''s user avatar
5 votes
Accepted

Emacs Lisp to view text file like a table

You’re on pretty much the right track, though I am not very accomplished at writing modes myself. However, I feel compelled to point out that csv-mode can do this for you if you want. Open a buffer ...
db48x's user avatar
  • 18.8k
4 votes

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

The normal convention is that TAB characters align to the next multiple-of-8 column. Notice: I wrote 8, not 4. So if your other text editor aligns to a multiple-of-4 column (like you seem to imply), ...
Stefan's user avatar
  • 26.6k
4 votes

How do I keep the cursor from going to the beginning of the line when there's no text on said line?

You can try quarter-plane-mode (available from GNU ELPA), but beware. Emacs's underlying engine is basically unable to do what you want; it can only place cursor where there is some text), so the ...
Stefan's user avatar
  • 26.6k
3 votes
Accepted

Make `tab` key insert 5 space characters in Latex Mode

Well, the answer to "is it possible to make Emacs do " is almost always "yes". If you really just want to insert five spaces with a TAB, you could do it by: (defun my-tab-with-spaces () "Insert ...
Win's user avatar
  • 581
3 votes
Accepted

How can you make conf-mode indent with tabs?

I thought [Space] might have meant it was a minor mode The mode line lighter Conf[Space] corresponds to conf-space-mode, which is a major mode derived from conf-mode for editing space-separated ...
Basil's user avatar
  • 12.5k
3 votes
Accepted

How do I stop tab from being electric in Text mode?

What TAB does now is indent-for-tab-command. What you want is tab-to-tab-stop. The latter is available at M-i, so one option is to learn to use that. To always bind TAB to run that command in Text ...
pst's user avatar
  • 276
3 votes

I am writing Fortran code in emacs but the tab key behaviour changes in F90 mode. Can I change it back?

Yes, what you want is a "hungry" or "greedy" delete/backspace. f90-mode doesn't come with such a thing, but cc-mode does. It includes two inter-related families of functions c-...
nega's user avatar
  • 3,346
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. For lisp-mode there are two: ...
db48x's user avatar
  • 18.8k
2 votes

Is there a way to set a list of display tab stops?

Install the csv-mode package from GNU ELPA, and then use that mode with your file. e.g.: -*- mode: csv; -*- Then type C-cC-a whenever you want to visually re-align the data. You will need to use M-...
phils's user avatar
  • 52.4k
2 votes

How to indent the selected line one "tab" forward or backward

There's some commands starting with the name indent-rigidly, which indents by whitespace. The base command indent-rigidly is bound to C-x TAB by default, and lets you use the arrow keys to indent the ...
Erik Sjöstrand's user avatar
2 votes

Accessing the character in the line below

(defun char-below () (let ((col (current-column))) (save-excursion (if (not (zerop (forward-line 1))) nil (move-to-column col) (and (not (eolp)) (char-after)))))...
Drew's user avatar
  • 78.5k
2 votes
Accepted

Accessing the character in the line below

Maybe something like this? I haven't tested it with tabs though... (defun char-below () (setq temporary-goal-column nil) (ignore-errors (save-excursion (next-line) (string (...
Erik Sjöstrand's user avatar
2 votes
Accepted

org-mode setting to preserve spacing in SRC code, with verbatim latex output to pdf

(setq TeX-auto-untabify 't) Adding that to the .emacs file solves the problem wonderfully.
Jason Hemann's user avatar
2 votes
Accepted

How to reveal tabs in the indentation in a cpp file?

First of all you should set the default value of indent-tabs-mode to nil. Either toggle it off with customize or put the following lisp code into your init file. (setq-default indent-tabs-mode nil) ...
Tobias's user avatar
  • 33.5k
2 votes

How to change shell-script-mode indentation not to use tabs?

Gilles' answer is mostly correct, but indent-tabs-mode is a local variable, so it works per-buffer. You can't use setq to disable the tabs globally. You must use setq-default instead: (setq-default ...
freehck's user avatar
  • 21
2 votes

How to NOT Auto Indent when a specific Character is inputted?

C-hk( tells us: ( runs the command c-electric-paren (found in c-mode-map), which is an interactive compiled Lisp function in ‘cc-cmds.el’. It is bound to ), (. I suggest: (with-eval-after-load "...
phils's user avatar
  • 52.4k
2 votes
Accepted

Emacs converting spaces to tabs when using X11 primary selection in a terminal window

Analysis There's a space in the buffer, but in certain circumstances, when Emacs needs to print a sequence of spaces, it chooses to print a tab instead because that requires writing fewer characters ...
Gilles 'SO- stop being evil''s user avatar
2 votes
Accepted

How to match emacs column count to gofmt column count?

This sounds like an X–Y problem, where someone has a detailed question that we could find an answer for but that seems to be leading them in the wrong direction. Since you haven’t said what you’re ...
db48x's user avatar
  • 18.8k
2 votes

Tex indentation with TAB

Looks like I somehow managed to switch to Tex mode, instead of LaTex mode. Changing to LaTex mode is easy: M-x latex-mode. Many thanks to @vonbrand for telling me to check the mode!
Yair Daon's user avatar
  • 131
2 votes

Emacs DOOM does not show tabs although 'centaur-tabs' is enabled

I faced similar problem, adding this line to config.el fixed issue for me (taken from here): (after! centaur-tabs (centaur-tabs-group-by-projectile-project)) It seems to be a bug of centaur tabs, ...
Denis's user avatar
  • 21
2 votes
Accepted

Tabs like vim configuration

In the context of shell-script-mode, to set the "indentation size" the variable you're looking for is sh-basic-offset. From C-h v sh-basic-offset: sh-basic-offset is a variable defined in ‘...
nega's user avatar
  • 3,346

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