<commit_before>;;; module-web.el

(add-hook! (sass-mode scss-mode less-css-mode)
  '(flycheck-mode narf|hl-line-off hs-minor-mode))

(push '("css" "scss" "sass" "less" "styl") projectile-other-file-alist)

(use-package haml-mode :mode "\\.haml$")

(use-package stylus-mode :mode "\\.styl$"
  :config (push '("styl" "css") projectile-other-file-alist))

(use-package less-css-mode :mode "\\.less$"
  :config (push '("less" "css") projectile-other-file-alist))

(use-package sass-mode :mode "\\.sass$"
  :config
  (def-company-backend! sass-mode (css))
  (def-docset! sass-mode "sass,bourbon")
  (push '("sass" "css") projectile-other-file-alist))

(use-package scss-mode
  :mode "\\.scss$"
  :preface (require 'css-mode)
  :init (setq scss-compile-at-save nil)
  :config
  (def-company-backend! scss-mode (css))
  (def-docset! scss-mode "sass,bourbon")
  (push '("scss" "css") projectile-other-file-alist)
  (sp-local-pair 'scss-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))

  (map! :map scss-mode-map
        :n "M-r" 'narf/web-refresh-browser
        (:localleader :nv ";" 'narf/append-semicolon)
        (:leader
          :n ";" 'helm-css-scss
          :n ":" 'helm-css-scss-multi))

  (after! emr
    (emr-declare-command 'narf/scss-toggle-inline-or-block
      :title "toggle inline/block"
      :modes 'scss-mode
      :predicate (lambda () (not (use-region-p))))))

(use-package jaded-mode
  :load-path "/Volumes/hlissner/Dropbox/work/plugins/jaded-mode"
  :mode "\\.jade$"
  :config
  (push '("jade" "html") projectile-other-file-alist)
  (map! :map jaded-mode-map
        :i [tab] 'narf/dumb-indent
        :i [backtab] 'narf/dumb-dedent))

(use-package web-mode
  :mode ("\\.p?html?$"
         "\\.\\(tpl\\|blade\\)\\(\\.php\\)?$"
         "\\.erb$"
         "\\.jsp$"
         "\\.as[cp]x$"
         "\\.mustache$"
         "wp-content/themes/.+/.+\\.php$")
  :init
  (add-hook 'web-mode-hook 'turn-off-smartparens-mode)

  :config
  (setq web-mode-enable-html-entities-fontification t)
  (push '("html" "jade") projectile-other-file-alist)

  (map! :map web-mode-map :i "SPC" 'self-insert-command)

  (after! nlinum
    ;; Fix blank line numbers after unfolding<commit_msg>module-web: refactor and fix company backends for css/sass/scss<commit_after>;;; module-web.el

;;
;; CSS modes
;;

(use-package css-mode
  :mode "\\.css$"
  :config
  (def-company-backend! css-mode (css yasnippet))
  (push '("css" "scss" "sass" "less" "styl") projectile-other-file-alist))

(after! emr
  (emr-declare-command 'narf/css-toggle-inline-or-block
    :title "toggle inline/block"
    :modes '(css-mode less-css-mode scss-mode)
    :predicate (lambda () (not (use-region-p)))))

(setq scss-compile-at-save nil
      scss-sass-options '("--style" "compressed"))
(add-hook! (scss-mode sass-mode less-css-mode) 'yas-minor-mode-on)

(use-package stylus-mode
  :mode "\\.styl$"
  :config (push '("styl" "css") projectile-other-file-alist))

(use-package less-css-mode
  :mode "\\.less$"
  :init (add-hook 'less-css-mode 'flycheck-mode)
  :config (push '("less" "css") projectile-other-file-alist))

(use-package sass-mode
  :mode "\\.sass$"
  :init (add-hook 'sass-mode 'flycheck-mode)
  :config
  (def-builder! scss-mode narf/sass-build)
  (def-company-backend! sass-mode (css yasnippet))
  (def-docset! sass-mode "sass,bourbon")
  (push '("sass" "css") projectile-other-file-alist))

(use-package scss-mode
  :mode "\\.scss$"
  :preface (require 'css-mode) ; to fix cascading fontification issue
  :init (add-hook 'scss-mode 'flycheck-mode)
  :config
  (def-builder! scss-mode narf/scss-build)
  (def-company-backend! scss-mode (css yasnippet))
  (def-docset! scss-mode "sass,bourbon")
  (push '("scss" "css") projectile-other-file-alist)
  (sp-local-pair 'scss-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))

  (map! :map scss-mode-map
        :n "M-R" 'narf/web-refresh-browser
        (:localleader :nv ";" 'narf/append-semicolon)
        (:leader
          :n ";" 'helm-css-scss
          :n ":" 'helm-css-scss-multi)))


;;
;; Markup modes
;;

(use-package haml-mode :mode "\\.haml$")

(use-package jaded-mode
  :load-path "/Volumes/hlissner/Dropbox/work/plugins/jaded-mode"
  :mode "\\.jade$"
  :config
  (push '("jade" "html") projectile-other-file-alist)
  (map! :map jaded-mode-map
        :i [tab] 'narf/dumb-indent
        :i [backtab] 'narf/dumb-dedent))

(use-package web-mode
  :mode ("\\.p?html?$"
         "\\.\\(tpl\\|blade\\)\\(\\.php\\)?$"
         "\\.erb$"
         "\\.jsp$"
         "\\.as[cp]x$"
         "\\.mustache$"
         "wp-content/themes/.+/.+\\.php$")
  :init
  (add-hook 'web-mode-hook 'turn-off-smartparens-mode)

  :config
  (setq web-mode-enable-html-entities-fontification t)
  (push '("html" "jade") projectile-other-file-alist)

  (map! :map web-mode-map :i "SPC" 'self-insert-command)

  (after! nlinum
    ;; Fix blank line numbers after unfolding
{'fraction_non_alphanumeric': 0.21524118362383463, 'fraction_numerical': 0.00040535062829347385, 'mean_word_length': 2.973429951690821, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3355111', 'n_tokens_mistral': 2077, 'n_tokens_neox': 2030, 'n_words': 374}