I know it is possible to set local variables for a mode through dir-locals.el. But what could I do if I want to run a command such as:

(shell-command "sass --watch style.sass "static/css/style.css")

or activating a virtual env using:

(pyvenv-activate "env/")

  • MrPapouille@alien.topOPB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Thank you, I will take a look at direnv. The idea is to run the command once indeed. I know there is hooks when switching project, but how to use them here is out of my knowledge.

    • rtpg@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      One thing I found is that projectile-switch-project-action is the action invoked after switching to a project. This defaults to projectile-file-file, but you might be able to make a function that spawns the process (if it doesn’t exist already of course) and then call projectile-find-file.

      (figured this out by scrolling through projectile.el and looking for switch-project)

      • MrPapouille@alien.topOPB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I posted this question on Doom emacs #help 's discord, and someone suggested to use: projectile-after-switch-project-hook
        I’m not sure if I can place it inside my dir-locals.el, that hook could be evaluated before reading dir-locals and if I’m correct nothing would happen so.
        Anyway, those are good starting points, I will take a look and if I find a solution, come back here to let you know.