www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Emacs d-mode indentation, 2 spaces to 4?

reply John Gabriele <jgabriele fastmail.fm> writes:
I'm using Emacs 25.2.2 with d-mode-20161022.717 on Debian 
Testing, and by default this mode indents by 2 spaces. Is there 
an easy way to configure it to use 4 spaces instead?
Oct 04
next sibling parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 10/04/2017 09:57 PM, John Gabriele wrote:
 I'm using Emacs 25.2.2 with d-mode-20161022.717 on Debian Testing, and 
 by default this mode indents by 2 spaces. Is there an easy way to 
 configure it to use 4 spaces instead?
 
I can't imagine it has its own tab width. d-mode is based on cc-mode. Setting the tab width in that mode or in general should work for d-mode as well. Just research tab width for Emacs. If nothing else works and you're happy with a global tab-width of 4, add this to your .emacs file: (setq-default tab-width 4) Ali
Oct 04
parent John Gabriele <jgabriele fastmail.fm> writes:
On Thursday, 5 October 2017 at 05:22:16 UTC, Ali Çehreli wrote:
 On 10/04/2017 09:57 PM, John Gabriele wrote:
 I'm using Emacs 25.2.2 with d-mode-20161022.717 on Debian 
 Testing, and by default this mode indents by 2 spaces. Is 
 there an easy way to configure it to use 4 spaces instead?
 
I can't imagine it has its own tab width. d-mode is based on cc-mode. Setting the tab width in that mode or in general should work for d-mode as well. Just research tab width for Emacs. If nothing else works and you're happy with a global tab-width of 4, add this to your .emacs file: (setq-default tab-width 4) Ali
Thank you, but tried this and it didn't work. Aravinda's solution worked though.
Oct 05
prev sibling parent reply Aravinda VK <mail aravindavk.in> writes:
On Thursday, 5 October 2017 at 04:57:09 UTC, John Gabriele wrote:
 I'm using Emacs 25.2.2 with d-mode-20161022.717 on Debian 
 Testing, and by default this mode indents by 2 spaces. Is there 
 an easy way to configure it to use 4 spaces instead?
Add below snippet to your .emacs file (add-hook 'd-mode-hook (lambda () (setq c-basic-offset 4) (setq tab-width 4)))
Oct 05
parent John Gabriele <jgabriele fastmail.fm> writes:
On Thursday, 5 October 2017 at 08:49:30 UTC, Aravinda VK wrote:
 On Thursday, 5 October 2017 at 04:57:09 UTC, John Gabriele 
 wrote:
 I'm using Emacs 25.2.2 with d-mode-20161022.717 on Debian 
 Testing, and by default this mode indents by 2 spaces. Is 
 there an easy way to configure it to use 4 spaces instead?
Add below snippet to your .emacs file (add-hook 'd-mode-hook (lambda () (setq c-basic-offset 4) (setq tab-width 4)))
That did it! Thanks, Aravinda!
Oct 05