Score:0

I can't indent my file indentation

jp flag

I write C file on Emacs and I'm using 4 tab width for my files. In Emacs, I see that my file is indented with 4 tab-width. But when I try to read my file with cat command, I see that my file is indented with 8 tab-width.

First, I thought it is because of Emacs, then opened file with Gedit and re-indented file from 8 tab-width to 4 tab-width and saved it. But still, when I read my file from terminal or push it to Github or whatever, it is indented with 8 tab-width.

File on Emacs:

File on Emacs

File on Gedit:

File on Gedit

What can override my file, after my savings? Are there any global variable for modifying tab-width on my system?

Score:1
ca flag

Your file contains TAB-characters (ascii-code 9, unicode 0009).

emacs interprets these and displays them aligned to 4-character borders. The general norm is to use 8 -character borders.

I'm not aware of gedit having a setting for this.
Try a free text editor instead, e.g. geany, or kate

Things to check:
$ man tabs
$ od -t x1z textfile | less
https://www.google.se/search?q=tabs+2+spaces+deb

us flag
Gedit does have a setting. In the bottom-bar of the gedit window you can select the tab width (2, 4, or 8 spaces), and you can select whether to use spaces or a tab character. This is on a per file basis. You can also set the default behavior for all files using Gedit's Preferences dialog, on the Editor tab.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.