branch: elpa/markdown-mode
commit 819ab2a212508062edfd57e0c2d5ab3ffe8feda6
Merge: 5bebb44f7f 7659bc470d
Author: Joe Reinhart <[email protected]>
Commit: Joe Reinhart <[email protected]>
Merge branch 'master' into jayemar/toggle-hiding-of-wiki-links
---
CHANGES.md | 6 ++++++
README.md | 3 +++
markdown-mode.el | 14 +++++++++++++-
tests/markdown-test.el | 43 +++++++++++++++++++++++++++++++++++++++----
4 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 55e63f647d..58748f5ace 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -14,6 +14,7 @@
- Trailing whitespace characters for line breaks are hidden when using
`markdown-hide-markup`
- `fill-paragraph` considers GFM alert syntax [GH-838][]
+ - Add new flag `markdown-wiki-link-retain-case` [GH-839][]
* Bug fixes:
- Don't highlight superscript/subscript in math inline/block [GH-802][]
@@ -22,6 +23,7 @@
- Don't hide backslashes in code blocks when using `markdown-hide-markup`
and `markdown-fontify-code-blocks-natively` together [GH-766][]
- Fix `markdown-fontify-whole-heading-line` regression [GH-848][]
+ - Fix using fundamental-mode issue when editting code block [GH-868][]
* Improvements:
- Apply url-unescape against URL in an inline link [GH-805][]
@@ -31,6 +33,7 @@
- Mark `markdown-css-paths` safe as file local variables [GH-834][]
- Resolve style sheets in `markdown-css-paths` relative to the Markdown
file
(if the path starts with `./` or `../`) [GH-855][] [GH-870][]
+ - Don't insert list item in code block [GH-841][]
[gh-780]: https://github.com/jrblevin/markdown-mode/issues/780
[gh-802]: https://github.com/jrblevin/markdown-mode/issues/802
@@ -40,9 +43,12 @@
[gh-827]: https://github.com/jrblevin/markdown-mode/issues/827
[gh-834]: https://github.com/jrblevin/markdown-mode/issues/834
[gh-838]: https://github.com/jrblevin/markdown-mode/issues/838
+ [gh-839]: https://github.com/jrblevin/markdown-mode/issues/839
+ [gh-841]: https://github.com/jrblevin/markdown-mode/issues/841
[gh-845]: https://github.com/jrblevin/markdown-mode/issues/845
[gh-848]: https://github.com/jrblevin/markdown-mode/issues/848
[gh-855]: https://github.com/jrblevin/markdown-mode/issues/855
+ [gh-868]: https://github.com/jrblevin/markdown-mode/issues/868
[gh-870]: https://github.com/jrblevin/markdown-mode/issues/870
# Markdown Mode 2.6
diff --git a/README.md b/README.md
index b6bd29823a..62b5c3d306 100644
--- a/README.md
+++ b/README.md
@@ -772,6 +772,9 @@ provides an interface to all of the possible customizations:
(default: `t`). When set to nil, they will be treated as
`[[PageName|link text]]`.
+ * `markdown-wiki-link-retain-case nil` - set a non-nil value not to
+ change wiki link file name case
+
* `markdown-uri-types` - a list of protocol schemes (e.g., "http")
for URIs that `markdown-mode` should highlight.
diff --git a/markdown-mode.el b/markdown-mode.el
index a7c36b1276..e9dd0c43e6 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -287,6 +287,13 @@ cause lag when typing on slower machines."
:safe 'booleanp
:package-version '(markdown-mode . "2.2"))
+(defcustom markdown-wiki-link-retain-case nil
+ "When non-nil, wiki link file names do not have their case changed."
+ :group 'markdown
+ :type 'boolean
+ :safe 'booleanp
+ :package-version '(markdown-mode . "2.7"))
+
(defcustom markdown-uri-types
'("acap" "cid" "data" "dav" "fax" "file" "ftp"
"geo" "gopher" "http" "https" "imap" "ldap" "mailto"
@@ -5165,6 +5172,7 @@ list simply adds a blank line)."
(markdown-indent-on-enter
(let (bounds)
(if (and (memq markdown-indent-on-enter '(indent-and-new-item))
+ (not (markdown-code-block-at-point-p))
(setq bounds (markdown-cur-list-item-bounds)))
(let ((beg (cl-first bounds))
(end (cl-second bounds))
@@ -8425,7 +8433,7 @@ and [[test test]] both map to Test-test.ext."
;; This function must not overwrite match data(PR #590)
(let* ((basename (replace-regexp-in-string
"[[:space:]\n]" markdown-link-space-sub-char name))
- (basename (if (derived-mode-p 'gfm-mode)
+ (basename (if (and (derived-mode-p 'gfm-mode) (not
markdown-wiki-link-retain-case))
(concat (upcase (substring basename 0 1))
(downcase (substring basename 1 nil)))
basename))
@@ -9041,6 +9049,10 @@ LANG is a string, and the returned major mode is a
symbol."
(and mode
(fboundp mode)
(or
+ (not (string-match-p "ts-mode\\'" (symbol-name mode)))
+ ;; Don't load tree-sitter mode if the mode is in neither
auto-mode-alist nor major-mode-remap-alist
+ ;; Because some ts-mode overwrites auto-mode-alist and it might break
user configurations
+
;; https://github.com/jrblevin/markdown-mode/issues/787
;; major-mode-remap-alist was introduced at Emacs 29.1
(cl-loop for pair in (bound-and-true-p major-mode-remap-alist)
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 5b0c825388..6f3703538f 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -2109,6 +2109,17 @@ See GH-245."
(should (string-equal (buffer-string) " - [X] item\n\n"))
(should (= (point) 18)))))
+(ert-deftest test-markdown-indentation/not-insert-list-item-in-code-block ()
+ "Don't insert new item if here is in code."
+ (let ((markdown-indent-on-enter 'indent-and-new-item))
+ (markdown-test-string "```
+ - foo
+```"
+ (forward-line)
+ (end-of-line)
+ (call-interactively #'markdown-enter-key)
+ (should-not (looking-back "- ")))))
+
;;; Markup hiding tests:
(ert-deftest test-markdown-markup-hiding/italics-1 ()
@@ -4379,12 +4390,17 @@ x: x
(ert-deftest test-markdown-parsing/get-lang-mode ()
"Test `markdown-get-lang-mode'.
-Do not load major-mode function if it isn't in auto-mode-alist.
-Details: https://github.com/jrblevin/markdown-mode/issues/761"
+Do not load tree-sitter-mode function if it is in neither auto-mode-alist nor
major-mode-remap-alist.
+Details:
+- https://github.com/jrblevin/markdown-mode/issues/761
+- https://github.com/jrblevin/markdown-mode/issues/868"
(should (eq (markdown-get-lang-mode "emacs-lisp") 'emacs-lisp-mode))
- (let ((auto-mode-alist nil))
- (should (null (markdown-get-lang-mode "emacs-lisp")))))
+ (when (and (fboundp 'treesit-language-available-p)
+ (funcall 'treesit-language-available-p 'python))
+ (let ((auto-mode-alist nil)
+ (major-mode-remap-alist nil))
+ (should (null (markdown--lang-mode-predicate 'python-ts-mode))))))
(ert-deftest test-markdown-parsing/get-lang-mode-from-remap-alist ()
"Test `markdown-get-lang-mode' from major-mode-remap-alist.
@@ -7113,6 +7129,25 @@ Detail:
https://github.com/jrblevin/markdown-mode/pull/590"
(should (string= (expand-file-name link) expected))))
(kill-buffer)))))
+(ert-deftest test-markdown-ext/wiki-link-retain-case ()
+ "Test that searching link under project root."
+ (let ((markdown-wiki-link-retain-case nil))
+ (find-file "wiki/pr666/jump_wiki_link.md")
+ (unwind-protect
+ (progn
+ (gfm-mode)
+ (let ((link-file-name (markdown-convert-wiki-link-to-filename
"FOOBAR")))
+ (should (string= "Foobar.md" (file-name-nondirectory
link-file-name)))))
+ (kill-buffer)))
+ (let ((markdown-wiki-link-retain-case t))
+ (find-file "wiki/pr666/jump_wiki_link.md")
+ (unwind-protect
+ (progn
+ (gfm-mode)
+ (let ((link-file-name (markdown-convert-wiki-link-to-filename
"FOOBAR")))
+ (should (string= "FOOBAR.md" (file-name-nondirectory
link-file-name)))))
+ (kill-buffer))))
+
(ert-deftest test-markdown/wiki-link-major-mode ()
"Test major-mode of linked page."
(let ((markdown-enable-wiki-links t)