Thread overview
Emacs d-mode indentation, 2 spaces to 4?
Oct 05, 2017
John Gabriele
Oct 05, 2017
Ali Çehreli
Oct 05, 2017
John Gabriele
Oct 05, 2017
Aravinda VK
Oct 05, 2017
John Gabriele
October 05, 2017
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?

October 04, 2017
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
October 05, 2017
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)))
October 05, 2017
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!

October 05, 2017
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.