<commit_before>(defvar javascript-packages
  '(
    coffee-mode
    js2-mode
    js2-refactor
    tern
    tern-auto-complete
    )
  "List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")

(defun javascript/init-coffee-mode ()
  (use-package coffee-mode
    :defer t
    :init
    (progn
      (defun javascript/coffee-indent ()
        (if (coffee-line-wants-indent)
            ;; We need to insert an additional tab because the last line was special.
            (coffee-insert-spaces (+ (coffee-previous-indent) coffee-tab-width))
          ;; otherwise keep at the same indentation level
          (coffee-insert-spaces (coffee-previous-indent)))
        )
      ;; indent to right position after `evil-open-blow' and `evil-open-above'
      (add-hook 'coffee-mode-hook '(lambda ()
                                     (setq indent-line-function 'javascript/coffee-indent
                                           evil-shift-width coffee-tab-width))))))

(defun javascript/init-js2-mode ()
  (use-package js2-mode
    :defer t
    :init (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
    :config
    (progn
      ;;(spacemacs/declare-prefix-for-mode 'js2-mode "m" "major mode")

      (evil-leader/set-key-for-mode 'js2-mode "mw" 'js2-mode-toggle-warnings-and-errors)

      ;;(spacemacs/declare-prefix-for-mode 'js2-mode "mz" "folding")
      (evil-leader/set-key-for-mode 'js2-mode "mzc" 'js2-mode-hide-element)
      (evil-leader/set-key-for-mode 'js2-mode "mzo" 'js2-mode-show-element)
      (evil-leader/set-key-for-mode 'js2-mode "mzr" 'js2-mode-show-all)
      (evil-leader/set-key-for-mode 'js2-mode "mze" 'js2-mode-toggle-element)
      (evil-leader/set-key-for-mode 'js2-mode "mzF" 'js2-mode-toggle-hide-functions)
      (evil-leader/set-key-for-mode 'js2-mode "mzC" 'js2-mode-toggle-hide-comments))))

(defun javascript/init-js2-refactor ()
  (use-package js2-refactor
    :defer t
    :init (eval-after-load 'js2-mode '(require 'js2-refactor))<commit_msg>enabled js2-imenu-extra-mode in javascript mode<commit_after>(defvar javascript-packages
  '(
    coffee-mode
    js2-mode
    js2-refactor
    tern
    tern-auto-complete
    )
  "List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")

(defun javascript/init-coffee-mode ()
  (use-package coffee-mode
    :defer t
    :init
    (progn
      (defun javascript/coffee-indent ()
        (if (coffee-line-wants-indent)
            ;; We need to insert an additional tab because the last line was special.
            (coffee-insert-spaces (+ (coffee-previous-indent) coffee-tab-width))
          ;; otherwise keep at the same indentation level
          (coffee-insert-spaces (coffee-previous-indent)))
        )
      ;; indent to right position after `evil-open-blow' and `evil-open-above'
      (add-hook 'coffee-mode-hook '(lambda ()
                                     (setq indent-line-function 'javascript/coffee-indent
                                           evil-shift-width coffee-tab-width))))))

(defun javascript/init-js2-mode ()
  (use-package js2-mode
    :defer t
    :init
    (progn
      (add-hook 'js2-mode-hook 'js2-imenu-extras-mode)
      (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)))
    :config
    (progn
      ;;(spacemacs/declare-prefix-for-mode 'js2-mode "m" "major mode")

      (evil-leader/set-key-for-mode 'js2-mode "mw" 'js2-mode-toggle-warnings-and-errors)

      ;;(spacemacs/declare-prefix-for-mode 'js2-mode "mz" "folding")
      (evil-leader/set-key-for-mode 'js2-mode "mzc" 'js2-mode-hide-element)
      (evil-leader/set-key-for-mode 'js2-mode "mzo" 'js2-mode-show-element)
      (evil-leader/set-key-for-mode 'js2-mode "mzr" 'js2-mode-show-all)
      (evil-leader/set-key-for-mode 'js2-mode "mze" 'js2-mode-toggle-element)
      (evil-leader/set-key-for-mode 'js2-mode "mzF" 'js2-mode-toggle-hide-functions)
      (evil-leader/set-key-for-mode 'js2-mode "mzC" 'js2-mode-toggle-hide-comments))))

(defun javascript/init-js2-refactor ()
  (use-package js2-refactor
    :defer t
    :init (eval-after-load 'js2-mode '(require 'js2-refactor))
{'fraction_non_alphanumeric': 0.14521063779712873, 'fraction_numerical': 0.01247352318192516, 'mean_word_length': 2.5066006600660065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3610930', 'n_tokens_mistral': 1571, 'n_tokens_neox': 1460, 'n_words': 291}