Skip to content

Guard against empty :ext on treesit-auto-add-to-auto-mode-alist #134

@bvraghav

Description

@bvraghav

An unguarded (add-to-list 'auto-mode-alist ...) introduces a bug in 'auto-mode-alist e.g. the following entry

'(nil . glsl-mode)

This miserably fails at every file visitation, because
(set-auto-mode) would eventually do
(assoc-default filename auto-mode-alist #'string-match) wherein
(string-match nil filename) raises the following error:

(wrong-type-argument stringp nil)

PS: In treesit-auto.el:

(add-to-list 'auto-mode-alist
             (cons (treesit-auto-recipe-ext r) (treesit-auto-recipe-ts-mode r)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions