From 275c241d241b7a2846cd78d687afa687a57d65e4 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 7 Nov 2024 12:55:33 +0100 Subject: [PATCH] update json-mode Signed-off-by: Andreas Gerler --- elpa/json-mode-20230717.818/json-mode-pkg.el | 13 ----- .../json-mode-autoloads.el | 45 ++++++--------- elpa/json-mode-20240427.1245/json-mode-pkg.el | 8 +++ .../json-mode.el | 55 ++++++++++++++++--- 4 files changed, 73 insertions(+), 48 deletions(-) delete mode 100644 elpa/json-mode-20230717.818/json-mode-pkg.el rename elpa/{json-mode-20230717.818 => json-mode-20240427.1245}/json-mode-autoloads.el (78%) create mode 100644 elpa/json-mode-20240427.1245/json-mode-pkg.el rename elpa/{json-mode-20230717.818 => json-mode-20240427.1245}/json-mode.el (84%) diff --git a/elpa/json-mode-20230717.818/json-mode-pkg.el b/elpa/json-mode-20230717.818/json-mode-pkg.el deleted file mode 100644 index 228dfb76..00000000 --- a/elpa/json-mode-20230717.818/json-mode-pkg.el +++ /dev/null @@ -1,13 +0,0 @@ -(define-package "json-mode" "20230717.818" "Major mode for editing JSON files" - '((json-snatcher "1.0.0") - (emacs "24.4")) - :commit "20b9c21f44c58e94256c7826d0821205e017dfbb" :authors - '(("Josh Johnston")) - :maintainers - '(("Josh Johnston")) - :maintainer - '("Josh Johnston") - :url "https://github.com/joshwnj/json-mode") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/json-mode-20230717.818/json-mode-autoloads.el b/elpa/json-mode-20240427.1245/json-mode-autoloads.el similarity index 78% rename from elpa/json-mode-20230717.818/json-mode-autoloads.el rename to elpa/json-mode-20240427.1245/json-mode-autoloads.el index 707273cb..3da9c76a 100644 --- a/elpa/json-mode-20230717.818/json-mode-autoloads.el +++ b/elpa/json-mode-20240427.1245/json-mode-autoloads.el @@ -1,71 +1,62 @@ -;;; json-mode-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; json-mode-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "json-mode" "json-mode.el" (0 0 0 0)) ;;; Generated autoloads from json-mode.el (defconst json-mode-standard-file-ext '(".json" ".jsonld") "\ List of JSON file extensions.") - (defsubst json-mode--update-auto-mode (filenames) "\ Update the `json-mode' entry of `auto-mode-alist'. FILENAMES should be a list of file as string. Return the new `auto-mode-alist' entry" (let* ((new-regexp (rx-to-string `(seq (eval (cons 'or (append json-mode-standard-file-ext ',filenames))) eot))) (new-entry (cons new-regexp 'json-mode)) (old-entry (when (boundp 'json-mode--auto-mode-entry) json-mode--auto-mode-entry))) (setq auto-mode-alist (delete old-entry auto-mode-alist)) (add-to-list 'auto-mode-alist new-entry) new-entry)) - (defvar json-mode-auto-mode-list '(".babelrc" ".bowerrc" "composer.lock") "\ List of filenames for the JSON entry of `auto-mode-alist'. Note however that custom `json-mode' entries in `auto-mode-alist' won’t be affected.") - (custom-autoload 'json-mode-auto-mode-list "json-mode" nil) - (defvar json-mode--auto-mode-entry (json-mode--update-auto-mode json-mode-auto-mode-list) "\ Regexp generated from the `json-mode-auto-mode-list'.") - (autoload 'json-mode "json-mode" "\ Major mode for editing JSON files. -\(fn)" t nil) - +(fn)" t) (autoload 'jsonc-mode "json-mode" "\ Major mode for editing JSON files with comments. -\(fn)" t nil) - +(fn)" t) (add-to-list 'magic-fallback-mode-alist '("^[{[]$" . json-mode)) - (autoload 'json-mode-show-path "json-mode" "\ -Print the path to the node at point to the minibuffer." t nil) - +Print the path to the node at point to the minibuffer." t) (autoload 'json-mode-kill-path "json-mode" "\ -Save JSON path to object at point to kill ring." t nil) - +Save JSON path to object at point to kill ring." t) (autoload 'json-mode-beautify "json-mode" "\ Beautify/pretty-print from BEGIN to END. If the region is not active, beautify the entire buffer . -\(fn BEGIN END)" t nil) - +(fn BEGIN END)" t) (register-definition-prefixes "json-mode" '("json")) - -;;;*** -;;;### (autoloads nil nil ("json-mode-pkg.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'json-mode-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; json-mode-autoloads.el ends here diff --git a/elpa/json-mode-20240427.1245/json-mode-pkg.el b/elpa/json-mode-20240427.1245/json-mode-pkg.el new file mode 100644 index 00000000..3edf5f72 --- /dev/null +++ b/elpa/json-mode-20240427.1245/json-mode-pkg.el @@ -0,0 +1,8 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "json-mode" "20240427.1245" + "Major mode for editing JSON files." + '((json-snatcher "1.0.0") + (emacs "24.4")) + :url "https://github.com/json-emacs/json-mode" + :commit "77125b01c0ddce537085201098bea9b4b8ba6be3" + :revdesc "77125b01c0dd") diff --git a/elpa/json-mode-20230717.818/json-mode.el b/elpa/json-mode-20240427.1245/json-mode.el similarity index 84% rename from elpa/json-mode-20230717.818/json-mode.el rename to elpa/json-mode-20240427.1245/json-mode.el index 98105822..7a9519fb 100644 --- a/elpa/json-mode-20230717.818/json-mode.el +++ b/elpa/json-mode-20240427.1245/json-mode.el @@ -1,10 +1,12 @@ -;;; json-mode.el --- Major mode for editing JSON files +;;; json-mode.el --- Major mode for editing JSON files -*- lexical-binding: t; -*- -;; Copyright (C) 2011-2014 Josh Johnston +;; Copyright (C) 2011-2023 Josh Johnston, taku0 ;; Author: Josh Johnston +;; taku0 ;; URL: https://github.com/joshwnj/json-mode -;; Version: 1.6.0 +;; Package-Version: 20240427.1245 +;; Package-Revision: 77125b01c0dd ;; Package-Requires: ((json-snatcher "1.0.0") (emacs "24.4")) ;; This program is free software; you can redistribute it and/or modify @@ -124,8 +126,16 @@ This function calls `json-mode--update-auto-mode' to change the (modify-syntax-entry ?\" "\"" st) ;; Comments (modify-syntax-entry ?\n ">" st) + ;; Dot in floating point number literal. + (modify-syntax-entry ?. "_" st) st)) +(defvar json-mode--string-syntax-table + (let ((st (copy-syntax-table json-mode-syntax-table))) + (modify-syntax-entry ?. "." st) + st) + "Syntax table for strings.") + (defvar jsonc-mode-syntax-table (let ((st (copy-syntax-table json-mode-syntax-table))) ;; Comments @@ -135,13 +145,19 @@ This function calls `json-mode--update-auto-mode' to change the (modify-syntax-entry ?* ". 23bn" st) st)) +(defvar jsonc-mode--string-syntax-table + (let ((st (copy-syntax-table jsonc-mode-syntax-table))) + (modify-syntax-entry ?. "." st) + st) + "Syntax table for strings and comments.") + (defun json-mode--syntactic-face (state) "Return syntactic face function for the position represented by STATE. STATE is a `parse-partial-sexp' state, and the returned function is the json font lock syntactic face function." (cond ((nth 3 state) - ;; This might be a string or a name + ;; This might be a string or a name (let ((startpos (nth 8 state))) (save-excursion (goto-char startpos) @@ -150,6 +166,29 @@ json font lock syntactic face function." font-lock-string-face)))) ((nth 4 state) font-lock-comment-face))) +(defun json-mode-forward-sexp (&optional arg) + "Move point forward an atom or balanced bracket. + +See `forward-sexp for ARG." + (interactive "p") + (unless arg + (setq arg 1)) + (let ((forward-sexp-function nil) + (sign (if (< arg 0) -1 1)) + state) + (while (not (zerop arg)) + (setq state (syntax-ppss)) + (if (nth 8 state) + ;; Inside a string or comment. + (progn + (with-syntax-table + (if (eq major-mode 'jsonc-mode) + jsonc-mode--string-syntax-table + json-mode--string-syntax-table) + (forward-sexp sign))) + (forward-sexp sign)) + (setq arg (- arg sign))))) + ;;;###autoload (define-derived-mode json-mode javascript-mode "JSON" "Major mode for editing JSON files." @@ -157,13 +196,13 @@ json font lock syntactic face function." (setq font-lock-defaults '(json-font-lock-keywords-1 nil nil nil nil - (font-lock-syntactic-face-function . json-mode--syntactic-face)))) + (font-lock-syntactic-face-function . json-mode--syntactic-face))) + (setq-local forward-sexp-function #'json-mode-forward-sexp)) ;;;###autoload (define-derived-mode jsonc-mode json-mode "JSONC" "Major mode for editing JSON files with comments." :syntax-table jsonc-mode-syntax-table) - (setq font-lock-defaults '(json-font-lock-keywords-1 t)) ;; Well formatted JSON files almost always begin with “{” or “[”. ;;;###autoload @@ -233,7 +272,7 @@ If the region is not active, beautify the entire buffer ." ((setq symbol (bounds-of-thing-at-point 'symbol)) (cond ((looking-at-p "null")) - ((save-excursion (skip-chars-backward "[-0-9.]") (looking-at json-mode-number-re)) + ((save-excursion (skip-chars-backward "-0-9.") (looking-at json-mode-number-re)) (kill-region (match-beginning 0) (match-end 0)) (insert "null")) (t (kill-region (car symbol) (cdr symbol)) (insert "null")))) @@ -248,7 +287,7 @@ If the region is not active, beautify the entire buffer ." (defun json-increment-number-at-point (&optional delta) "Add DELTA to the number at point; DELTA defaults to 1." (interactive "P") - (when (save-excursion (skip-chars-backward "[-0-9.]") (looking-at json-mode-number-re)) + (when (save-excursion (skip-chars-backward "-0-9.") (looking-at json-mode-number-re)) (let ((num (+ (or delta 1) (string-to-number (buffer-substring-no-properties (match-beginning 0) (match-end 0))))) (pt (point))) -- 2.47.3