Singular way to set tab width in Emacs

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












In Emacs, is there a way to set all languages to use tab-width 2 as a default, or do you have to use this plethora of different instructions and variables for every single language?



(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq-default sh-basic-offset 2)
(setq c-default-style "bsd"
c-basic-offset 2
css-indent-offset 2
js-indent-level 2)
(add-hook 'php-mode-hook '(lambda ()
(setq c-basic-offset 2)))
(add-hook 'ess-mode-hook '(lambda ()
(setq ess-fancy-comments nil)
(setq ess-indent-offset 2)))






share|improve this question




















  • First guess is ESC-x customize-variable tab-width, second guess is (set-variable 'tab-width 2) in some generic hook, but I'm no emacs expert. Try emacs.stackexchange.com
    – dirkt
    Jan 6 at 16:50














up vote
2
down vote

favorite












In Emacs, is there a way to set all languages to use tab-width 2 as a default, or do you have to use this plethora of different instructions and variables for every single language?



(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq-default sh-basic-offset 2)
(setq c-default-style "bsd"
c-basic-offset 2
css-indent-offset 2
js-indent-level 2)
(add-hook 'php-mode-hook '(lambda ()
(setq c-basic-offset 2)))
(add-hook 'ess-mode-hook '(lambda ()
(setq ess-fancy-comments nil)
(setq ess-indent-offset 2)))






share|improve this question




















  • First guess is ESC-x customize-variable tab-width, second guess is (set-variable 'tab-width 2) in some generic hook, but I'm no emacs expert. Try emacs.stackexchange.com
    – dirkt
    Jan 6 at 16:50












up vote
2
down vote

favorite









up vote
2
down vote

favorite











In Emacs, is there a way to set all languages to use tab-width 2 as a default, or do you have to use this plethora of different instructions and variables for every single language?



(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq-default sh-basic-offset 2)
(setq c-default-style "bsd"
c-basic-offset 2
css-indent-offset 2
js-indent-level 2)
(add-hook 'php-mode-hook '(lambda ()
(setq c-basic-offset 2)))
(add-hook 'ess-mode-hook '(lambda ()
(setq ess-fancy-comments nil)
(setq ess-indent-offset 2)))






share|improve this question












In Emacs, is there a way to set all languages to use tab-width 2 as a default, or do you have to use this plethora of different instructions and variables for every single language?



(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq-default sh-basic-offset 2)
(setq c-default-style "bsd"
c-basic-offset 2
css-indent-offset 2
js-indent-level 2)
(add-hook 'php-mode-hook '(lambda ()
(setq c-basic-offset 2)))
(add-hook 'ess-mode-hook '(lambda ()
(setq ess-fancy-comments nil)
(setq ess-indent-offset 2)))








share|improve this question











share|improve this question




share|improve this question










asked Jan 5 at 20:26









forthrin

832921




832921











  • First guess is ESC-x customize-variable tab-width, second guess is (set-variable 'tab-width 2) in some generic hook, but I'm no emacs expert. Try emacs.stackexchange.com
    – dirkt
    Jan 6 at 16:50
















  • First guess is ESC-x customize-variable tab-width, second guess is (set-variable 'tab-width 2) in some generic hook, but I'm no emacs expert. Try emacs.stackexchange.com
    – dirkt
    Jan 6 at 16:50















First guess is ESC-x customize-variable tab-width, second guess is (set-variable 'tab-width 2) in some generic hook, but I'm no emacs expert. Try emacs.stackexchange.com
– dirkt
Jan 6 at 16:50




First guess is ESC-x customize-variable tab-width, second guess is (set-variable 'tab-width 2) in some generic hook, but I'm no emacs expert. Try emacs.stackexchange.com
– dirkt
Jan 6 at 16:50















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415074%2fsingular-way-to-set-tab-width-in-emacs%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415074%2fsingular-way-to-set-tab-width-in-emacs%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)