Open vermiculus opened 6 years ago
Interestingly enough, the markdown of this post also reproduces the issue :-)
I try to mostly use magithub to browse github now, so you can reproduce it 'in the wild' with that package.
I can also reproduce it with the following call, but not shorter than this. This leads me to believe that it's inherent to the length of the text being fontified; the following is 34582 characters long.
(magithub-fill-gfm "Hello,\n\nIn several repositories, I get the error as in the title of this ticket (with varying integers instead of `47`) when doing a magit refresh (`g`) while certain branches are checked out. I couldn't find a commonality between the branches that cause this (but I didn't try very hard since I wasn't sure where to start).\n\nTrace attached below.\n\n``` elisp\nDebugger entered--Lisp error: (wrong-type-argument listp 47)\n alist-get(total_count 47)\n (let* ((val (alist-get (quote total_count) checks))) (cond ((eq val 0) (let nil (format \"%s %s\" (magithub-ci--status-propertized checks) (or (alist-get (quote magithub-message) checks) (propertize \"it seems checks have not yet begun\" (quote face) (quote magit-dimmed)))))) ((eq val 1) (let nil (magithub-ci--status-propertized checks))) (t (let nil (let* ((overall-status (alist-get ... checks)) (status-spec (magithub-ci--status-spec overall-status)) (display (or ... overall-status)) (statuses (alist-get ... checks)) (passed (-filter ... statuses))) (propertize (format \"%s (%d/%d)\" display (length passed) (length statuses)) (quote face) (alist-get (quote face) status-spec)))))))\n magithub-ci--status-header(47)\n (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" (quote face) (quote magit-dimmed)) (propertize ref (quote face) (quote magit-refname)) (propertize \"...\" (quote face) (quote magit-dimmed)))\n (insert (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" (quote face) (quote magit-dimmed)) (propertize ref (quote face) (quote magit-refname)) (propertize \"...\" (quote face) (quote magit-dimmed))))\n (catch (quote cancel-section) (insert (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" (quote face) (quote magit-dimmed)) (propertize ref (quote face) (quote magit-refname)) (propertize \"...\" (quote face) (quote magit-dimmed)))) (magit-insert-heading) (insert (propertize (format \"%-10sas of %s\\n\" \"\" (let* ((time (and t ...))) (if time (magithub--format-time time) \"???\"))) (quote face) (quote magit-dimmed))) (let ((--dolist-tail-- (alist-get (quote statuses) checks))) (while --dolist-tail-- (let ((status (car --dolist-tail--))) (let* ((type310 (quote magithub-ci-status)) (section311 (funcall ... \"\" :type type310 :value ... :start ... :parent magit-insert-section--parent))) (eieio-oset section311 (quote hidden) (let (...) (if value ... ...))) (let ((magit-insert-section--current section311) (magit-insert-section--parent section311) (magit-insert-section--oldroot ...)) (catch (quote cancel-section) (insert indent ...) (magit-insert-heading) (run-hooks ...) (magit-insert-child-count section311) (set-marker-insertion-type ... t) (let* ... ...) (if ... ... ...)) section311)) (setq --dolist-tail-- (cdr --dolist-tail--))))) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section309) (set-marker-insertion-type (eieio-oref section309 (quote start)) t) (let* ((end (eieio-oset section309 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" (eieio-oref section309 (quote type))))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section309 (quote start))) (while (< (point) end) (let ((next (or ... end))) (if (get-text-property (point) (quote magit-section)) nil (put-text-property (point) next (quote magit-section) section309) (if map (progn ...))) (goto-char next))))) (if (eq section309 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section309)) (eieio-oset (eieio-oref section309 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section309 (quote parent)) (quote children)) (list section309)))))\n (let ((magit-insert-section--current section309) (magit-insert-section--parent section309) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section (setq magit-root-section section309)))))) (catch (quote cancel-section) (insert (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" (quote face) (quote magit-dimmed)) (propertize ref (quote face) (quote magit-refname)) (propertize \"...\" (quote face) (quote magit-dimmed)))) (magit-insert-heading) (insert (propertize (format \"%-10sas of %s\\n\" \"\" (let* ((time ...)) (if time (magithub--format-time time) \"???\"))) (quote face) (quote magit-dimmed))) (let ((--dolist-tail-- (alist-get (quote statuses) checks))) (while --dolist-tail-- (let ((status (car --dolist-tail--))) (let* ((type310 ...) (section311 ...)) (eieio-oset section311 (quote hidden) (let ... ...)) (let (... ... ...) (catch ... ... ... ... ... ... ... ...) section311)) (setq --dolist-tail-- (cdr --dolist-tail--))))) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section309) (set-marker-insertion-type (eieio-oref section309 (quote start)) t) (let* ((end (eieio-oset section309 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" (eieio-oref section309 ...)))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section309 (quote start))) (while (< (point) end) (let ((next ...)) (if (get-text-property ... ...) nil (put-text-property ... next ... section309) (if map ...)) (goto-char next))))) (if (eq section309 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section309)) (eieio-oset (eieio-oref section309 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section309 (quote parent)) (quote children)) (list section309))))) section309)\n (let* ((type308 (quote magithub-ci-status)) (section309 (funcall (cond ((eq type308 (quote file)) (let nil (quote magit-file-section))) ((eq type308 (quote hunk)) (let nil (quote magit-hunk-section))) (t (let nil (quote magit-section)))) \"\" :type type308 :value (cons (quote magithub-ci-ref) ref) :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section309 (quote hidden) (let ((value (run-hook-with-args-until-success (quote magit-section-set-visibility-hook) section309))) (if value (eq value (quote hide)) (let ((incarnation (and magit-insert-section--oldroot ...))) (if incarnation (eieio-oref incarnation (quote hidden)) (let (...) (if value ... ...))))))) (let ((magit-insert-section--current section309) (magit-insert-section--parent section309) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section (setq magit-root-section section309)))))) (catch (quote cancel-section) (insert (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" (quote face) (quote magit-dimmed)) (propertize ref (quote face) (quote magit-refname)) (propertize \"...\" (quote face) (quote magit-dimmed)))) (magit-insert-heading) (insert (propertize (format \"%-10sas of %s\\n\" \"\" (let* (...) (if time ... \"???\"))) (quote face) (quote magit-dimmed))) (let ((--dolist-tail-- (alist-get (quote statuses) checks))) (while --dolist-tail-- (let ((status ...)) (let* (... ...) (eieio-oset section311 ... ...) (let ... ... section311)) (setq --dolist-tail-- (cdr --dolist-tail--))))) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section309) (set-marker-insertion-type (eieio-oref section309 (quote start)) t) (let* ((end (eieio-oset section309 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" ...))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section309 (quote start))) (while (< (point) end) (let (...) (if ... nil ... ...) (goto-char next))))) (if (eq section309 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section309)) (eieio-oset (eieio-oref section309 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section309 ...) (quote children)) (list section309))))) section309))\n (progn (let* ((type308 (quote magithub-ci-status)) (section309 (funcall (cond ((eq type308 ...) (let nil ...)) ((eq type308 ...) (let nil ...)) (t (let nil ...))) \"\" :type type308 :value (cons (quote magithub-ci-ref) ref) :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section309 (quote hidden) (let ((value (run-hook-with-args-until-success (quote magit-section-set-visibility-hook) section309))) (if value (eq value (quote hide)) (let ((incarnation ...)) (if incarnation (eieio-oref incarnation ...) (let ... ...)))))) (let ((magit-insert-section--current section309) (magit-insert-section--parent section309) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section ...))))) (catch (quote cancel-section) (insert (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" (quote face) (quote magit-dimmed)) (propertize ref (quote face) (quote magit-refname)) (propertize \"...\" (quote face) (quote magit-dimmed)))) (magit-insert-heading) (insert (propertize (format \"%-10sas of %s\\n\" \"\" (let* ... ...)) (quote face) (quote magit-dimmed))) (let ((--dolist-tail-- (alist-get ... checks))) (while --dolist-tail-- (let (...) (let* ... ... ...) (setq --dolist-tail-- ...)))) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section309) (set-marker-insertion-type (eieio-oref section309 (quote start)) t) (let* ((end (eieio-oset section309 ... ...)) (map (intern ...)) (map (and ... ...))) (save-excursion (goto-char (eieio-oref section309 ...)) (while (< ... end) (let ... ... ...)))) (if (eq section309 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section309)) (eieio-oset (eieio-oref section309 (quote parent)) (quote children) (nconc (eieio-oref ... ...) (list section309))))) section309)))\n (if checks (progn (let* ((type308 (quote magithub-ci-status)) (section309 (funcall (cond (... ...) (... ...) (t ...)) \"\" :type type308 :value (cons (quote magithub-ci-ref) ref) :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section309 (quote hidden) (let ((value (run-hook-with-args-until-success ... section309))) (if value (eq value (quote hide)) (let (...) (if incarnation ... ...))))) (let ((magit-insert-section--current section309) (magit-insert-section--parent section309) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil ...)))) (catch (quote cancel-section) (insert (format \"%-10s%s %s %s%s\" \"Status:\" (magithub-ci--status-header checks) (propertize \"on ref\" ... ...) (propertize ref ... ...) (propertize \"...\" ... ...))) (magit-insert-heading) (insert (propertize (format \"%-10sas of %s\\n\" \"\" ...) (quote face) (quote magit-dimmed))) (let ((--dolist-tail-- ...)) (while --dolist-tail-- (let ... ... ...))) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section309) (set-marker-insertion-type (eieio-oref section309 (quote start)) t) (let* ((end ...) (map ...) (map ...)) (save-excursion (goto-char ...) (while ... ...))) (if (eq section309 magit-root-section) (let (...) (magit-section-show section309)) (eieio-oset (eieio-oref section309 ...) (quote children) (nconc ... ...)))) section309))))\n (let* ((ref (magithub-ci-status--get-default-ref)) (checks (magithub-ci-status ref)) (indent (make-string 10 32))) (if checks (progn (let* ((type308 (quote magithub-ci-status)) (section309 (funcall (cond ... ... ...) \"\" :type type308 :value (cons ... ref) :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section309 (quote hidden) (let ((value ...)) (if value (eq value ...) (let ... ...)))) (let ((magit-insert-section--current section309) (magit-insert-section--parent section309) (magit-insert-section--oldroot (or magit-insert-section--oldroot ...))) (catch (quote cancel-section) (insert (format \"%-10s%s %s %s%s\" \"Status:\" ... ... ... ...)) (magit-insert-heading) (insert (propertize ... ... ...)) (let (...) (while --dolist-tail-- ...)) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section309) (set-marker-insertion-type (eieio-oref section309 ...) t) (let* (... ... ...) (save-excursion ... ...)) (if (eq section309 magit-root-section) (let ... ...) (eieio-oset ... ... ...))) section309)))))\n magithub-insert-ci-status-header()\n (progn (magithub-insert-ci-status-header))\n (if (and (magithub-settings-include-status-p) (magithub-usable-p) (let ((b (magit-get-current-branch))) (or (magit-get-upstream-remote b) (magit-get-push-remote b)))) (progn (magithub-insert-ci-status-header)))\n magithub-maybe-insert-ci-status-header()\n funcall(magithub-maybe-insert-ci-status-header)\n mapc(funcall (magit-insert-upstream-branch-header magit-insert-push-branch-header magit-insert-tags-header magithub-maybe-report-offline-mode magithub-maybe-insert-ci-status-header))\n (if (= (point) magit-insert-headers--beginning) (magit-cancel-section) (magit-insert-heading) (remove-hook (quote magit-insert-section-hook) (quote magit-insert-remaining-headers)) (mapc (function funcall) magit-insert-headers--hook) (insert \"\\n\"))\n magit-insert-remaining-headers()\n run-hooks(magit-insert-section-hook)\n (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (if magit-status-show-hashes-in-headers (progn (insert (propertize commit (quote face) (quote magit-hash)) 32))) (insert (propertize branch (quote face) (quote magit-branch-local))) (insert 32) (insert (funcall magit-log-format-message-function branch summary)) (insert 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section372) (set-marker-insertion-type (eieio-oref section372 (quote start)) t) (let* ((end (eieio-oset section372 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" (eieio-oref section372 (quote type))))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section372 (quote start))) (while (< (point) end) (let ((next (or ... end))) (if (get-text-property (point) (quote magit-section)) nil (put-text-property (point) next (quote magit-section) section372) (if map (progn ...))) (goto-char next))))) (if (eq section372 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section372)) (eieio-oset (eieio-oref section372 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section372 (quote parent)) (quote children)) (list section372)))))\n (let ((magit-insert-section--current section372) (magit-insert-section--parent section372) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section (setq magit-root-section section372)))))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (if magit-status-show-hashes-in-headers (progn (insert (propertize commit (quote face) (quote magit-hash)) 32))) (insert (propertize branch (quote face) (quote magit-branch-local))) (insert 32) (insert (funcall magit-log-format-message-function branch summary)) (insert 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section372) (set-marker-insertion-type (eieio-oref section372 (quote start)) t) (let* ((end (eieio-oset section372 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" (eieio-oref section372 ...)))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section372 (quote start))) (while (< (point) end) (let ((next ...)) (if (get-text-property ... ...) nil (put-text-property ... next ... section372) (if map ...)) (goto-char next))))) (if (eq section372 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section372)) (eieio-oset (eieio-oref section372 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section372 (quote parent)) (quote children)) (list section372))))) section372)\n (let* ((type371 (quote branch)) (section372 (funcall (cond ((eq type371 (quote file)) (let nil (quote magit-file-section))) ((eq type371 (quote hunk)) (let nil (quote magit-hunk-section))) (t (let nil (quote magit-section)))) \"\" :type type371 :value branch :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section372 (quote hidden) (let ((value (run-hook-with-args-until-success (quote magit-section-set-visibility-hook) section372))) (if value (eq value (quote hide)) (let ((incarnation (and magit-insert-section--oldroot ...))) (if incarnation (eieio-oref incarnation (quote hidden)) (let (...) (if value ... nil))))))) (let ((magit-insert-section--current section372) (magit-insert-section--parent section372) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section (setq magit-root-section section372)))))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (if magit-status-show-hashes-in-headers (progn (insert (propertize commit (quote face) (quote magit-hash)) 32))) (insert (propertize branch (quote face) (quote magit-branch-local))) (insert 32) (insert (funcall magit-log-format-message-function branch summary)) (insert 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section372) (set-marker-insertion-type (eieio-oref section372 (quote start)) t) (let* ((end (eieio-oset section372 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" ...))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section372 (quote start))) (while (< (point) end) (let (...) (if ... nil ... ...) (goto-char next))))) (if (eq section372 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section372)) (eieio-oset (eieio-oref section372 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section372 ...) (quote children)) (list section372))))) section372))\n (if branch (let* ((type371 (quote branch)) (section372 (funcall (cond ((eq type371 ...) (let nil ...)) ((eq type371 ...) (let nil ...)) (t (let nil ...))) \"\" :type type371 :value branch :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section372 (quote hidden) (let ((value (run-hook-with-args-until-success (quote magit-section-set-visibility-hook) section372))) (if value (eq value (quote hide)) (let ((incarnation ...)) (if incarnation (eieio-oref incarnation ...) (let ... ...)))))) (let ((magit-insert-section--current section372) (magit-insert-section--parent section372) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section ...))))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (if magit-status-show-hashes-in-headers (progn (insert (propertize commit ... ...) 32))) (insert (propertize branch (quote face) (quote magit-branch-local))) (insert 32) (insert (funcall magit-log-format-message-function branch summary)) (insert 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section372) (set-marker-insertion-type (eieio-oref section372 (quote start)) t) (let* ((end (eieio-oset section372 ... ...)) (map (intern ...)) (map (and ... ...))) (save-excursion (goto-char (eieio-oref section372 ...)) (while (< ... end) (let ... ... ...)))) (if (eq section372 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section372)) (eieio-oset (eieio-oref section372 (quote parent)) (quote children) (nconc (eieio-oref ... ...) (list section372))))) section372)) (let* ((type373 (quote commit)) (section374 (funcall (cond ((eq type373 ...) (let nil ...)) ((eq type373 ...) (let nil ...)) (t (let nil ...))) \"\" :type type373 :value commit :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section374 (quote hidden) (let ((value (run-hook-with-args-until-success (quote magit-section-set-visibility-hook) section374))) (if value (eq value (quote hide)) (let ((incarnation ...)) (if incarnation (eieio-oref incarnation ...) (let ... ...)))))) (let ((magit-insert-section--current section374) (magit-insert-section--parent section374) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section ...))))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (insert (propertize commit (quote face) (quote magit-hash))) (insert 32 summary 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section374) (set-marker-insertion-type (eieio-oref section374 (quote start)) t) (let* ((end (eieio-oset section374 ... ...)) (map (intern ...)) (map (and ... ...))) (save-excursion (goto-char (eieio-oref section374 ...)) (while (< ... end) (let ... ... ...)))) (if (eq section374 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section374)) (eieio-oset (eieio-oref section374 (quote parent)) (quote children) (nconc (eieio-oref ... ...) (list section374))))) section374)))\n (let ((commit (match-string 1 string370)) (summary (match-string 2 string370))) (if branch (let* ((type371 (quote branch)) (section372 (funcall (cond (... ...) (... ...) (t ...)) \"\" :type type371 :value branch :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section372 (quote hidden) (let ((value (run-hook-with-args-until-success ... section372))) (if value (eq value (quote hide)) (let (...) (if incarnation ... ...))))) (let ((magit-insert-section--current section372) (magit-insert-section--parent section372) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil ...)))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (if magit-status-show-hashes-in-headers (progn (insert ... 32))) (insert (propertize branch (quote face) (quote magit-branch-local))) (insert 32) (insert (funcall magit-log-format-message-function branch summary)) (insert 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section372) (set-marker-insertion-type (eieio-oref section372 (quote start)) t) (let* ((end ...) (map ...) (map ...)) (save-excursion (goto-char ...) (while ... ...))) (if (eq section372 magit-root-section) (let (...) (magit-section-show section372)) (eieio-oset (eieio-oref section372 ...) (quote children) (nconc ... ...)))) section372)) (let* ((type373 (quote commit)) (section374 (funcall (cond (... ...) (... ...) (t ...)) \"\" :type type373 :value commit :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section374 (quote hidden) (let ((value (run-hook-with-args-until-success ... section374))) (if value (eq value (quote hide)) (let (...) (if incarnation ... ...))))) (let ((magit-insert-section--current section374) (magit-insert-section--parent section374) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil ...)))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (insert (propertize commit (quote face) (quote magit-hash))) (insert 32 summary 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section374) (set-marker-insertion-type (eieio-oref section374 (quote start)) t) (let* ((end ...) (map ...) (map ...)) (save-excursion (goto-char ...) (while ... ...))) (if (eq section374 magit-root-section) (let (...) (magit-section-show section374)) (eieio-oset (eieio-oref section374 ...) (quote children) (nconc ... ...)))) section374))))\n (let ((string370 output)) (let ((commit (match-string 1 string370)) (summary (match-string 2 string370))) (if branch (let* ((type371 (quote branch)) (section372 (funcall (cond ... ... ...) \"\" :type type371 :value branch :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section372 (quote hidden) (let ((value ...)) (if value (eq value ...) (let ... ...)))) (let ((magit-insert-section--current section372) (magit-insert-section--parent section372) (magit-insert-section--oldroot (or magit-insert-section--oldroot ...))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (if magit-status-show-hashes-in-headers (progn ...)) (insert (propertize branch ... ...)) (insert 32) (insert (funcall magit-log-format-message-function branch summary)) (insert 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section372) (set-marker-insertion-type (eieio-oref section372 ...) t) (let* (... ... ...) (save-excursion ... ...)) (if (eq section372 magit-root-section) (let ... ...) (eieio-oset ... ... ...))) section372)) (let* ((type373 (quote commit)) (section374 (funcall (cond ... ... ...) \"\" :type type373 :value commit :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section374 (quote hidden) (let ((value ...)) (if value (eq value ...) (let ... ...)))) (let ((magit-insert-section--current section374) (magit-insert-section--parent section374) (magit-insert-section--oldroot (or magit-insert-section--oldroot ...))) (catch (quote cancel-section) (insert (format \"%-10s\" \"Head: \")) (insert (propertize commit ... ...)) (insert 32 summary 10) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section374) (set-marker-insertion-type (eieio-oref section374 ...) t) (let* (... ... ...) (save-excursion ... ...)) (if (eq section374 magit-root-section) (let ... ...) (eieio-oset ... ... ...))) section374)))))\n (let ((output (magit-rev-format \"%h %s\" (or branch \"HEAD\")))) (string-match \"^\\\\([^ ]+\\\\) \\\\(.*\\\\)\" output) (let ((string370 output)) (let ((commit (match-string 1 string370)) (summary (match-string 2 string370))) (if branch (let* ((type371 (quote branch)) (section372 (funcall ... \"\" :type type371 :value branch :start ... :parent magit-insert-section--parent))) (eieio-oset section372 (quote hidden) (let (...) (if value ... ...))) (let ((magit-insert-section--current section372) (magit-insert-section--parent section372) (magit-insert-section--oldroot ...)) (catch (quote cancel-section) (insert ...) (if magit-status-show-hashes-in-headers ...) (insert ...) (insert 32) (insert ...) (insert 10) (run-hooks ...) (magit-insert-child-count section372) (set-marker-insertion-type ... t) (let* ... ...) (if ... ... ...)) section372)) (let* ((type373 (quote commit)) (section374 (funcall ... \"\" :type type373 :value commit :start ... :parent magit-insert-section--parent))) (eieio-oset section374 (quote hidden) (let (...) (if value ... ...))) (let ((magit-insert-section--current section374) (magit-insert-section--parent section374) (magit-insert-section--oldroot ...)) (catch (quote cancel-section) (insert ...) (insert ...) (insert 32 summary 10) (run-hooks ...) (magit-insert-child-count section374) (set-marker-insertion-type ... t) (let* ... ...) (if ... ... ...)) section374))))))\n (progn (if --cl-rest-- (signal (quote wrong-number-of-arguments) (list (quote magit-insert-head-branch-header) (+ 1 (length --cl-rest--))))) (let ((output (magit-rev-format \"%h %s\" (or branch \"HEAD\")))) (string-match \"^\\\\([^ ]+\\\\) \\\\(.*\\\\)\" output) (let ((string370 output)) (let ((commit (match-string 1 string370)) (summary (match-string 2 string370))) (if branch (let* ((type371 ...) (section372 ...)) (eieio-oset section372 (quote hidden) (let ... ...)) (let (... ... ...) (catch ... ... ... ... ... ... ... ... ... ... ... ...) section372)) (let* ((type373 ...) (section374 ...)) (eieio-oset section374 (quote hidden) (let ... ...)) (let (... ... ...) (catch ... ... ... ... ... ... ... ... ...) section374)))))))\n (let* ((branch (if --cl-rest-- (car-safe (prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--)))) (magit-get-current-branch)))) (progn (if --cl-rest-- (signal (quote wrong-number-of-arguments) (list (quote magit-insert-head-branch-header) (+ 1 (length --cl-rest--))))) (let ((output (magit-rev-format \"%h %s\" (or branch \"HEAD\")))) (string-match \"^\\\\([^ ]+\\\\) \\\\(.*\\\\)\" output) (let ((string370 output)) (let ((commit (match-string 1 string370)) (summary (match-string 2 string370))) (if branch (let* (... ...) (eieio-oset section372 ... ...) (let ... ... section372)) (let* (... ...) (eieio-oset section374 ... ...) (let ... ... section374))))))))\n magit-insert-head-branch-header()\n funcall(magit-insert-head-branch-header)\n (while (and (setq wrapper (car-safe (prog1 magit-insert-headers--hook (setq magit-insert-headers--hook (cdr magit-insert-headers--hook))))) (= (point) magit-insert-headers--beginning)) (funcall wrapper))\n (let ((magit-insert-section-hook (cons (quote magit-insert-remaining-headers) (if (listp magit-insert-section-hook) magit-insert-section-hook (list magit-insert-section-hook)))) (magit-insert-headers--hook hooks) wrapper) (setq magit-insert-headers--beginning (point)) (while (and (setq wrapper (car-safe (prog1 magit-insert-headers--hook (setq magit-insert-headers--hook (cdr magit-insert-headers--hook))))) (= (point) magit-insert-headers--beginning)) (funcall wrapper)))\n magit-insert-headers((magit-insert-error-header magit-insert-diff-filter-header magit-insert-head-branch-header magit-insert-upstream-branch-header magit-insert-push-branch-header magit-insert-tags-header magithub-maybe-report-offline-mode magithub-maybe-insert-ci-status-header))\n (if (magit-rev-verify \"HEAD\") (magit-insert-headers magit-status-headers-hook) (insert \"In the beginning there was darkness\\n\\n\"))\n magit-insert-status-headers()\n run-hooks(magit-status-sections-hook)\n (if it (progn (message \"`%s' contains entries that are no longer valid.\\n%s\\nUsing standard value instead. Please re-configure hook variable.\" hook (mapconcat (function (lambda (sym) (format \" `%s'\" sym))) it \"\\n\")) (sit-for 5) (defvar magit--hook-standard-value nil) (let ((magit--hook-standard-value (eval (car (get hook ...))))) (run-hooks (quote magit---hook-standard-value)))) (run-hooks hook))\n (let ((it (-remove (function functionp) (symbol-value hook)))) (if it (progn (message \"`%s' contains entries that are no longer valid.\\n%s\\nUsing standard value instead. Please re-configure hook variable.\" hook (mapconcat (function (lambda (sym) (format \" `%s'\" sym))) it \"\\n\")) (sit-for 5) (defvar magit--hook-standard-value nil) (let ((magit--hook-standard-value (eval (car ...)))) (run-hooks (quote magit---hook-standard-value)))) (run-hooks hook)))\n magit-run-section-hook(magit-status-sections-hook)\n (catch (quote cancel-section) (magit-run-section-hook (quote magit-status-sections-hook)) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section365) (set-marker-insertion-type (eieio-oref section365 (quote start)) t) (let* ((end (eieio-oset section365 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" (eieio-oref section365 (quote type))))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section365 (quote start))) (while (< (point) end) (let ((next (or ... end))) (if (get-text-property (point) (quote magit-section)) nil (put-text-property (point) next (quote magit-section) section365) (if map (progn ...))) (goto-char next))))) (if (eq section365 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section365)) (eieio-oset (eieio-oref section365 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section365 (quote parent)) (quote children)) (list section365)))))\n (let ((magit-insert-section--current section365) (magit-insert-section--parent section365) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section (setq magit-root-section section365)))))) (catch (quote cancel-section) (magit-run-section-hook (quote magit-status-sections-hook)) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section365) (set-marker-insertion-type (eieio-oref section365 (quote start)) t) (let* ((end (eieio-oset section365 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" (eieio-oref section365 ...)))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section365 (quote start))) (while (< (point) end) (let ((next ...)) (if (get-text-property ... ...) nil (put-text-property ... next ... section365) (if map ...)) (goto-char next))))) (if (eq section365 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section365)) (eieio-oset (eieio-oref section365 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section365 (quote parent)) (quote children)) (list section365))))) section365)\n (let* ((type364 (quote status)) (section365 (funcall (cond ((eq type364 (quote file)) (let nil (quote magit-file-section))) ((eq type364 (quote hunk)) (let nil (quote magit-hunk-section))) (t (let nil (quote magit-section)))) \"\" :type type364 :value nil :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section365 (quote hidden) (let ((value (run-hook-with-args-until-success (quote magit-section-set-visibility-hook) section365))) (if value (eq value (quote hide)) (let ((incarnation (and magit-insert-section--oldroot ...))) (if incarnation (eieio-oref incarnation (quote hidden)) (let (...) (if value ... nil))))))) (let ((magit-insert-section--current section365) (magit-insert-section--parent section365) (magit-insert-section--oldroot (or magit-insert-section--oldroot (if magit-insert-section--parent nil (prog1 magit-root-section (setq magit-root-section section365)))))) (catch (quote cancel-section) (magit-run-section-hook (quote magit-status-sections-hook)) (run-hooks (quote magit-insert-section-hook)) (magit-insert-child-count section365) (set-marker-insertion-type (eieio-oref section365 (quote start)) t) (let* ((end (eieio-oset section365 (quote end) (point-marker))) (map (intern (format \"magit-%s-section-map\" ...))) (map (and (boundp map) (symbol-value map)))) (save-excursion (goto-char (eieio-oref section365 (quote start))) (while (< (point) end) (let (...) (if ... nil ... ...) (goto-char next))))) (if (eq section365 magit-root-section) (let ((magit-section-cache-visibility nil)) (magit-section-show section365)) (eieio-oset (eieio-oref section365 (quote parent)) (quote children) (nconc (eieio-oref (eieio-oref section365 ...) (quote children)) (list section365))))) section365))\n")
Thanks for reporting this. I used the call you suggested last above. I wasn't able to reproduce with Emacs 26, but it does reproduce for me with Emacs 25.2.2.
You shouldn't need to call font-lock-ensure
in this case. In the issue you referenced, that was to make sure that text properties were applied to identify a code block that was inserted into a buffer when markdown-mode was already active. Since you can insert the entire buffer text and then call the mode, it will properties and fontify everything when enabled. This seems to work for me (insert text, enable gfm-mode
, then fill):
(defun magithub-fill-gfm (text)
"Fill TEXT according to GFM rules."
(with-temp-buffer
(delay-mode-hooks
(insert text)
(gfm-mode) ;autoloaded
(fill-region (point-min) (point-max))
(buffer-string))))
Noting that the GFM code block isn't closed in the example, the code block gets filled in addition to the text. Since CommonMark specifies that code blocks are closed automatically when the end of the file is reached (even without the trailing ``), I will plan to
markdown-mode` to do the same.
I think I've got similar error from eglot--format-markup:
(with-temp-buffer
(setq-local markdown-fontify-code-blocks-natively t)
(insert "```odin\n raylib.KeyboardKey: enum\n```\n\n Keyboard keys (US keyboard layout)\n NOTE: Use GetKeyPressed() to allow redefining\n required keys for alternative layouts")
(let ((inhibit-message t)
(message-log-max nil))
(ignore-errors (delay-mode-hooks (gfm-view-mode))))
(font-lock-ensure)
(string-trim (filter-buffer-substring (point-min) (point-max))))
Expected Behavior
Calling
font-lock-ensure
in a markdown-mode buffer shouldn't crash.Actual Behavior
We crash.
The current implementation of
magithub-fill-gfm
is as follows:I've attached the actual text we're trying to fontify below -- apologies in advance; it's quite a large blob of text.
Software Versions