Skip to content

Commit f59fedd

Browse files
committed
Add json-mode entry to `magic-mode-alist'
1 parent b5e81c5 commit f59fedd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

json-mode.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ This function calls `json-mode--update-auto-mode' to change the
116116
"Major mode for editing JSON files"
117117
(set (make-local-variable 'font-lock-defaults) '(json-font-lock-keywords-1 t)))
118118

119+
;; Well formatted JSON files almost always begin with “{” or “[”.
120+
(add-to-list 'magic-mode-alist '("^[{[]$" . json-mode))
121+
119122
;;;###autoload
120123
(defun json-mode-show-path ()
121124
(interactive)

0 commit comments

Comments
 (0)