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