mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
lang/{javascript,cc}: fix empty buffer-file-name in magic-mode-alist
This commit is contained in:
@ -6,7 +6,8 @@
|
||||
:init
|
||||
;; Auto-detect C++ header files
|
||||
(push (cons (lambda ()
|
||||
(and (equal (file-name-extension buffer-file-name) "h")
|
||||
(and buffer-file-name
|
||||
(equal (file-name-extension buffer-file-name) "h")
|
||||
(or (file-exists-p (expand-file-name
|
||||
(concat (file-name-sans-extension buffer-file-name)
|
||||
".cpp")))
|
||||
@ -18,8 +19,10 @@
|
||||
magic-mode-alist)
|
||||
|
||||
;; Auto-detect Obj-C header files
|
||||
(push (cons (lambda () (and (equal (file-name-extension buffer-file-name) "h")
|
||||
(re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))
|
||||
(push (cons (lambda ()
|
||||
(and buffer-file-name
|
||||
(equal (file-name-extension buffer-file-name) "h")
|
||||
(re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))
|
||||
'objc-mode)
|
||||
magic-mode-alist)
|
||||
|
||||
|
@ -107,7 +107,8 @@
|
||||
:init
|
||||
;; auto-detect JSX file
|
||||
(push (cons (lambda ()
|
||||
(and (equal (file-name-extension buffer-file-name) "js")
|
||||
(and buffer-file-name
|
||||
(equal (file-name-extension buffer-file-name) "js")
|
||||
(re-search-forward "\\(^\\s-*import React\\|\\( from \\|require(\\)[\"']react\\)"
|
||||
magic-mode-regexp-match-limit t)
|
||||
(progn
|
||||
|
Reference in New Issue
Block a user