Function: eca-config--json-mode
eca-config--json-mode is a natively compiled function defined in
eca-config.el.
Signature
(eca-config--json-mode)
Documentation
Enable the best available JSON major mode.
Temporarily clears buffer during mode activation so file-based hooks (e.g. LSP) do not trigger — config buffers are not project files.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-config.el
(defun eca-config--json-mode ()
"Enable the best available JSON major mode.
Temporarily clears buffer during mode
activation so file-based hooks (e.g. LSP) do not
trigger — config buffers are not project files."
(let ((file-name buffer-file-name)
(true-name buffer-file-truename))
(setq buffer-file-name nil
buffer-file-truename nil)
(unwind-protect
(cond
((and (fboundp 'json-ts-mode)
(fboundp 'treesit-ready-p)
(treesit-ready-p 'json t))
(json-ts-mode))
((fboundp 'json-mode) (json-mode))
(t (js-mode)))
(setq buffer-file-name file-name
buffer-file-truename true-name))))