jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
875 stars 160 forks source link

(markdown-syntax-propertize-extend-region) fails on file load #777

Open johnkolen opened 11 months ago

johnkolen commented 11 months ago

When I load markdown file, I get a (wrong-type-argument listp t) error.

Expected Behavior

Markdown files should load without errors

Actual Behavior

Opening markdown files produce error message: (wrong-type-argument listp t)

In Messages:

File mode specification error: (wrong-type-argument listp t) Error during redisplay: (internal--syntax-propertize 2) signaled (wrong-type-argument listp t) Error running timer ‘show-paren-function’: (error "internal--syntax-propertize did not move syntax-propertize--done") Error during redisplay: (internal--syntax-propertize 2) signaled (wrong-type-argument listp t) Error running timer ‘show-paren-function’: (error "internal--syntax-propertize did not move syntax-propertize--done")

Steps to Reproduce

  1. Start Emacs
  2. load-file something.md
  3. See error message

Backtrace

Debugger entered--Lisp error: (wrong-type-argument listp t)

f(compiled-function (f) #<bytecode 0x8fc45fe41db6957>)(markdown-syntax-propertize-extend-region)

run-hook-wrapped(#f(compiled-function (f) #<bytecode 0x8fc45fe41db6957>) markdown-syntax-propertize-extend-region) syntax-propertize(1) markdown-mode() set-auto-mode-0(markdown-mode nil) set-auto-mode--apply-alist((("\.cl$" . lisp-mode) ("\.lisp$" . lisp-mode) ("\.tex$" . indented-text-mode) ("\.bib$" . bibtex-mode) ("\.abbrevs$" . fi:emacs-lisp-mode) ("\.el$" . fi:emacs-lisp-mode) ("\.js\'" . javascript-mode) ("\.rm$" . rmail-mode) ("\.rb$" . ruby-mode) ("\.gemspec$" . ruby-mode) ("\.coffee$" . coffee-mode) ("\.c$" . c-mode) ("\.h$" . c++-mode) ("\.y$" . bison-mode) ("\.lex" . c-mode) ("\.C$" . c++-mode) ("\.H$" . c++-mode) ("\.cc$" . c++-mode) ("\.hh$" . c++-mode) ("\.cpp$" . c++-mode) ("\.comp$" . c++-mode) ("\.css$" . css-mode) ("\.scss$" . css-mode) ("\.Z$" . uncompress-while-visiting) ("\.z$" . uncompress-while-visiting) ("\.gz$" . uncompress-while-visiting) ("\.html$" . html-mode) ("\.html.erb$" . html-mode) ("\.rhtml$" . html-mode) ("\.php3$" . html-mode) ("\.ol$" . outline-mode) ("\.txt$" . indented-text-mode) ("\.old$" . indented-text-mode) ("\.kbm$" . indented-text-mode) ("\.out$" . indented-text-mode) ("\.m$" . indented-text-mode) ("\.sh$" . indented-text-mode) ("\.notes$" . indented-text-mode) ("\.vue$" . vue-mode) ("\.sql$" . sql-mode) ("\.go$" . go-mode) ("\.yaml\'" . yaml-mode) ("\.yml\'" . yaml-mode) ("go\.work\'" . go-dot-work-mode) ("go\.mod\'" . go-dot-mod-mode) ("\.go\'" . go-mode) ("\.\(?:md\|markdown\|mkd\|mdown\|mkdn\|mdwn\)\'" . markdown-mode) ("\.\(e?ya?\|ra\)ml\'" . yaml-mode) ("\.gpg\(~\|\.~[0-9]+~\)?\'" nil epa-file) ...) nil nil) set-auto-mode() normal-mode(t) after-find-file(t t) find-file-noselect-1(# "~/bar.md" nil nil "~/bar.md" nil) find-file-noselect("~/bar.md" nil nil t) find-file("~/bar.md" t) funcall-interactively(find-file "~/bar.md" t) call-interactively(find-file nil nil) command-execute(find-file)

Software Versions

syohex commented 11 months ago

I cannot reproduce this issue. Please reinstall it, byte-compile it again and retry.

Did you update Emacs recently ? I suppose such error happens when installing some package and byte-compiling on an older Emacs and using it on a newer one.

johnkolen commented 11 months ago

It's a fresh install (new job, new computer 2 months ago). I deleted the markdown package (and lsp-mode, markdown was a dependency) and cleared anything markdown related from my .emacs. Exited emacs. Started it back up. Loaded a new file and did a M-x markdown-mode and got the message again.

Package markdown-mode is installed.

     Status: Installed in ‘markdown-mode-20230716.1308/’ (unsigned). Delete
    Version: 20230716.1308
     Commit: 0a7404a1c7b1916ca6e8408a6c8bad9125c846d2
    Summary: Major mode for Markdown-formatted text
   Requires: emacs-26.1
    Website: https://jblevins.org/projects/markdown-mode/
   Keywords: markdown github flavored markdown itex 
 Maintainer: Jason R. Blevins <jblevins@xbeta.org>
     Author: Jason R. Blevins <jblevins@xbeta.org>
Other versions: 20230716.1308 (melpa), 2.5 (nongnu).
Debugger entered--Lisp error: (wrong-type-argument listp t)
  #f(compiled-function (f) #<bytecode 0x8fc45fe41db6957>)(markdown-syntax-propertize-extend-region)
  run-hook-wrapped(#f(compiled-function (f) #<bytecode 0x8fc45fe41db6957>) markdown-syntax-propertize-extend-region)
  syntax-propertize(1)
  markdown-mode()
  set-auto-mode-0(markdown-mode nil)
  set-auto-mode--apply-alist((("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.cl$" . lisp-mode) ("\\.lisp$" . lisp-mode) ("\\.tex$" . indented-text-mode) ("\\.bib$" . bibtex-mode) ("\\.abbrevs$" . fi:emacs-lisp-mode) ("\\.el$" . fi:emacs-lisp-mode) ("\\.js\\'" . javascript-mode) ("\\.rm$" . rmail-mode) ("\\.rb$" . ruby-mode) ("\\.gemspec$" . ruby-mode) ("\\.coffee$" . coffee-mode) ("\\.c$" . c-mode) ("\\.h$" . c++-mode) ("\\.y$" . bison-mode) ("\\.lex" . c-mode) ("\\.C$" . c++-mode) ("\\.H$" . c++-mode) ("\\.cc$" . c++-mode) ("\\.hh$" . c++-mode) ("\\.cpp$" . c++-mode) ("\\.comp$" . c++-mode) ("\\.css$" . css-mode) ("\\.scss$" . css-mode) ("\\.Z$" . uncompress-while-visiting) ("\\.z$" . uncompress-while-visiting) ("\\.gz$" . uncompress-while-visiting) ("\\.html$" . html-mode) ("\\.html.erb$" . html-mode) ("\\.rhtml$" . html-mode) ("\\.php3$" . html-mode) ("\\.ol$" . outline-mode) ("\\.txt$" . indented-text-mode) ("\\.old$" . indented-text-mode) ("\\.kbm$" . indented-text-mode) ("\\.out$" . indented-text-mode) ("\\.m$" . indented-text-mode) ("\\.sh$" . indented-text-mode) ("\\.notes$" . indented-text-mode) ("\\.vue$" . vue-mode) ("\\.sql$" . sql-mode) ("\\.go$" . go-mode) ("\\.yaml\\'" . yaml-mode) ("\\.yml\\'" . yaml-mode) ("go\\.work\\'" . go-dot-work-mode) ("go\\.mod\\'" . go-dot-mod-mode) ("\\.go\\'" . go-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(t t)
  find-file-noselect-1(#<buffer bar.md> "~/bar.md" nil nil "~/bar.md" nil)
  find-file-noselect("~/bar.md" nil nil t)
  find-file("~/bar.md" t)
  funcall-interactively(find-file "~/bar.md" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)
syohex commented 11 months ago

Thanks for your retrying.

johnkolen commented 11 months ago

Yes, it happens with an empty file. When I removed the packages, I made sure the directories were removed.

FYI, here are the other installed packages:

  xref                           1.3.0          built-in              Cross-referencing commands
  whitespace                     13.2.2         built-in              minor mode to visualize TAB, (HARD) SPACE, NEWLINE
  viper                          3.14.2         built-in              A full-featured Vi emulator for Emacs
  verilog-mode                   2021.9.23.89128420 built-in              major mode for editing verilog source in Emacs
  vera-mode                      2.28           built-in              major mode for editing Vera files
  tramp                          2.5.3.28.2     built-in              Transparent Remote Access, Multiple Protocol
  tildify                        4.6.1          built-in              adding hard spaces into texts
  thunk                          1.0            built-in              Lazy form evaluation
  tabulated-list                 1.0            built-in              generic major mode for tabulated lists
  svg                            1.1            built-in              SVG image creation functions
  srecode                        1.2            built-in              Semantic buffer evaluator.
  sql                            3.6            built-in              specialized comint.el for SQL interpreters
  soap-client                    3.2.0          built-in              Access SOAP web services
  so-long                        1.1.2          built-in              Say farewell to performance problems with minified code.
  seq                            2.23           built-in              Sequence manipulation functions
  semantic                       2.2            built-in              Semantic buffer evaluator.
  ruby-mode                      1.2            built-in              Major mode for editing Ruby files
  python                         0.28           built-in              Python's flying circus support for Emacs
  pulse                          1.0            built-in              Pulsing Overlays
  ps-print                       7.3.5          built-in              print text from the buffer as PostScript
  ps-mode                        1.1.9          built-in              PostScript mode for GNU Emacs
  project                        0.8.1          built-in              Operations on the current project
  printing                       6.9.3          built-in              printing utilities
  package                        1.1.0          built-in              Simple package system for Emacs
  org                            9.5.5          built-in              Outline-based notes management and organizer
  ntlm                           2.1.0          built-in              NTLM (NT LanManager) authentication support
  nadvice                        1.0            built-in              Light-weight advice primitives for Elisp functions
  mixal-mode                     0.4            built-in              Major mode for the mix asm language.
  mh-e                           8.6snapshot    built-in              GNU Emacs interface to the MH mail system
  meta-mode                      1.0            built-in              major mode for editing Metafont or MetaPost sources
  map                            3.2.1          built-in              Map manipulation functions
  let-alist                      1.0.6          built-in              Easily let-bind values of an assoc-list by their names
  jsonrpc                        1.0.14         built-in              JSON-RPC library
  json                           1.5            built-in              JavaScript Object Notation parser / generator
  js                             9              built-in              Major mode for editing JavaScript
  isearchb                       1.5            built-in              a marriage between iswitchb and isearch
  info-xref                      3              built-in              check external references in an Info document
  image-dired                    0.4.11         built-in              use dired to browse and manipulate your images
  idlwave                        6.1.22         built-in              IDL editing mode for GNU Emacs
  htmlfontify                    0.21           built-in              htmlize a buffer/source tree with optional hyperlinks
  gnus                           5.13           built-in              a newsreader for GNU Emacs
  foldout                        1.10           built-in              folding extensions for outline-mode and outline-minor-mode
  flymake-proc                   1.0            built-in              Flymake backend for external tools
  flymake                        1.2.2          built-in              A universal on-the-fly syntax checker
  find-cmd                       0.6            built-in              Build a valid find(1) command with sexps
  feedmail                       11             built-in              assist other email packages to massage outgoing messages
  faceup                         0.0.6          built-in              Markup language for faces and font-lock regression testing
  eshell                         2.4.2          built-in              the Emacs command shell
  erc                            5.4            built-in              An Emacs Internet Relay Chat client
  epg                            1.0.0          built-in              the EasyPG Library
  eldoc                          1.11.0         built-in              Show function arglist or variable docstring in echo area
  eieio-core                     1.4            built-in              Core implementation for eieio
  eieio                          1.4            built-in              Enhanced Implementation of Emacs Interpreted Objects
  ediff                          2.81.6         built-in              a comprehensive visual interface to diff & patch
  ede                            1.2            built-in              Emacs Development Environment gloss
  ebnf2ps                        4.4            built-in              translate an EBNF to a syntactic chart on PostScript
  cl-print                       1.0            built-in              CL-style generic printing
  cl-lib                         1.0            built-in              Common Lisp extensions for Emacs
  cl-generic                     1.0            built-in              CLOS-style generic functions for Elisp
  cfengine                       1.4            built-in              mode for editing Cfengine files
  cedet                          2.0            built-in              Setup CEDET environment
  cc-mode                        5.33.1         built-in              major mode for editing C and similar languages
  backtrace                      1.0            built-in              generic major mode for Elisp backtraces
  auth-source-pass               5.0.0          built-in              Integrate auth-source with password-store
  antlr-mode                     2.2.3          built-in              major mode for ANTLR grammar files
  ansi-color                     3.4.2          built-in              translate ANSI escape sequences into faces
  allout-widgets                 1.0            built-in              Visually highlight allout outline structure.
  allout                         2.3            built-in              extensive outline mode for use alone and with other modes
  spinner                        1.7.4          dependency            Add spinners and progress-bars to the mode-line for ongoing operations
  s                              20220902.1511  dependency            The long lost Emacs string manipulation library.
  markdown-mode                  20230716.1308  dependency            Major mode for Markdown-formatted text
  lv                             20200507.1518  dependency            Other echo area
  ht                             20230214.1632  dependency            The missing hash table library for Emacs
  f                              20230116.1032  dependency            Modern API for working with files and directories
  dash                           20230502.1324  dependency            A modern list library for Emacs
  yaml-mode                      20230329.723   installed             Major mode for editing YAML files
  go-mode                        20221228.1706  installed             Major mode for the Go programming language
  exec-path-from-shell           20220826.1535  installed             Get environment variables such as $PATH from the shell
syohex commented 11 months ago

Does this issue happen only with markdown-mode.el

  1. Download latest markdown-mode.el
    • curl -LO https://raw.githubusercontent.com/jrblevin/markdown-mode/master/markdown-mode.el
  2. Run Emacs with -Q flag
    • emacs -Q -l markdown-mode.el foo.md
    • I'm not sure the path of emacs on macOS. /Applications/Emacs.app/Contents/MacOS/bin/Emacs ?
  3. Check if the issue happens or not