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

Args out of range #1274

Closed
nomicode opened this issue Mar 15, 2014 · 3 comments
Closed

Args out of range #1274

nomicode opened this issue Mar 15, 2014 · 3 comments
Labels
support User needs some help
Milestone

Comments

@nomicode
Copy link

I installed magit today. I've not used it yet, not configured it.

I have a Makefile in Git directory that calls this:

emacs --batch -l config.el -f org-publish-all

For some reason, this fails with:

Args out of range: #("Git@" 0 4 (help-echo "Locally added file under the Git version control system")), 0, 7

Again, I'm not using magit for anything. It's not mentioned in config.el. All I've done is install with with MELPA.

Strangely enough, when I run that command from the CLI, it works fine!

Output of which emacsclient:

/usr/local/bin/emacsclient

This looks legit to me.

@nomicode
Copy link
Author

Done a bit more debugging. I had these lines in my Makefile:

export GIT_WORK_TREE = $(BASEDIR)
export GIT_DIR = $(GIT_WORK_TREE)/.git

If I uncomment them, the command works fine.

Why is this? I'm not doing anything with Git. Is magit's existence on my load path causing it to somehow try to execute something when it finds those variables?

And why don't they work? They work for the Git commands that follow the Emacs one.

@tarsius tarsius added this to the support/later/needinfo/... milestone Mar 15, 2014
@tarsius
Copy link
Member

tarsius commented Mar 15, 2014

Greping the Emacs source indicates that the error is causes by vc-mode-line. Calling Emacs with --debug-init might tell you more about it. So it appears it is not Magit but VC that is having problems. Try adding --eval "(setq vc-handled-backends nil)" as an early argument to Emacs in the Makefile. That might be enough to work around this issue.

I think that the problem is that vc does something that expects to be in the worktree while the default-directory is actually /path/to/.git/. By setting GIT_WORK_TREE that is fixed, so that's why it works in that case. By the way that wouldn't work for Magit, as it ignores that variable.

I would argue that having a Makefile in .git is a mistake in the first place. Move it into the working directory. And if you don't want to track it then add an entry to .gitignore.

@tarsius tarsius closed this as completed Mar 17, 2014
@tarsius tarsius modified the milestones: 2.1.0, support/later/needinfo/... Mar 17, 2014
@flajann2
Copy link

Adding:

(setq vc-handled-backends nil)

To .emacs fixed this long-annoying problem for me. Thanks.

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

No branches or pull requests

3 participants