Skip to content

Use define-keymap instead of obsolete easy-mmode-define-keymap#359

Merged
mmaechler merged 1 commit intopolymode:masterfrom
catern:master
Mar 2, 2026
Merged

Use define-keymap instead of obsolete easy-mmode-define-keymap#359
mmaechler merged 1 commit intopolymode:masterfrom
catern:master

Conversation

@catern
Copy link
Copy Markdown
Contributor

@catern catern commented Sep 24, 2025

Fixes byte-compiler warning:

Warning: easy-mmode-define-keymap' is an obsolete function (as of 29.1); use define-keymap' instead.

(Untested)

@mmaechler mmaechler merged commit 4604f55 into polymode:master Mar 2, 2026
@marienz
Copy link
Copy Markdown

marienz commented Mar 3, 2026

I think this may not be quite right: easy-mmode-define-keymap's first argument is "a list of (KEY . BINDING)", while define-keymap takes &rest [KEY DEFINITION]... (pairs of arguments).

I'm seeing the following backtrace loading poly-R (which looks very similar to the one in CI, https://github.com/polymode/polymode/actions/runs/22572395051/job/65383256811#step:10:61):

Debugger entered--Lisp error: (error "Uneven number of key/definition pairs")
  error("Uneven number of key/definition pairs")
  define-keymap(:parent (keymap (menu-bar keymap (polymode menu-item "Polymode" (keymap "Polymode" (Next\ chunk menu-item "Next chunk" polymode-next-chunk) (Previous\ chunk menu-item "Previous chunk" polymode-previous-chunk) (Next\ chunk\ same\ type menu-item "Next chunk same type" polymode-next-chunk-same-type) (Previous\ chunk\ same\ type menu-item "Previous chunk same type" polymode-previous-chunk-same-type) (Mark\ or\ extend\ chunk menu-item "Mark or extend chunk" polymode-mark-or-extend-chunk) (Kill\ chunk menu-item "Kill chunk" polymode-kill-chunk) (nil "--") (Weave menu-item "Weave" polymode-weave) (Set\ Weaver menu-item "Set Weaver" polymode-set-weaver) (nil-9 "--") (Export menu-item "Export" polymode-export) (Set\ Exporter menu-item "Set Exporter" polymode-set-exporter)))) (27 keymap (110 . polymode-map))) ("<" . poly-noweb-electric-<))
  apply(define-keymap :parent (keymap (menu-bar keymap (polymode menu-item "Polymode" (keymap "Polymode" (Next\ chunk menu-item "Next chunk" polymode-next-chunk) (Previous\ chunk menu-item "Previous chunk" polymode-previous-chunk) (Next\ chunk\ same\ type menu-item "Next chunk same type" polymode-next-chunk-same-type) (Previous\ chunk\ same\ type menu-item "Previous chunk same type" polymode-previous-chunk-same-type) (Mark\ or\ extend\ chunk menu-item "Mark or extend chunk" polymode-mark-or-extend-chunk) (Kill\ chunk menu-item "Kill chunk" polymode-kill-chunk) (nil "--") (Weave menu-item "Weave" polymode-weave) (Set\ Weaver menu-item "Set Weaver" polymode-set-weaver) (nil-9 "--") (Export menu-item "Export" polymode-export) (Set\ Exporter menu-item "Set Exporter" polymode-set-exporter)))) (27 keymap (110 . polymode-map))) ("<" . poly-noweb-electric-<))
  byte-code("\301\302!\210\303\304\305\306\"\211\205\17\0\211J\307\300!\210\310\300\311\300!\203\37\0\303\202Z\0\312\303!?\205Z\0\312\303!?\205Q\0\313\305J!\203C\0\314\303\305J\"\315\1@B\262\6A\202Q\0\316\3\317\"\320\321\2!\322P!\262\1J\323\324\325\3\6\11$\262\1\326#\210\307\327!\210\310\327\311\327!\203m\0\303\202\217\0\3\203\202\0\330\3\331\332\317\302\333\334\335\336\337\340&\13\202\217\0\341\331\332\317\302\333\334\335\336\337\340&\n\342#\210\343\302\344\"\210\345\302\346\10#\266\3\207" [poly-noweb-mode-map make-variable-buffer-local poly-noweb-mode nil pm--config-name poly-latex-root-polymode must-exist makunbound defvar-1 boundp keymapp eieio-object-p pm--get-keylist.keymap-from-parent ("<" . poly-noweb-electric-<) eieio-oref -minor-mode intern symbol-name "-map" apply define-keymap :parent ("/tmp/dld/straight/build-30.2/poly-noweb/poly-noweb.elc" . 4593) poly-noweb-polymode clone :name "poly-noweb-polymode" :exporters (poly-noweb-latexmk-exporter poly-noweb-pdflatex-exporter poly-noweb-lualatex-exporter poly-noweb-xelatex-exporter) :innermodes (poly-noweb-auto-innermode poly-noweb-inline-innermode) :hostmode poly-noweb-latex-hostmode pm-polymode ("/tmp/dld/straight/build-30.2/poly-noweb/poly-noweb.elc" . 4626) defalias #f(compiled-function (&optional arg) "Polymode for noweb.\n\n\\{poly-noweb-mode-map}" (interactive nil) #<bytecode 0xcd21395033febbb>) add-minor-mode " PM"] 17)
  require(poly-noweb)
  load-with-code-conversion("/tmp/dld/straight/build-30.2/poly-R/poly-R.el" "/tmp/dld/straight/build-30.2/poly-R/poly-R.el" nil t)
  require(poly-R)
  eval((require 'poly-R) t)
  #f(compiled-function () #<bytecode -0x8acd46b13fcf53e>)()
  #f(compiled-function () #<bytecode -0x5db3e1955cb81d1>)()
  eval-expression((require 'poly-R) nil nil 127)
  funcall-interactively(eval-expression (require 'poly-R) nil nil 127)
  command-execute(eval-expression)

which I think is caused by https://github.com/polymode/poly-noweb/blob/2074950bafd21f7237bc5eb3f92772a3fa7f0701/poly-noweb.el#L117 getting passed into define-keymap as a single argument (interpreted as a key without a definition).

(...but I haven't fully confirmed this yet and haven't figured out how to run your tests locally yet... I'll try to find time to file a proper bug report and/or PR later)

@mmaechler
Copy link
Copy Markdown
Contributor

Thank you, @marienz . I'm sorry that my merge seems to have been too hasty; I will revert, and hopefully you could suggest the correct change to no longer use easy-mmode-define-keymap , please ?

@marienz
Copy link
Copy Markdown

marienz commented Mar 4, 2026

See #368 for hopefully a better fix (not going to go as far as guaranteeing it's the correct fix: I'm not that familiar with either polymode or keymap handling... It does look poly-noweb works with it, but I can't speak for all other polymodes out there).

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

Successfully merging this pull request may close these issues.

3 participants