diff --git a/markdown-mode.el b/markdown-mode.el index 790b5a24..bc22329d 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -5383,7 +5383,7 @@ Assumes match data is available for `markdown-regex-italic'." (define-key map (kbd "C-c S-") 'markdown-table-insert-column) (define-key map (kbd "C-c C-M-h") 'markdown-mark-subtree) (define-key map (kbd "C-x n s") 'markdown-narrow-to-subtree) - (define-key map (kbd "M-") 'markdown-insert-list-item) + (define-key map (kbd "M-RET") 'markdown-insert-list-item) (define-key map (kbd "C-c C-j") 'markdown-insert-list-item) ;; Paragraphs (Markdown context aware) (define-key map [remap backward-paragraph] 'markdown-backward-paragraph) diff --git a/tests/markdown-test.el b/tests/markdown-test.el index f818b38c..685d7fe0 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -1079,6 +1079,16 @@ Don't adjust spacing if tabs are used as whitespace." (call-interactively 'markdown-insert-list-item) (should (string-equal (buffer-string) "9.\tfoo\n10.\t")))) +(ert-deftest test-markdown-insertion/list-item-bound-keys () + "Test that `markdown-insert-list-item' is bound to M-RET and equivalents." + (markdown-test-string "- foo" + (goto-char (point-max)) + (execute-kbd-macro (read-kbd-macro "M-RET bar C-M-m baz")) + (should (string-equal (buffer-string) "- foo\n- bar\n- baz")) + (when (display-graphic-p) + (execute-kbd-macro (read-kbd-macro "M- quux")) + (should (string-equal (buffer-string) "- foo\n- bar\n- baz\n- quux"))))) + (ert-deftest test-markdown-insertion/nested-list-marker () "Test marker detection for `markdown-insert-list-item'." (markdown-test-string