Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting custom variables in .dir-local.el #38

Open
evb-gh opened this issue Jun 14, 2021 · 4 comments
Open

Setting custom variables in .dir-local.el #38

evb-gh opened this issue Jun 14, 2021 · 4 comments
Assignees

Comments

@evb-gh
Copy link

evb-gh commented Jun 14, 2021

Trying to set custom variables in the .dir-local.el file instead of init.el or config.el.

Steps:

  1. Create dir test
  2. Initiate test dir with git init
  3. Add remote git url
  4. Create .dir-local.el file
  5. add git-auto-commit-mode custom variables:
((nil . ((eval git-auto-commit-mode 1)
           (gac-automatically-push-p . t)
           (gac-automatically-add-new-files-p . t))))
  1. Create files with text inside

After the steps above I expect all files to be staged and committed to git, but that doesn't happen.

My system: macOS 10.14.6 with default Doom emacs config

@evb-gh
Copy link
Author

evb-gh commented Jun 15, 2021

I also tried:

((nil . ((eval git-auto-commit-mode 1))))
((nil . ((gac-automatically-push-p . t))))
((nil . ((gac-automatically-add-new-files-p . t))))

but got the same result.

@evb-gh evb-gh changed the title Setting custom variables .dir-local.el Setting custom variables in .dir-local.el Jun 15, 2021
@ryuslash ryuslash self-assigned this Jul 1, 2021
@ryuslash
Copy link
Owner

ryuslash commented Jul 1, 2021

Hey! Thanks for reporting this issue. I've tried doing this locally and I think I need some more information.

Your original .dir-locals.el is correct, the second attempt (from your comment) wouldn't work.

  1. When you added the remote git url, did you specify that it is the upstream of your local branch? Because git-auto-commit-mode just tries to do git push wen gac-automatically-push-p is non-nil. If it's not set up correctly, it will just fail.
  2. Do you get any error messages in your *Messages* buffer after you save the file?
  3. Do the files you've created get staged, what's the output of git status after you save and it fails?

@kelvie
Copy link

kelvie commented Aug 14, 2021

I think I may be running in the the same issue, I get this when I try to set the dir-local variable:

Ignoring unsafe file local variable: gac-automatically-push-p [2 times]

@kelvie
Copy link

kelvie commented Aug 14, 2021

Looks like this is a doom-emacs thing -- for other doom users, just add (setq-default enable-local-variables t) to your config.el

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants