1

I'm using dir-locals-set-class-variables in my git directories to apply whitespace-mode settings differently, based on the needs of each repo. if my sf directory, for all subfolders, I want to use tabs for spacing. But for markdown files inside those directories, I want to continue to use spaces instead of tabs.

Is there a way to apply an even more granular override so that in directories where I'm applying this setting:

(dir-locals-set-class-variables 'sf
                                '((nil . ((whitespace-style . (empty
                                                               face
                                                               indentation empty
                                                               lines-tail
                                                               space-after-tab
                                                               space-before-tab
                                                               trailing))
                                          (indent-tabs-mode . t)
                                          (tab-width . 4)
                                          (tab-stop-list . (number-sequence 4 200 4))
                                          ;; (indent-line-function . 'insert-spaces)
                                          (sgml-basic-offset . 4)))))

that I could then have markdown files to use spaces versus tabs?

1

You wouldn't typically perform overrides to the default (nil) case on a per file type basis, but on a per major mode basis (and in your case the latter is most likely what you want, assuming you have a markdown-mode installed to handle markdown files).

(dir-locals-set-class-variables
 'sf
 '((nil . ((whitespace-style . (empty
                                face
                                indentation empty
                                lines-tail
                                space-after-tab
                                space-before-tab
                                trailing))
           (indent-tabs-mode . t)
           (tab-width . 4)
           (tab-stop-list . (number-sequence 4 200 4))
           ;; (indent-line-function . 'insert-spaces)
           (sgml-basic-offset . 4)))
   (markdown-mode . ((indent-tabs-mode . nil)))))

For more information, refer to:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.