Is there a possibility to set a specific color theme or just to hook on a specific project to run custom elisp?
So the idea is to automatically set a color theme or background-color when I open a file from a specific project (path)? E.g. I can work with multiple projects in different frames and instantly know where I am. May be this can written in .projectile file somehow ?
Here by frame I mean Frame not just a buffer.
You can't do this as of now but there is a discussion going on here for something similar in the
Projectile issue list. However you can use a .dir-locals.el
file to get this done. I am guessing something similar would be implemented for projectile using .projectile
file in the future once the devs decide upon it.
dir-locals.el
is intended to set local variables for all files in that particular directory you could checkout the docs or this blog post for the details. It's not particularly designed to run elisp code (setting a theme is a load-theme function call I believe) for good reason. However you can use eval variable to work around this and emacs will ask you whether to run the code.
((nil . ((eval . (load-theme 'molokai
)
))))
or you could do something even fancier according to the major modes.
((nil . ((indent-tabs-mode . t)
(tab-width . 4)
(fill-column . 80)))
;; Warn about spaces used for indentation:
(haskell-mode . ((eval . (highlight-regexp "^ *"))))
(c-mode . ((c-file-style . "BSD")))
(java-mode . ((c-file-style . "BSD")))
("src/imported"
. ((nil . ((change-log-default-name . "ChangeLog.local"))))))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With