I am new to emacs. I have been using this configuration for emacs:
(setq column-number-mode t)
(setq c-default-style "linux"
c-basic-offset 4)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (wheatgrass))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Generally, the indentation is correctly handled by emacs automatically. For an if-statement, however, even if I could see the correct indentation in emacs then in an other editor the tab is not shown.
I have been editing a *.c file and the mode is "C/l mode defined in ‘cc-mode.el’. Major mode for editing C code".
Here an example: If I create an c file in emacs with the following code:
int main() {
int x = 1;
if (x > 0)
x++;
else
x--;
printf("Value of x: %d\n", x);
return 0;
}
If I visualize this code in different editor or I copy it from an emacs into another editor the output is the following:
int main() {
int x = 1;
if (x > 0)
x++;
else
x--;
printf("Value of x: %d\n", x);
return 0;
}
Basically, it seems that even if it looks like it is correctly indenting the if statement it has not added any tab character in the if statement.
What is the problem? How could I fix it?