1

I am working with GNU Emacs 23.1.1. When working with a .json file it is treated in the Fundamental mode:

enter image description here

How can I have the json file treated in the json mode?

I note that GNU Emacs 24.3.1 opens json files as Javascript which already allows formatting.

Viesturs
  • 805
  • 8
  • 19
  • Does this answer your question? [Make emacs automatically open binary files in hexl-mode](https://emacs.stackexchange.com/questions/10277/make-emacs-automatically-open-binary-files-in-hexl-mode) – Drew Feb 11 '20 at 16:21
  • @Drew the difference between my question and https://emacs.stackexchange.com/questions/10277/make-emacs-automatically-open-binary-files-in-hexl-mode is technically involved therefore my question deserves a separate answer. – Viesturs Feb 11 '20 at 17:20
  • What have you tried to do? Explain why using Emacs-24.3 in javascript-mode is not good enough – Stefan Feb 11 '20 at 23:14
  • Why not upgrade? Your version of Emacs is truly ancient. – Qudit Feb 12 '20 at 00:10
  • @Qudit, I am working on a system where I have no administrative rights. – Viesturs Feb 12 '20 at 12:02
  • @Stefan, I don't know yet if the Javascript mode truly matches up to the Json mode. At least it allows some formatting. – Viesturs Feb 12 '20 at 12:03
  • @Viesturs: "I don't know yet if" makes it sound like you haven't encountered any problem (yet), which makes me think there is no real question. – Stefan Feb 12 '20 at 13:28
  • 1
    @Viesturs You could still install it as a container, an appimage or compile it from source yourself without root. – Qudit Feb 12 '20 at 17:10
  • 1
    @Viesturs - When installing or upgrading emacs on host is not a viable option, I use emacs+tramp on my local machine to login to remote host and edit the file remotely. For example, If I do `C-x C-f /scp:username@remote-hostname:/path/to/file RET` then emacs will login via SCP to remote-hostname as username and open /path/to/file inside emacs on my local machine. I use this feature everyday. – Melioratus Feb 21 '20 at 15:38

1 Answers1

2

Install json-mode might be the simplest.

In my set up (I use straight.el)

simply

(use-package json-mode)
RichieHH
  • 848
  • 4
  • 9