Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Symbol's value as variable is void: binding #9

Closed
cohomology opened this issue Dec 8, 2015 · 17 comments
Closed

Symbol's value as variable is void: binding #9

cohomology opened this issue Dec 8, 2015 · 17 comments

Comments

@cohomology
Copy link

Bugus commit: d45808c

After updating to the above mentioned commit, I can not start emacs anymore. Even --debug-init does not help.

As this hits all melpa users, and it is unknown so far, why you are not affected by this, I suggest reverting melpa to a previous state.

The error message from emacs is given in the title of this issue report.

If you can't reproduce this with your .emacs.d, you can do:

git clone https://github.com/cohomology/.emacs.d .emacs.d
cd .emacs.d
git submodule update --init --recursive
cd third-party/evil-magit
git pull

(After the version from melpa doesn't seem to work anymore, I stopped using evil-magit from melpa and took an old version as a git submodule in my .emacs.d).

Best regards,
Kilian.

@justbur
Copy link
Member

justbur commented Dec 8, 2015

It looks like a error with the compiler that didn't show up in my version of emacs. I'm pushing a fix now, but you can probably delete evil-magit.elc for a quick workaround

justbur added a commit that referenced this issue Dec 8, 2015
@justbur
Copy link
Member

justbur commented Dec 8, 2015

ok, I just pushed what I think should fix this. Sorry for the mistake and thanks for the report

@jschaf
Copy link

jschaf commented Dec 9, 2015

That commit just broke it for me. Reverting the commit fixes the issue.

Debugger entered--Lisp error: (void-function keymap)

I'm pretty sure the issue is you're not quoting STATE or DEF and you're passing an already expanded keymap. So the eval is seeing:

(evil-define-key normal [RAW KEYMAP DEFINITION] "k" evil-previous-visual-line)

instead of:

(evil-define-key 'normal magit-blame-mode-map "k" 'evil-previous-visual-line)

This code seems to work, I added a quote to (nth 0 binding) and (nth 3 binding) and removed the symbol-value call.

(dolist (binding evil-magit-mode-map-bindings)
    (eval
     `(evil-define-key ',(nth 0 binding) ,(nth 1 binding)
        ,(nth 2 binding) ',(nth 3 binding))))

Additionally, The selectively evaling and quoting forms seems very suspect. Are you sure the original version was causing the error?

@cohomology
Copy link
Author

This bug is certainly no optimizer issue, as I do not compile evil-magit. Consequently, there are no .elc files. After your patch, I get the same error as @jschaf. I use emacs 24.5.1.

Please revert melpa to 7c9f633, which is the last working commit.

@justbur
Copy link
Member

justbur commented Dec 9, 2015

@cohomology It's reverted

@jschaf

I'm pretty sure the issue is you're not quoting STATE or DEF and you're passing an already expanded keymap. So the eval is seeing:

Right, so much for a quick fix

Additionally, The selectively evaling and quoting forms seems very suspect. Are you sure the original version was causing the error?

Agreed. I'll set this up differently

Sorry for the trouble @jschaf and @cohomology. There must have been something wrong with my environment that wasn't showing the error on my side. I do compile the files. It was probably a stupid mistake somewhere.

@justbur
Copy link
Member

justbur commented Dec 9, 2015

@cohomology I rewrote the logic for setting the main keys and pushed to the new-define-key branch. Before I merge this, would you be able to test the changes on your side to see if it fixes the original issue? FYI this branch also includes all of the other stuff I have done recently (setting up a test environment for example).

@cohomology
Copy link
Author

@justbur I now get a (Wrong-type-argument keymapp nil) inside evil-magit-define-key.

@justbur
Copy link
Member

justbur commented Dec 9, 2015

Is that on the new branch?
On Wed, Dec 9, 2015 at 7:21 AM Kilian Kilger notifications@github.com
wrote:

@justbur https://github.com/justbur I now get a (Wrong-type-argument
keymapp nil) inside evil-magit-define-key.


Reply to this email directly or view it on GitHub
#9 (comment).

@justbur
Copy link
Member

justbur commented Dec 9, 2015

@cohomology oh right it must be. That is probably the root cause of the original issue, because it would have triggered evil-define-key to delay the setting of the key. Can you provide a backtrace from that error? Are you up to date with magit?

@justbur
Copy link
Member

justbur commented Dec 9, 2015

@cohomology I'm confident that the new branch is correct now. I added a check for an uninitialized keymap, which I believe is the cause of the problem you were having. When you use the new branch with the latest commit, I believe you will see a message about a keymap that is not bound. That should help track down the problem.

@cohomology
Copy link
Author

As you suspected, I now get the following in my messages window:

evil-magit: Error the keymap nil is not bound. Note that evil-magit assumes 
you have the latest version of magit.

What to do now? There is no debugger opening via --debug-init.
I have Magit 20151208.744 from Melpa unstable (from yesterday!).
Kilian.

@justbur
Copy link
Member

justbur commented Dec 9, 2015

@cohomology well the nil was unexpected actually :-). Can you paste the value you get from C-h v evil-magit-mode-map-bindings RET?

@justbur
Copy link
Member

justbur commented Dec 9, 2015

Nevermind. I see the problem. You probably don't use C-u for scrolling. The latest commit should handle this. That was dumb on my part

@cohomology
Copy link
Author

((motion magit-mode-map "g")
 (motion magit-mode-map "\n" magit-section-forward "n")
 (motion magit-mode-map "gj" magit-section-forward-sibling "\356")
 (motion magit-mode-map "]" magit-section-forward-sibling "\356")
 (motion magit-mode-map "�" magit-section-backward "p")
 (motion magit-mode-map "gk" magit-section-backward-sibling "\360")
 (motion magit-mode-map "[" magit-section-backward-sibling "\360")
 (motion magit-mode-map "gr" magit-refresh "g")
 (motion magit-mode-map "gR" magit-refresh-all "G")
 (motion magit-mode-map "x" magit-delete-thing "k")
 (motion magit-mode-map "X" magit-file-untrack "K")
 (motion magit-mode-map "o" magit-revert-no-commit "v")
 (motion magit-mode-map "O" magit-revert-popup "V")
 (motion magit-mode-map "�" magit-reset "x")
 (motion magit-mode-map "|" magit-git-command ":")
 (motion magit-mode-map ">" magit-submodule-popup "o")
 (motion magit-mode-map "j" evil-next-visual-line)
 (motion magit-mode-map "k" evil-previous-visual-line)
 (motion magit-mode-map "v" set-mark-command)
 (motion magit-mode-map "V" set-mark-command)
 (motion magit-mode-map "gg" evil-goto-first-line)
 (motion magit-mode-map "G" evil-goto-line)
 (motion magit-mode-map "�" evil-scroll-down)
 (motion magit-mode-map "�" evil-scroll-page-down)
 (motion magit-mode-map "�" evil-scroll-page-up)
 (motion magit-mode-map ":" evil-ex)
 (motion magit-mode-map "/" evil-search-forward)
 (motion magit-mode-map "n" evil-search-next)
 (motion magit-mode-map "N" evil-search-previous)
 nil
 (motion magit-mode-map "�" evil-emacs-state)
 (motion magit-mode-map
         [escape]
evil-magit-maybe-deactivate-mark)
 (motion magit-status-mode-map "gz" magit-jump-to-stashes "jz")
 (motion magit-status-mode-map "gt" magit-jump-to-tracked "jt")
 (motion magit-status-mode-map "gn" magit-jump-to-untracked "jn")
 (motion magit-status-mode-map "gu" magit-jump-to-unstaged "ju")
 (motion magit-status-mode-map "gs" magit-jump-to-staged "js")
 (motion magit-status-mode-map "gfu" magit-jump-to-unpulled-from-upstream "jfu")
 (motion magit-status-mode-map "gfp" magit-jump-to-unpulled-from-pushremote "jfp")
 (motion magit-status-mode-map "gpu" magit-jump-to-unpushed-to-upstream "jpu")
 (motion magit-status-mode-map "gpp" magit-jump-to-unpushed-to-pushremote "jpp")
 (motion magit-blob-mode-map "gj" magit-blob-next "n")
 (motion magit-blob-mode-map "gk" magit-blob-previous "p")
 (motion magit-diff-mode-map "gj" magit-section-forward)
 (motion magit-diff-mode-map "gd" magit-jump-to-diffstat-or-diff "j")
 (normal magit-blame-mode-map "j" evil-next-visual-line)
 (normal magit-blame-mode-map "\n" magit-blame-next-chunk "n")
 (normal magit-blame-mode-map "gj" magit-blame-next-chunk "n")
 (normal magit-blame-mode-map "gJ" magit-blame-next-chunk-same-commit "N")
 (normal magit-blame-mode-map "k" evil-previous-visual-line)
 (normal magit-blame-mode-map "�" magit-blame-previous-chunk "p")
 (normal magit-blame-mode-map "gk" magit-blame-previous-chunk "p")
 (normal magit-blame-mode-map "gK" magit-blame-previous-chunk-same-commit "P")
 (motion git-commit-mode-map "gk" git-commit-prev-message "\360")
 (motion git-commit-mode-map "gj" git-commit-next-message "\356"))

@justbur
Copy link
Member

justbur commented Dec 9, 2015

Yep, that's it. Everything should work for you now on that branch. I appreciate the quick responses. Thank you

@cohomology
Copy link
Author

Yeah, it works now.

@justbur
Copy link
Member

justbur commented Dec 9, 2015

Great. I'm going to merge then.

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

No branches or pull requests

3 participants