In my ~/.emacs I have among other things, the following, at the end:
(define-key c++-mode-map (kbd "<C-tab>") 'company-irony)
(define-key c++-mode-map (kbd "<tab>") 'tab-to-tab-stop)
(define-key c++-mode-map (kbd "<backspace>") 'delete-backward-char)
(define-key c-mode-map (kbd "<C-tab>") 'company-irony)
(define-key c-mode-map (kbd "<tab>") 'tab-to-tab-stop)
(define-key c-mode-map (kbd "<backspace>") 'delete-backward-char)
(setq-default indent-tabs-mode t)
(setq tab-width 4)
Now, when I open Emacs within some c++ project, my TAB inserts 2 spaces instead of inserting 1 tab.
That, until I manually open ~/.emacs, press C-c C-e
to evaluate current buffer. Then, back into C++ file, pressing TAB now correctly inserts TAB of size 8 (?). Until I manually execute M-: (setq tab-width 4). Now everything is correct.
Several questions:
- why is my .emacs seem to be ignored on launch?
- why tab size is still 8 when I specified 4 in .emacs?