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

Bind markdown-insert-list-item to M-RET rather than M-<return> #317

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5383,7 +5383,7 @@ Assumes match data is available for `markdown-regex-italic'."
(define-key map (kbd "C-c S-<right>") '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-<return>") '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)
Expand Down
10 changes: 10 additions & 0 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -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-<return> 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
Expand Down