Function: keyfreq-json
keyfreq-json is an interactive and natively compiled function defined
in keyfreq.el.
Signature
(keyfreq-json FILENAME &optional CONFIRM)
Documentation
Save a file (as FILENAME) with a JSON structure of the data.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/vs0cnjcny583s3d1i80ya8g63h6xkwrn-emacs-packages-deps/share/emacs/site-lisp/elpa/keyfreq-20231107.106/keyfreq.el
(defun keyfreq-json (filename &optional confirm)
"Save a file (as FILENAME) with a JSON structure of the data."
(interactive
(list (if buffer-file-name
(read-file-name "Write JSON file: "
nil nil nil nil)
(read-file-name "Write JSON file: " default-directory
(expand-file-name
(file-name-nondirectory (buffer-name))
default-directory)
nil nil))
(not current-prefix-arg)))
(and confirm
(file-exists-p filename)
(or (y-or-n-p (format "File `%s' exists; overwrite? " filename))
(error "Canceled")))
(let ((table (copy-hash-table keyfreq-table)))
;; Merge with the values in `keyfreq-file'
(keyfreq-table-load table)
(with-temp-file filename
(insert (keyfreq-json-encode table)))))