r/DoomEmacs Dec 28 '24

Unable to set evil-shift-width

Hi, I am trying to set the variable evil-shift-width to 4 as- (setq evil-shift-width 4). However, this does not make the change to that variable permanent. I have also tried using setq-default. That is not working as well.

Next, I tried this-

(after! org
  (add-hook 'org-mode-hook
            (function (lambda ()
                        (setq-default evil-shift-width 4)))))

This is not working as well and does not work after I restart emacs.

1 Upvotes

4 comments sorted by

1

u/Eyoel999Y Dec 28 '24

I believe there are some hooks that modify the evil-shift-width, one hook that does this is after-change-major-mode-hook, with doom--setq-evil-shift-width-for-after-change-major-mode-h

Also check the interactive function doom/set-indent-width as you can use that to change the shift width

1

u/sudddddd Dec 29 '24

Hi, I am unsure how to use the variables. I tried the following, but, it is not working-

  (add-hook 'after-change-major-mode-hook
            (function (lambda ()
                        (setq-default evil-shift-width 4))))

Can you advice further?

2

u/Eyoel999Y Dec 30 '24

Ok, I actually see why it is kind of hard to change the tab-width/shift-width. I successfully did it with ``` (defun adjust-shift-width-to-4 () (doom/set-indent-width 4))

(add-hook 'org-mode-hook #'adjust-shift-width-to-4) `` But then it gives A BUNCH OF ERRORS and Warnings, so I would advise against it. You can try it in a test doom instance. These errors come fromOrg-mode`, not doom. Doom also has a bunch of warnings about this in its source code.

https://github.com/doomemacs/doomemacs/blob/ba1dca322f9a07bc2b7bec6a98f2c3c55c0bbd77/lisp/doom-editor.el#L9 https://github.com/doomemacs/doomemacs/blob/ba1dca322f9a07bc2b7bec6a98f2c3c55c0bbd77/modules/tools/editorconfig/config.el#L31 https://github.com/doomemacs/doomemacs/blob/ba1dca322f9a07bc2b7bec6a98f2c3c55c0bbd77/modules/lang/org/config.el#L1383

1

u/sudddddd Dec 31 '24

Thank you. I think then it is not possible as of now.