gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
383 stars 35 forks source link

error: (wrong-type-argument listp evil-mc-make-all-cursors) on load #106

Closed hlissner closed 4 years ago

hlissner commented 4 years ago

Getting this error when loading evil-mc due to the incorrectly structured value for evil-mc-cursors-map introduced in https://github.com/gabesoft/evil-mc/commit/6e3a42e656e32ab2f87f04c5a47fe7f2a22b26fa (#100).

Debugger entered--Lisp error: (wrong-type-argument listp evil-mc-make-all-cursors)
  (let ((map (make-sparse-keymap)) ("m" . evil-mc-make-all-cursors) ("u" . evil-mc-undo-last-added-cursor) ("q" . evil-mc-undo-all-cursors) ("s" . evil-mc-pause-cursors) ("r" . evil-mc-resume-cursors) ("f" . evil-mc-make-and-goto-first-cursor) ("l" . evil-mc-make-and-goto-last-cursor) ("h" . evil-mc-make-cursor-here) ("j" . evil-mc-make-cursor-move-next-line) ("k" . evil-mc-make-cursor-move-prev-line) ("N" . evil-mc-skip-and-goto-next-cursor) ("P" . evil-mc-skip-and-goto-prev-cursor) ("n" . evil-mc-skip-and-goto-next-match) ("p" . evil-mc-skip-and-goto-prev-match) ("I" . evil-mc-make-cursor-in-visual-selection-beg) ("A" . evil-mc-make-cursor-in-visual-selection-end)))
  (defvar evil-mc-cursors-map (let ((map (make-sparse-keymap)) ("m" . evil-mc-make-all-cursors) ("u" . evil-mc-undo-last-added-cursor) ("q" . evil-mc-undo-all-cursors) ("s" . evil-mc-pause-cursors) ("r" . evil-mc-resume-cursors) ("f" . evil-mc-make-and-goto-first-cursor) ("l" . evil-mc-make-and-goto-last-cursor) ("h" . evil-mc-make-cursor-here) ("j" . evil-mc-make-cursor-move-next-line) ("k" . evil-mc-make-cursor-move-prev-line) ("N" . evil-mc-skip-and-goto-next-cursor) ("P" . evil-mc-skip-and-goto-prev-cursor) ("n" . evil-mc-skip-and-goto-next-match) ("p" . evil-mc-skip-and-goto-prev-match) ("I" . evil-mc-make-cursor-in-visual-selection-beg) ("A" . evil-mc-make-cursor-in-visual-selection-end))))
  eval-buffer(#<buffer  *load*> nil "/home/hlissner/.emacs.d/.local/straight/build/evil-mc/evil-mc.el" nil t)  ; Reading at buffer position 3218
  load-with-code-conversion("/home/hlissner/.emacs.d/.local/straight/build/evil-mc/evil-mc.el" "/home/hlissner/.emacs.d/.local/straight/build/evil-mc/evil-mc.el" nil t)
  require(evil-mc)
  eval((require (quote evil-mc)) nil)
  pp-eval-expression((require (quote evil-mc)))
  funcall-interactively(pp-eval-expression (require (quote evil-mc)))
  call-interactively(pp-eval-expression nil nil)
  command-execute(pp-eval-expression)

A note for Doom Emacs users: add (defvar evil-mc-cursors-map nil) to your private config to temporarily fix the issue. Doom binds these keys manually (on the gz prefix, rather than gr), so there will be no loss of functionality.

duianto commented 4 years ago

A temporary fix in Spacemacs is to add evil-mc to the dotspacemacs-excluded-packages variable in .spacemacs.

Adding hilssner's suggestion:

(defvar evil-mc-cursors-map nil)

to the dotspacemacs/user-init section of .spacemacs also removes the startup warning. But the gr evil-mc key bindings won't work.

duianto commented 4 years ago

The commit was just reverted: Revert "Use a keymap (#100)" (#107) https://github.com/gabesoft/evil-mc/commit/007d471e26b44e692250804f82f06ebbd27b6ec4

duianto commented 4 years ago

Melpa has updated the evil-mc version now. I just updated and the warning is gone.

hlissner commented 4 years ago

The issue is resolved. Thanks for the quick response and the amazing plugin!