Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

nerd-icons fail because treesit-auto makes (nil . glsl-ts-mode) entry in auto mode alist #127

Open
Schievel1 opened this issue Nov 22, 2024 · 0 comments

Comments

@Schievel1
Copy link

Schievel1 commented Nov 22, 2024

Doom emacs uses nerd icons for it's mode-line.
When using treesit-auto it changes the auto-mode-alist so that one entry of it is (nil . glsl-ts-mode).
This causes problems when opening a file, because the function that searches for a fitting icon for that file in the modeline can not handle the nil it seems:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match(nil "/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/...")
  #f(compiled-function (it) #<bytecode -0x631c5a76de119ba>)((nil . glsl-ts-mode))
  cl--position(nil (("\\.conf$" . bitbake-mode) ("\\.bbclass$" . bitbake-mode) ("\\.bbappend$" . bitbake-mode) ("\\.inc$" . bitbake-mode) ("\\.bb$" . bitbake-mode) ("\\.ya?ml\\'" . yaml-ts-mode) ("\\.ts\\'" . typescript-ts-mode) ("\\.tsx\\'" . tsx-ts-mode) ("\\.toml\\'" . toml-ts-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-ts-mode) ("\\.py[iw]?\\'" . python-ts-mode) ("\\.json\\'" . json-ts-mode) ("\\.js\\'" . js-ts-mode) ("\\.java\\'" . java-ts-mode) ("go\\.mod\\'" . go-mod-ts-mode) ("\\.go\\'" . go-ts-mode) (nil . glsl-ts-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?..." . dockerfile-ts-mode) ("\\.css\\'" . css-ts-mode) ("\\.cpp\\'" . c++-ts-mode) ("\\.cmake\\'" . cmake-ts-mode) ("\\.cs\\'" . csharp-ts-mode) ("\\.c\\'" . c-ts-mode) ("\\.sh\\'" . bash-ts-mode) ("\\.[pP][dD][fF]\\'" . pdf-view-mode) ("Procfile\\'" . yaml-mode) ("/bspwmrc\\'" . sh-mode) ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode) ("\\.bats\\'" . sh-mode) ("\\.rs\\'" . rustic-mode) ("/README\\(?:\\.md\\)?\\'" . gfm-mode) ("\\.tsx\\'" . typescript-mode) ("\\.pac\\'" . rjsx-mode) ("\\.es6\\'" . rjsx-mode) ("\\.[mc]?js\\'" . rjsx-mode) ("\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'" . json-mode) ("\\.Cask\\'" . emacs-lisp-mode) ("\\.rss\\'" . nxml-mode) ("\\.xs\\(?:d\\|lt\\)\\'" . nxml-mode) ("\\.p\\(?:list\\|om\\)\\'" . nxml-mode) ("\\.h\\'" . +cc-c-c++-objc-mode) ("\\.mm\\'" . objc-mode) ("\\.pdf\\'" . pdf-view-mode) ("/\\.doomrc\\'" . emacs-lisp-mode) ("/\\.doom\\(?:project\\|module\\|profile\\)?\\'" . lisp-data-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.tsx?\\'" . typescript-mode) ("\\.jsx\\'" . rjsx-mode) ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:l..." . json-mode) ...) 0 nil nil)
  cl-position(nil (("\\.conf$" . bitbake-mode) ("\\.bbclass$" . bitbake-mode) ("\\.bbappend$" . bitbake-mode) ("\\.inc$" . bitbake-mode) ("\\.bb$" . bitbake-mode) ("\\.ya?ml\\'" . yaml-ts-mode) ("\\.ts\\'" . typescript-ts-mode) ("\\.tsx\\'" . tsx-ts-mode) ("\\.toml\\'" . toml-ts-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-ts-mode) ("\\.py[iw]?\\'" . python-ts-mode) ("\\.json\\'" . json-ts-mode) ("\\.js\\'" . js-ts-mode) ("\\.java\\'" . java-ts-mode) ("go\\.mod\\'" . go-mod-ts-mode) ("\\.go\\'" . go-ts-mode) (nil . glsl-ts-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?..." . dockerfile-ts-mode) ("\\.css\\'" . css-ts-mode) ("\\.cpp\\'" . c++-ts-mode) ("\\.cmake\\'" . cmake-ts-mode) ("\\.cs\\'" . csharp-ts-mode) ("\\.c\\'" . c-ts-mode) ("\\.sh\\'" . bash-ts-mode) ("\\.[pP][dD][fF]\\'" . pdf-view-mode) ("Procfile\\'" . yaml-mode) ("/bspwmrc\\'" . sh-mode) ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode) ("\\.bats\\'" . sh-mode) ("\\.rs\\'" . rustic-mode) ("/README\\(?:\\.md\\)?\\'" . gfm-mode) ("\\.tsx\\'" . typescript-mode) ("\\.pac\\'" . rjsx-mode) ("\\.es6\\'" . rjsx-mode) ("\\.[mc]?js\\'" . rjsx-mode) ("\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'" . json-mode) ("\\.Cask\\'" . emacs-lisp-mode) ("\\.rss\\'" . nxml-mode) ("\\.xs\\(?:d\\|lt\\)\\'" . nxml-mode) ("\\.p\\(?:list\\|om\\)\\'" . nxml-mode) ("\\.h\\'" . +cc-c-c++-objc-mode) ("\\.mm\\'" . objc-mode) ("\\.pdf\\'" . pdf-view-mode) ("/\\.doomrc\\'" . emacs-lisp-mode) ("/\\.doom\\(?:project\\|module\\|profile\\)?\\'" . lisp-data-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.tsx?\\'" . typescript-mode) ("\\.jsx\\'" . rjsx-mode) ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:l..." . json-mode) ...) :if #f(compiled-function (it) #<bytecode -0x631c5a76de119ba>))
  cl-find(nil (("\\.conf$" . bitbake-mode) ("\\.bbclass$" . bitbake-mode) ("\\.bbappend$" . bitbake-mode) ("\\.inc$" . bitbake-mode) ("\\.bb$" . bitbake-mode) ("\\.ya?ml\\'" . yaml-ts-mode) ("\\.ts\\'" . typescript-ts-mode) ("\\.tsx\\'" . tsx-ts-mode) ("\\.toml\\'" . toml-ts-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-ts-mode) ("\\.py[iw]?\\'" . python-ts-mode) ("\\.json\\'" . json-ts-mode) ("\\.js\\'" . js-ts-mode) ("\\.java\\'" . java-ts-mode) ("go\\.mod\\'" . go-mod-ts-mode) ("\\.go\\'" . go-ts-mode) (nil . glsl-ts-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?..." . dockerfile-ts-mode) ("\\.css\\'" . css-ts-mode) ("\\.cpp\\'" . c++-ts-mode) ("\\.cmake\\'" . cmake-ts-mode) ("\\.cs\\'" . csharp-ts-mode) ("\\.c\\'" . c-ts-mode) ("\\.sh\\'" . bash-ts-mode) ("\\.[pP][dD][fF]\\'" . pdf-view-mode) ("Procfile\\'" . yaml-mode) ("/bspwmrc\\'" . sh-mode) ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode) ("\\.bats\\'" . sh-mode) ("\\.rs\\'" . rustic-mode) ("/README\\(?:\\.md\\)?\\'" . gfm-mode) ("\\.tsx\\'" . typescript-mode) ("\\.pac\\'" . rjsx-mode) ("\\.es6\\'" . rjsx-mode) ("\\.[mc]?js\\'" . rjsx-mode) ("\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'" . json-mode) ("\\.Cask\\'" . emacs-lisp-mode) ("\\.rss\\'" . nxml-mode) ("\\.xs\\(?:d\\|lt\\)\\'" . nxml-mode) ("\\.p\\(?:list\\|om\\)\\'" . nxml-mode) ("\\.h\\'" . +cc-c-c++-objc-mode) ("\\.mm\\'" . objc-mode) ("\\.pdf\\'" . pdf-view-mode) ("/\\.doomrc\\'" . emacs-lisp-mode) ("/\\.doom\\(?:project\\|module\\|profile\\)?\\'" . lisp-data-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.tsx?\\'" . typescript-mode) ("\\.jsx\\'" . rjsx-mode) ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:l..." . json-mode) ...) :if #f(compiled-function (it) #<bytecode -0x631c5a76de119ba>))
  cl-find-if(#f(compiled-function (it) #<bytecode -0x631c5a76de119ba>) (("\\.conf$" . bitbake-mode) ("\\.bbclass$" . bitbake-mode) ("\\.bbappend$" . bitbake-mode) ("\\.inc$" . bitbake-mode) ("\\.bb$" . bitbake-mode) ("\\.ya?ml\\'" . yaml-ts-mode) ("\\.ts\\'" . typescript-ts-mode) ("\\.tsx\\'" . tsx-ts-mode) ("\\.toml\\'" . toml-ts-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-ts-mode) ("\\.py[iw]?\\'" . python-ts-mode) ("\\.json\\'" . json-ts-mode) ("\\.js\\'" . js-ts-mode) ("\\.java\\'" . java-ts-mode) ("go\\.mod\\'" . go-mod-ts-mode) ("\\.go\\'" . go-ts-mode) (nil . glsl-ts-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?..." . dockerfile-ts-mode) ("\\.css\\'" . css-ts-mode) ("\\.cpp\\'" . c++-ts-mode) ("\\.cmake\\'" . cmake-ts-mode) ("\\.cs\\'" . csharp-ts-mode) ("\\.c\\'" . c-ts-mode) ("\\.sh\\'" . bash-ts-mode) ("\\.[pP][dD][fF]\\'" . pdf-view-mode) ("Procfile\\'" . yaml-mode) ("/bspwmrc\\'" . sh-mode) ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode) ("\\.bats\\'" . sh-mode) ("\\.rs\\'" . rustic-mode) ("/README\\(?:\\.md\\)?\\'" . gfm-mode) ("\\.tsx\\'" . typescript-mode) ("\\.pac\\'" . rjsx-mode) ("\\.es6\\'" . rjsx-mode) ("\\.[mc]?js\\'" . rjsx-mode) ("\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'" . json-mode) ("\\.Cask\\'" . emacs-lisp-mode) ("\\.rss\\'" . nxml-mode) ("\\.xs\\(?:d\\|lt\\)\\'" . nxml-mode) ("\\.p\\(?:list\\|om\\)\\'" . nxml-mode) ("\\.h\\'" . +cc-c-c++-objc-mode) ("\\.mm\\'" . objc-mode) ("\\.pdf\\'" . pdf-view-mode) ("/\\.doomrc\\'" . emacs-lisp-mode) ("/\\.doom\\(?:project\\|module\\|profile\\)?\\'" . lisp-data-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.tsx?\\'" . typescript-mode) ("\\.jsx\\'" . rjsx-mode) ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:l..." . json-mode) ...))
  nerd-icons-match-to-alist("/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." (("\\.conf$" . bitbake-mode) ("\\.bbclass$" . bitbake-mode) ("\\.bbappend$" . bitbake-mode) ("\\.inc$" . bitbake-mode) ("\\.bb$" . bitbake-mode) ("\\.ya?ml\\'" . yaml-ts-mode) ("\\.ts\\'" . typescript-ts-mode) ("\\.tsx\\'" . tsx-ts-mode) ("\\.toml\\'" . toml-ts-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-ts-mode) ("\\.py[iw]?\\'" . python-ts-mode) ("\\.json\\'" . json-ts-mode) ("\\.js\\'" . js-ts-mode) ("\\.java\\'" . java-ts-mode) ("go\\.mod\\'" . go-mod-ts-mode) ("\\.go\\'" . go-ts-mode) (nil . glsl-ts-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?..." . dockerfile-ts-mode) ("\\.css\\'" . css-ts-mode) ("\\.cpp\\'" . c++-ts-mode) ("\\.cmake\\'" . cmake-ts-mode) ("\\.cs\\'" . csharp-ts-mode) ("\\.c\\'" . c-ts-mode) ("\\.sh\\'" . bash-ts-mode) ("\\.[pP][dD][fF]\\'" . pdf-view-mode) ("Procfile\\'" . yaml-mode) ("/bspwmrc\\'" . sh-mode) ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode) ("\\.bats\\'" . sh-mode) ("\\.rs\\'" . rustic-mode) ("/README\\(?:\\.md\\)?\\'" . gfm-mode) ("\\.tsx\\'" . typescript-mode) ("\\.pac\\'" . rjsx-mode) ("\\.es6\\'" . rjsx-mode) ("\\.[mc]?js\\'" . rjsx-mode) ("\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'" . json-mode) ("\\.Cask\\'" . emacs-lisp-mode) ("\\.rss\\'" . nxml-mode) ("\\.xs\\(?:d\\|lt\\)\\'" . nxml-mode) ("\\.p\\(?:list\\|om\\)\\'" . nxml-mode) ("\\.h\\'" . +cc-c-c++-objc-mode) ("\\.mm\\'" . objc-mode) ("\\.pdf\\'" . pdf-view-mode) ("/\\.doomrc\\'" . emacs-lisp-mode) ("/\\.doom\\(?:project\\|module\\|profile\\)?\\'" . lisp-data-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.tsx?\\'" . typescript-mode) ("\\.jsx\\'" . rjsx-mode) ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:l..." . json-mode) ...))
  nerd-icons-auto-mode-match?()
  nerd-icons--icon-info-for-buffer()
  nerd-icons-icon-for-buffer()
  doom-modeline-icon-for-buffer()
  doom-modeline-update-buffer-file-icon()
  run-hooks(change-major-mode-after-body-hook after-change-major-mode-hook)
  normal-mode(t)
  #<subr after-find-file>(nil t nil nil nil)
  apply(#<subr after-find-file> (nil t))
  (progn (fset #'sit-for #'ignore) (apply fn args))
  (unwind-protect (progn (fset #'sit-for #'ignore) (apply fn args)) (fset #'sit-for old))
  (let* ((old (symbol-function #'sit-for))) (unwind-protect (progn (fset #'sit-for #'ignore) (apply fn args)) (fset #'sit-for old)))
  doom--shut-up-autosave-a(#<subr after-find-file> nil t)
  apply(doom--shut-up-autosave-a #<subr after-find-file> (nil t))
  #f(advice doom--shut-up-autosave-a :around #<subr after-find-file>)(nil t)
  apply(#f(advice doom--shut-up-autosave-a :around #<subr after-find-file>) (nil t))
  #f(advice chain-doom-first-buffer-hook-to-find-file-hook-h :before #f(advice doom--shut-up-autosave-a :around #<subr after-find-file>) ((depth . -101)))(nil t)
  apply(#f(advice chain-doom-first-buffer-hook-to-find-file-hook-h :before #f(advice doom--shut-up-autosave-a :around #<subr after-find-file>) ((depth . -101))) (nil t))
  after-find-file(nil t)
  find-file-noselect-1(#<buffer ./Stadler/FLIRT/Slowenien/trunk/src/main/c/Project/Project.c> "/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." nil nil "/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." (13792273858903848 82))
  #<subr find-file-noselect>("/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." nil nil nil)
  apply(#<subr find-file-noselect> "/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." (nil nil nil))
  editorconfig--advice-find-file-noselect(#<subr find-file-noselect> "/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." nil nil nil)
  apply(editorconfig--advice-find-file-noselect #<subr find-file-noselect> ("/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." nil nil nil))
  find-file-noselect("/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/..." nil nil nil)
  find-file("/mnt/c/svn/MTB4/Stadler/FLIRT/Slowenien/trunk/src/...")
  #<subr consult-recent-file>()
  apply(#<subr consult-recent-file> nil)
  consult-recent-file()
  funcall-interactively(consult-recent-file)
  command-execute(consult-recent-file)

Without treesit-auto the entry in auto-mode-alist looks like this:
("\.glsl\'" . glsl-mode)

My treesit-auto config looks like this:

(use-package treesit-auto
:custom
  (treesit-auto-install 'prompt)
:config
  (treesit-auto-add-to-auto-mode-alist 'all)
  (global-treesit-auto-mode))

Doing a simple (delete 'glsl treesit-auto-langs) makes nerdicons work again. I don't know what glsl is so I don't care that much for it's ts mode. But something off in treesit-autos generating of auto-mode-alist it seems.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant