markdown-mode should have no problem with documents that have many code blocks.
Actual BehaviorWhen viewing a file that has enough code blocks (on the order of 1000), the following error occurs:
File mode specification error: (error Variable binding depth exceeds max-specpdl-size)
This is because markdown-syntax-propertize-pre-blocks
is implemented recursively although there is no reason to assume that the number of loop iterations will be bounded by a reasonable constant.
Open this file. The error occurs.
Backtrace BacktraceDebugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
(= (current-indentation) 0)
(and (= (current-indentation) 0) (not (looking-at markdown-regex-list)) (markdown-prev-line-blank))
(or (looking-at markdown-regex-header) (looking-at markdown-regex-hr) (and (= (current-indentation) 0) (not (looking-at markdown-regex-list)) (markdown-prev-line-blank)))
markdown-new-baseline()
(cond ((markdown-new-baseline) (setq stop t)) ((looking-at-p markdown-regex-list) (setq stop nil)) (t (setq stop t)))
(progn (goto-char (match-end 2)) (cond ((markdown-new-baseline) (setq stop t)) ((looking-at-p markdown-regex-list) (setq stop nil)) (t (setq stop t))))
(if (match-end 2) (progn (goto-char (match-end 2)) (cond ((markdown-new-baseline) (setq stop t)) ((looking-at-p markdown-regex-list) (setq stop nil)) (t (setq stop t)))))
(while (not (or stop (bobp))) (re-search-backward markdown-regex-block-separator-noindent nil t) (if (match-end 2) (progn (goto-char (match-end 2)) (cond ((markdown-new-baseline) (setq stop t)) ((looking-at-p$
(let (stop) (while (not (or stop (bobp))) (re-search-backward markdown-regex-block-separator-noindent nil t) (if (match-end 2) (progn (goto-char (match-end 2)) (cond ((markdown-new-baseline) (setq stop t)) (($
markdown-search-backward-baseline()
(let ((first (point)) levels indent pre-regexp) (markdown-search-backward-baseline) (while (and (< (point) first) (re-search-forward markdown-regex-list first t)) (setq pre-regexp (format "^\\( \\|\11\\)\\$
(save-excursion (let ((first (point)) levels indent pre-regexp) (markdown-search-backward-baseline) (while (and (< (point) first) (re-search-forward markdown-regex-list first t)) (setq pre-regexp (format "^\\$
markdown-calculate-list-levels()
(let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq indent (1+ (length levels)))) (setq $
(save-excursion (goto-char start) (let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq in$
markdown-syntax-propertize-pre-blocks(2141 37366)
(progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end))
(if (and open close) (progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end)))
(let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq indent (1+ (length levels)))) (setq $
(save-excursion (goto-char start) (let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq in$
markdown-syntax-propertize-pre-blocks(2127 37366)
(progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end))
(if (and open close) (progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end)))
(let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq indent (1+ (length levels)))) (setq $
(save-excursion (goto-char start) (let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq in$
markdown-syntax-propertize-pre-blocks(2113 37366)
(progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end))
(if (and open close) (progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end)))
(let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq indent (1+ (length levels)))) (setq $
(save-excursion (goto-char start) (let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq in$
... and so on ...
markdown-syntax-propertize-pre-blocks(27 37366)
(progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end))
(if (and open close) (progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end)))
(let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq indent (1+ (length levels)))) (setq $
(save-excursion (goto-char start) (let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq in$
markdown-syntax-propertize-pre-blocks(13 37366)
(progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end))
(if (and open close) (progn (put-text-property open close 'markdown-pre (list open close)) (markdown-syntax-propertize-pre-blocks (point) end)))
(let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq indent (1+ (length levels)))) (setq $
(save-excursion (goto-char start) (let ((levels (markdown-calculate-list-levels)) indent pre-regexp close-regexp open close) (while (and (< (point) end) (not close)) (if (null levels) (setq indent 1) (setq in$
markdown-syntax-propertize-pre-blocks(1 37366)
(save-excursion (remove-text-properties start end markdown--syntax-properties) (markdown-syntax-propertize-fenced-block-constructs start end) (markdown-syntax-propertize-list-items start end) (markdown-syntax$
(progn (save-excursion (remove-text-properties start end markdown--syntax-properties) (markdown-syntax-propertize-fenced-block-constructs start end) (markdown-syntax-propertize-list-items start end) (markdown$
(unwind-protect (progn (save-excursion (remove-text-properties start end markdown--syntax-properties) (markdown-syntax-propertize-fenced-block-constructs start end) (markdown-syntax-propertize-list-items star$
(let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (save-excursion (remove-text-properties start end markdown--syntax-prope$
markdown-syntax-propertize(1 37366)
syntax-propertize(37366)
(let ((delay-mode-hooks t)) (text-mode) (setq major-mode 'markdown-mode) (setq mode-name "Markdown") (progn (if (get 'text-mode 'mode-class) (put 'markdown-mode 'mode-class (get 'text-mode 'mode-class))) (if $
(progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (text-mode) (setq major-mode 'markdown-mode) (setq mode-name "Markdown") (progn (if (get 'text-mode 'mode-class) (put 'markdown-mode $
markdown-mode()
set-auto-mode-0(markdown-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer example.md> "~/files/temp/example.md" nil nil "~/files/temp/example.md" (18221111 66309))
find-file-noselect("~/files/temp/example.md" nil nil t)
find-alternate-file("~/files/temp/example.md" t)
funcall-interactively(find-alternate-file "~/files/temp/example.md" t)
call-interactively(find-alternate-file nil nil)
command-execute(find-alternate-file)
Software Versions
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4