Configurations for GNU Emacs

Table of Contents

1. はじめに

1.1. 基本情報

2. Initialize

2.1. Header

;; init.el --- My init.el -*- lexical-binding: t -*-
;; Configurations for Emacs
;;                                         Takeo Obara  <bararararatty@gmail.com>

2.2. env

(defconst my/loading-profile-p nil
  "If non-nil, use built-in profiler.el.")

(defconst my/enable-profile nil
  "If true, enable profile")

(defconst my/enable-c-h-backspace nil
  "If true, enable C-h backspace")

3. Macro Utilities

3.1. when-darwin

(defmacro when-darwin (&rest body)
  (when (string= system-type "darwin")
    `(progn ,@body)))

3.2. when-darwin-not-window-system

(defmacro when-darwin-not-window-system (&rest body)
  (when (and (string= system-type "darwin")
             window-system)
    `(progn ,@body)))

3.3. when-guix

(defmacro when-guix (&rest body)
  (when (string= system-type "guix")
    `(progn ,@body)))

4. Boot

4.1. user

(setq user-full-name "takeokunn")
(setq user-mail-address "bararararatty@gmail.com")

4.2. profile

(when my/enable-profile
  (require 'profiler)
  (profiler-start 'cpu))

4.3. Magic File Name を一時的に無効にする

(defconst my/saved-file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)

4.4. 起動時間計測

(defconst my/before-load-init-time (current-time))

;;;###autoload
(defun my/load-init-time ()
  "Loading time of user init files including time for `after-init-hook'."
  (let ((time1 (float-time
                (time-subtract after-init-time my/before-load-init-time)))
        (time2 (float-time
                (time-subtract (current-time) my/before-load-init-time))))
    (message (concat "Loading init files: %.0f [msec], "
                     "of which %.f [msec] for `after-init-hook'.")
             (* 1000 time1) (* 1000 (- time2 time1)))))
(add-hook 'after-init-hook #'my/load-init-time t)

(defvar my/tick-previous-time my/before-load-init-time)

;;;###autoload
(defun my/tick-init-time (msg)
  "Tick boot sequence at loading MSG."
  (when my/loading-profile-p
    (let ((ctime (current-time)))
      (message "---- %5.2f[ms] %s"
               (* 1000 (float-time
                        (time-subtract ctime my/tick-previous-time)))
               msg)
      (setq my/tick-previous-time ctime))))

(defun my/emacs-init-time ()
  "Emacs booting time in msec."
  (interactive)
  (message "Emacs booting time: %.0f [msec] = `emacs-init-time'."
           (* 1000
              (float-time (time-subtract
                           after-init-time
                           before-init-time)))))

(add-hook 'after-init-hook #'my/emacs-init-time)

4.5. async load

(defvar my/delayed-priority-high-configurations '())
(defvar my/delayed-priority-high-configuration-timer nil)

(defvar my/delayed-priority-low-configurations '())
(defvar my/delayed-priority-low-configuration-timer nil)

(add-hook 'emacs-startup-hook
          (lambda ()
            (setq my/delayed-priority-high-configuration-timer
                  (run-with-timer
                   0.1 0.001
                   (lambda ()
                     (if my/delayed-priority-high-configurations
                         (let ((inhibit-message t))
                           (eval (pop my/delayed-priority-high-configurations)))
                       (progn
                         (cancel-timer my/delayed-priority-high-configuration-timer))))))
            (setq my/delayed-priority-low-configuration-timer
                  (run-with-timer
                   0.3 0.001
                   (lambda ()
                     (if my/delayed-priority-low-configurations
                         (let ((inhibit-message t))
                           (eval (pop my/delayed-priority-low-configurations)))
                       (progn
                         (cancel-timer my/delayed-priority-low-configuration-timer))))))))

(defmacro with-delayed-execution-priority-high (&rest body)
  (declare (indent 0))
  `(setq my/delayed-priority-high-configurations
         (append my/delayed-priority-high-configurations ',body)))

(defmacro with-delayed-execution (&rest body)
  (declare (indent 0))
  `(setq my/delayed-priority-low-configurations
         (append my/delayed-priority-low-configurations ',body)))

4.6. autoload-if-found

;;;###autoload
(defun autoload-if-found (functions file &optional docstring interactive type)
  "set autoload iff. FILE has found."
  (when (locate-library file)
    (dolist (f functions)
      (autoload f file docstring interactive type))
    t))

4.7. common lispを使う

(eval-and-compile
  (setq byte-compile-warnings '(cl-functions))
  (require 'cl-lib nil t))

(with-delayed-execution-priority-high
  (message "Install cl-lib...")
  (require 'cl-lib))

4.8. el-clone

(eval-when-compile
  (unless (file-directory-p (locate-user-emacs-file "elpa/el-clone"))
    (package-vc-install "https://github.com/takeokunn/el-clone.git")))

(eval-and-compile
  (add-to-list 'load-path (locate-user-emacs-file "elpa/el-clone"))
  (require 'el-clone))

4.9. flymake初期化

(require 'flymake)
(require 'flymake-proc)

5. Basic

5.1. 末尾のスペースを可視化する

(with-delayed-execution
  (message "Install disable-show-trailing-whitespace...")

  (defun my/disable-show-trailing-whitespace ()
    (setq show-trailing-whitespace nil))

  (with-eval-after-load 'comint
    (add-hook 'comint-mode-hook #'my/disable-show-trailing-whitespace))

  (with-eval-after-load 'esh-mode
    (add-hook 'eshell-mode-hook #'my/disable-show-trailing-whitespace))

  (with-eval-after-load 'eww
    (add-hook 'eww-mode-hook #'my/disable-show-trailing-whitespace))

  (with-eval-after-load 'minibuffer
    (add-hook 'minibuffer-inactive-mode-hook #'my/disable-show-trailing-whitespace))

  (with-eval-after-load 'dashboard
    (add-hook 'dashboard-mode-hook #'my/disable-show-trailing-whitespace))

  (with-eval-after-load 'simple
    (add-hook 'fundamental-mode-hook #'my/disable-show-trailing-whitespace)))

5.2. 行番号を表示する

(with-delayed-execution
  (message "Install display-line-numbers...")
  (autoload-if-found '(global-display-line-numbers-mode) "display-line-numbers" nil t)
  (global-display-line-numbers-mode)

  (with-eval-after-load 'display-line-numbers
    (setq display-line-numbers-grow-only t)))

5.3. C-kで行削除

(with-eval-after-load 'simple
  (setq kill-whole-line t))

5.4. カッコの中をハイライトする

(with-delayed-execution
  (message "Install show-paren-mode...")
  (show-paren-mode t)

  (with-eval-after-load 'paren
    (setq show-paren-style 'mixed)))

5.5. カッコが自動的に作られるようにする

(with-delayed-execution
  (message "Install electric-pair-mode...")
  (electric-pair-mode 1))

5.6. coding system

;; language and locale
(setq system-time-locale "C")

;; coding system
(set-default-coding-systems 'utf-8-unix)
(prefer-coding-system 'utf-8-unix)
(set-selection-coding-system 'utf-8-unix)

;; prefer-coding-system take effect equally to follows
(set-buffer-file-coding-system 'utf-8-unix)
(set-file-name-coding-system 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(setq locale-coding-system 'utf-8-unix)

5.7. global-auto-revert-mode

(with-delayed-execution
  (message "Install global-auto-revert-mode...")
  (global-auto-revert-mode t))

5.8. yes/no to y/n

(with-delayed-execution
  (fset 'yes-or-no-p 'y-or-n-p))

5.9. global keybind

(when my/enable-c-h-backspace
  (keyboard-translate ?\C-h ?\C-?)
  (global-set-key (kbd "C-h") #'c-hungry-delete-backwards))

(global-set-key (kbd "C-?") #'help-command)

(global-set-key (kbd "M-¥") #'(lambda () (interactive) (insert "\\")))
(global-set-key (kbd "C-z") #'undo)
(global-set-key (kbd "C-a") #'back-to-indentation)
(global-set-key (kbd "C-c i") #'find-function)
(global-set-key (kbd "C-c C-o") #'org-open-at-point)
(global-set-key (kbd "C-x C-o") #'other-window)
(global-set-key (kbd "C-x :") #'goto-line)
(global-set-key (kbd "M-h") #'backward-kill-word)

(global-set-key (kbd "C-x l") 'next-buffer)
(global-set-key (kbd "C-x h") 'previous-buffer)
(global-set-key (kbd "C-x C-b") #'switch-to-buffer)

(global-set-key (kbd "C-x C-k") nil)
(global-set-key (kbd "C-x C-n") nil)

(when window-system
  (global-set-key (kbd "C-x C-c") nil))

;; (global-set-key [return] #'(lambda ()
;;                              (interactive)
;;                              (message "Don't use RETURN!!! Press C-m!! C-m!!!")))
;; (global-set-key [tab] #'(lambda ()
;;                              (interactive)
;;                              (message "Don't use TAB!!! Press C-i!! C-i!!!")))

5.10. minibuffer

(define-key minibuffer-mode-map (kbd "C-h") #'delete-backward-char)
(define-key minibuffer-mode-map (kbd "M-h") #'backward-kill-word)
(define-key minibuffer-mode-map (kbd "C-j") #'exit-minibuffer)
(define-key minibuffer-mode-map (kbd "M-RET") #'exit-minibuffer)

5.11. savehistを有効にする

(with-delayed-execution-priority-high
  (message "Install savehist...")
  (savehist-mode 1))

5.12. [mac] clipboardに入るようにする

(with-delayed-execution
  (defun my/copy-from-osx ()
    (shell-command-to-string "pbpaste"))

  (defun my/paste-to-osx (text)
    (let ((process-connection-type nil))
      (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
        (process-send-string proc text)
        (process-send-eof proc))))

  (when-darwin-not-window-system
   (setq interprogram-cut-function #'my/paste-to-osx)
   (setq interprogram-paste-function #'my/copy-from-osx)))

5.13. pluginをnative compする

(with-eval-after-load 'comp
  (setq native-comp-async-jobs-number 8)
  (setq native-comp-speed 2)
  (setq native-comp-always-compile t)

  (defun my/native-comp-packages ()
    (interactive)
    (native-compile-async "~/.emacs.d/init.el")
    (native-compile-async "~/.emacs.d/early-init.el")
    (native-compile-async "~/.emacs.d/el-clone" 'recursively)
    (native-compile-async "~/.emacs.d/elpa" 'recursively)))

5.14. native compを無効にする

(with-eval-after-load 'comp
  (setq package-native-compile nil))

5.15. native compのwarningを抑える

(custom-set-variables '(warning-suppress-types '((comp))))

5.16. 同一bufferの名前を変える

(with-eval-after-load 'uniquify
  (setq uniquify-buffer-name-style 'post-forward-angle-brackets))

5.17. killできないようにする

(with-current-buffer "*scratch*"
  (emacs-lock-mode 'kill))

(with-current-buffer "*Messages*"
  (emacs-lock-mode 'kill))

5.18. 日時表示

(with-eval-after-load 'time
  (setq display-time-24hr-format t)
  (setq display-time-day-and-date t))

5.19. fontset

(with-delayed-execution
  (defconst my/enable-warning-log nil)

  (defun set-fontset-font:around (set-fontset-font name target font-spec &optional frame add)
    "Warn if specified font is not installed."
    (if (stringp font-spec)
        (setq font-spec (font-spec :family font-spec)))
    (if (and (fontp font-spec)
             (null (find-font font-spec))
             my/enable-warning-log)
        (warn "set-fontset-font: font %s is not found." (font-get font-spec :family))
      (ignore-errors
        (funcall set-fontset-font name target font-spec frame add))))

  (advice-add 'set-fontset-font :around #'set-fontset-font:around)

  ;; reset all settings in default fontset
  (when (functionp 'set-fontset-font)
    (if (find-font (font-spec :family "Noto Sans"))
        (set-fontset-font t '(0 . #x3fffff) "Noto Sans"))

    ;; multiple platform
    (set-fontset-font t 'latin "Noto Sans")
    (set-fontset-font t 'greek "Noto Sans")
    (set-fontset-font t 'phonetic "Noto Sans")
    (set-fontset-font t 'coptic "Noto Sans Coptic")
    (set-fontset-font t 'coptic "Noto Sans Symbols2" nil 'append)
    (set-fontset-font t 'cyrillic "Noto Sans")
    (set-fontset-font t 'armenian "Noto Sans Armenian")
    (set-fontset-font t 'hebrew "Noto Sans Hebrew")
    (set-fontset-font t 'arabic "Noto Sans Arabic")
    (set-fontset-font t 'syriac "Noto Sans Syriac")
    (set-fontset-font t 'thaana "Noto Sans Thaana")
    (set-fontset-font t 'nko "Noto Sans N'Ko")
    (set-fontset-font t 'samaritan "Noto Sans Samaritan")
    (set-fontset-font t 'mandaic "Noto Sans Mandaic")
    (set-fontset-font t 'devanagari "Noto Sans Devanagari")
    (set-fontset-font t 'bengali "Noto Sans Bengali")
    (set-fontset-font t 'gurmukhi "Noto Sans Gurmukhi")
    (set-fontset-font t 'gujarati "Noto Sans Gujanrati")
    (set-fontset-font t 'oriya "Noto Sans Oriya")
    (set-fontset-font t 'tamil "Noto Sans Tamil")
    (set-fontset-font t 'tamil "Noto Sans Tamil Supplement" nil 'append)
    (set-fontset-font t 'telugu "Noto Sans Telugu")
    (set-fontset-font t 'kannada "Noto Sans Kannada")
    (set-fontset-font t 'malayalam "Noto Sans Malayalam")
    (set-fontset-font t 'sinhala "Noto Sans Sinhala")
    (set-fontset-font t 'thai "Noto Sans Thai")
    (set-fontset-font t 'lao "Noto Sans Lao")
    (set-fontset-font t 'tibetan "Noto Sans Tibetan")
    (set-fontset-font t 'burmese "Noto Sans Myanmar")
    (set-fontset-font t 'georgian "Noto Sans Georgian")
    (set-fontset-font t 'hangul "Noto Sans CJK KR")
    (set-fontset-font t 'ethiopic "Noto Sans Ethiopic")
    (set-fontset-font t 'cherokee "Noto Sans Cherokee")
    (set-fontset-font t 'canadian-aboriginal "Noto Sans Canadian Aboriginal")
    (set-fontset-font t 'ogham "Noto Sans Ogham")
    (set-fontset-font t 'runic "Noto Sans Runic")
    (set-fontset-font t 'tagalog "Noto Sans Tagalog")
    (set-fontset-font t 'hanunoo "Noto Sans Hanunoo")
    (set-fontset-font t 'buhid "Noto Sans Buhid")
    (set-fontset-font t 'tagbanwa "Noto Sans Tagbanwa")
    (set-fontset-font t 'khmer "Noto Sans Khmer")
    (set-fontset-font t 'mongolian "Noto Sans Mongolian")
    (set-fontset-font t 'limbu "Noto Sans Limbu")
    (set-fontset-font t 'tai-le "Noto Sans Tai Le")
    (set-fontset-font t 'tai-lue "Noto Sans NewTaiLue")
    (set-fontset-font t 'buginese "Noto Sans Buginese")
    (set-fontset-font t 'tai-tham "Noto Sans Tai Tham")
    (set-fontset-font t 'balinese "Noto Sans Balinese")
    (set-fontset-font t 'sundanese "Noto Sans Sundanese")
    (set-fontset-font t 'vedic "Noto Sans Devanagari")
    (set-fontset-font t 'symbol "Noto Sans CJK JP")
    (set-fontset-font t 'symbol "Noto Sans Symbols2" nil 'append)
    (set-fontset-font t 'symbol "Noto Sans" nil 'append)
    (set-fontset-font t 'symbol "Noto Sans Math" nil 'append)
    (set-fontset-font t 'symbol "Noto Emoji" nil 'append)
    (set-fontset-font t 'symbol "Noto Sans Symbols" nil 'append)
    (set-fontset-font t 'braille "Noto Sans Symbols2")
    (set-fontset-font t 'batak "Noto Sans Batak")
    (set-fontset-font t 'lepcha "Noto Sans Lepcha")
    (set-fontset-font t 'ol-chiki "Noto Sans Ol Chiki")
    (set-fontset-font t 'glagolitic "Noto Sans Glagolitic")
    (set-fontset-font t 'tifinagh "Noto Sans Tifinagh")
    (set-fontset-font t 'han "Noto Sans CJK JP")
    (set-fontset-font t 'ideographic-description "Noto Sans CJK JP")
    (set-fontset-font t 'cjk-misc "Noto Sans CJK JP")
    (set-fontset-font t 'kana "Noto Sans CJK JP")
    (set-fontset-font t 'bopomofo "Noto Sans CJK TC")
    (set-fontset-font t 'kanbun "Noto Sans CJK JP")
    (set-fontset-font t 'yi "Noto Sans Yi")
    (set-fontset-font t 'lisu "Noto Sans Lisu")
    (set-fontset-font t 'vai "Noto Sans Vai")
    (set-fontset-font t 'bamum "Noto Sans Bamum")
    (set-fontset-font t 'syloti-nagri "Noto Sans Syloti Nagri")
    (set-fontset-font t 'north-indic-number "Noto Sans Devanagari")
    (set-fontset-font t 'phags-pa "Noto Sans Phags Pa")
    (set-fontset-font t 'saurashtra "Noto Sans Saurashtra")
    (set-fontset-font t 'kayah-li "Noto Sans Kayah Li")
    (set-fontset-font t 'rejang "Noto Sans Rejang")
    (set-fontset-font t 'javanese "Noto Sans Javanese")
    (set-fontset-font t 'cham "Noto Sans Cham")
    (set-fontset-font t 'tai-viet "Noto Sans Tai Viet")
    (set-fontset-font t 'meetei-mayek "Noto Sans Meetei Mayek")
    (set-fontset-font t 'vertical-form "Noto Sans CJK JP")
    (set-fontset-font t '(#xfe50 . #xfe6b) "Noto Sans CJK JP") ; symbol
    (set-fontset-font t '(#xfff9 . #xfffb) "Noto Sans Symbols2") ; nil
    (set-fontset-font t 'linear-b "Noto Sans Linear B")
    (set-fontset-font t 'aegean-number "Noto Sans Linear B")
    (set-fontset-font t 'ancient-greek-number "Noto Sans Symbols2")
    (set-fontset-font t 'ancient-symbol "Noto Sans Symbols2")
    (set-fontset-font t 'phaistos-disc "Noto Sans Symbols2")
    (set-fontset-font t 'lycian "Noto Sans Lycian")
    (set-fontset-font t 'carian "Noto Sans Carian")
    (set-fontset-font t 'old-italic "Noto Sans Old Italic")
    (set-fontset-font t 'gothic "Noto Sans Gothic")
    (set-fontset-font t 'old-permic "Noto Sans Old Permic")
    (set-fontset-font t 'ugaritic "Noto Sans Ugaritic")
    (set-fontset-font t 'old-persian "Noto Sans OldPersian")
    (set-fontset-font t 'deseret "Noto Sans Deseret")
    (set-fontset-font t 'shavian "Noto Sans Shavian")
    (set-fontset-font t 'osmanya "Noto Sans Osmanya")
    (set-fontset-font t 'osage "Noto Sans Osage")
    (set-fontset-font t 'elbasan "Noto Sans Elbasan")
    (set-fontset-font t 'caucasian-albanian "Noto Sans CaucAlban")
    (set-fontset-font t 'linear-a "Noto Sans Linear A")
    (set-fontset-font t 'cypriot-syllabary "Noto Sans Cypriot")
    (set-fontset-font t 'aramaic "Noto Sans ImpAramaic")
    (set-fontset-font t 'palmyrene "Noto Sans Palmyrene")
    (set-fontset-font t 'nabataean "Noto Sans Nabataean")
    (set-fontset-font t 'hatran "Noto Sans Hatran")
    (set-fontset-font t 'phoenician "Noto Sans Phoenician")
    (set-fontset-font t 'lydian "Noto Sans Lydian")
    (set-fontset-font t 'meroitic "Noto Sans Meroitic")
    (set-fontset-font t 'kharoshthi "Noto Sans Kharoshthi")
    (set-fontset-font t 'old-south-arabian "Noto Sans OldSouArab")
    (set-fontset-font t 'old-north-arabian "Noto Sans OldNorArab")
    (set-fontset-font t 'manichaean "Noto Sans Manichaean")
    (set-fontset-font t 'avestan "Noto Sans Avestan")
    (set-fontset-font t 'inscriptional-parthian "Noto Sans Inscriptional Parthian")
    (set-fontset-font t 'inscriptional-pahlavi "Noto Sans Inscriptional Pahlavi")
    (set-fontset-font t 'psalter-pahlavi "Noto Sans PsaPahlavi")
    (set-fontset-font t 'old-turkic "Noto Sans Old Turkic")
    (set-fontset-font t 'old-hungarian "Noto Sans OldHung")
    (set-fontset-font t 'hanifi-rohingya "Noto Sans HanifiRohg")
    (set-fontset-font t 'rumi-number "Noto Sans Symbols2")
    (set-fontset-font t 'old-sogdian "Noto Sans OldSogdian")
    (set-fontset-font t 'sogdian "Noto Sans Sogdian")
    (set-fontset-font t 'elymaic "Noto Sans Elymaic")
    (set-fontset-font t 'brahmi "Noto Sans Brahmi")
    (set-fontset-font t 'kaithi "Noto Sans Kaithi")
    (set-fontset-font t 'sora-sompeng "Noto Sans SoraSomp")
    (set-fontset-font t 'chakma "Noto Sans Chakma")
    (set-fontset-font t 'mahajani "Noto Sans Mahajani")
    (set-fontset-font t 'sharada "Noto Sans Sharada")
    (set-fontset-font t 'sinhala-archaic-number "Noto Sans Sinhala")
    (set-fontset-font t 'khojki "Noto Sans Khojki")
    (set-fontset-font t 'multani "Noto Sans Multani")
    (set-fontset-font t 'khudawadi "Noto Sans Khudawadi")
    (set-fontset-font t 'grantha "Noto Sans Grantha")
    (set-fontset-font t 'newa "Noto Sans Newa")
    (set-fontset-font t 'tirhuta "Noto Sans Tirhuta")
    (set-fontset-font t 'siddham "Noto Sans Siddham")
    (set-fontset-font t 'modi "Noto Sans Modi")
    (set-fontset-font t 'takri "Noto Sans Takri")
    (set-fontset-font t 'ahom "Noto Serif Ahom")
    (set-fontset-font t 'dogra "Noto Serif Dogra")
    (set-fontset-font t 'warang-citi "Noto Sans WarangCiti")
    (set-fontset-font t 'zanabazar-square "Noto Sans Zanabazar")
    (set-fontset-font t 'soyombo "Noto Sans Soyombo")
    (set-fontset-font t 'pau-cin-hau "Noto Sans PauCinHau")
    (set-fontset-font t 'bhaiksuki "Noto Sans Bhaiksuki")
    (set-fontset-font t 'marchen "Noto Sans Marchen")
    (set-fontset-font t 'masaram-gondi "Noto Sans Masaram Gondi")
    (set-fontset-font t 'gunjala-gondi "Noto Sans Gunjala Gondi")
    (set-fontset-font t 'cuneiform "Noto Sans Cuneiform")
    (set-fontset-font t 'cuneiform-numbers-and-punctuation "Noto Sans Cuneiform")
    (set-fontset-font t 'egyptian "Noto Sans EgyptHiero")
    (set-fontset-font t 'anatolian "Noto Sans AnatoHiero")
    (set-fontset-font t 'mro "Noto Sans Mro")
    (set-fontset-font t 'bassa-vah "Noto Sans Bassa Vah")
    (set-fontset-font t 'pahawh-hmong "Noto Sans Pahawh Hmong")
    (set-fontset-font t 'miao "Noto Sans Miao")
    (set-fontset-font t 'tangut "Noto Serif Tangut")
    (set-fontset-font t 'tangut-components "Noto Serif Tangut")
    (set-fontset-font t '(#x16fe0 . #x16fe0) "Noto Serif Tangut")
    (set-fontset-font t 'duployan-shorthand "Noto Sans Duployan")
    (set-fontset-font t 'byzantine-musical-symbol "Noto Music")
    (set-fontset-font t 'musical-symbol "Noto Music")
    (set-fontset-font t 'ancient-greek-musical-notation "Noto Music")
    (set-fontset-font t 'mayan-numeral "Noto Sans Mayan Numerals")
    (set-fontset-font t 'tai-xuan-jing-symbol "Noto Sans Symbols2")
    (set-fontset-font t 'counting-rod-numeral "Noto Sans Symbols2")
    (set-fontset-font t 'mathematical "Noto Sans Math")
    (set-fontset-font t 'wancho "Noto Sans Wancho")
    (set-fontset-font t 'mende-kikakui "Noto Sans Mende Kikakui")
    (set-fontset-font t 'adlam "Noto Sans Adlam")
    (set-fontset-font t 'indic-siyaq-number "Noto Sans Indic Siyaq Numbers")
    (set-fontset-font t '(#x1ee00 . #x1eeff) "Noto Sans Math") ; arabic
    (set-fontset-font t 'mahjong-tile "Noto Sans Symbols2")
    (set-fontset-font t 'domino-tile "Noto Sans Symbols2")
    (set-fontset-font t 'playing-cards "Noto Sans Symbols2")

    ;; non Noto fonts
    (set-fontset-font t 'kana "UniHentaiKana" nil 'append)
    (set-fontset-font t 'latin "Iosevka" nil 'append)
    (set-fontset-font t 'symbol "Iosevka" nil 'append)

    ;; Nerd Font (defined thru -#xfd46)
    (set-fontset-font t '( #xe000 .  #xf136) "Inconsolata Nerd Font")))

5.20. warning

(setq display-warning-minimum-level :error)

5.21. キーコマンド入力中に入力過程をミニバッファに反映する

(setq echo-keystrokes 0.1)

5.22. recursive minibuffers

(setq enable-recursive-minibuffers t)

5.23. inhibit-compacting-font-caches

(setq inhibit-compacting-font-caches t)

5.24. save-place-mode

(with-delayed-execution
  (save-place-mode 1))

5.25. enable-local-variables

(setq enable-local-variables :all)

5.26. password

(with-eval-after-load 'password-cache
  (setq password-cache t)
  (setq password-cache-expiry 3600))

5.27. tab-width

(setq tab-width 4)

5.28. indentはspaceにする

(setq-default indent-tabs-mode nil)

5.29. 検索で大文字小文字を区別しない

(setq read-file-name-completion-ignore-case t)
(setq read-buffer-completion-ignore-case t)
(setq completion-ignore-case t)

6. Utitlity

6.1. a

(eval-when-compile
  (el-clone :repo "plexus/a.el"))

(with-delayed-execution-priority-high
  (message "Install a...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/a")))

6.2. acm-terminal

(eval-when-compile
  (el-clone :repo "twlz0ne/acm-terminal"))

(with-delayed-execution
  (message "Install acm-terminal...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/acm-terminal")))

6.3. alert

(eval-when-compile
  (el-clone :repo "jwiegley/alert"))

(with-delayed-execution-priority-high
  (message "Install alert...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/alert")))

6.4. async

(eval-when-compile
  (el-clone :repo "jwiegley/emacs-async"))

(with-delayed-execution-priority-high
  (message "Install async...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-async")))

6.5. bui

(eval-when-compile
  (el-clone :repo "alezost/bui.el"))

(with-delayed-execution-priority-high
  (message "Install bui...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/bui")))

6.6. buttercup

(eval-when-compile
  (el-clone :repo "jorgenschaefer/emacs-buttercup"))

(with-delayed-execution-priority-high
  (message "Install emacs-buttercup...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-buttercup")))

6.7. cfrs

(eval-when-compile
  (el-clone :repo "Alexander-Miller/cfrs"))

(with-delayed-execution-priority-high
  (message "Install cfrs...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cfrs")))

6.8. closql

(eval-when-compile
  (el-clone :repo "magit/closql"))

(with-delayed-execution-priority-high
  (message "Install closql...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/closql")))

6.9. compat

(eval-when-compile
  (el-clone :repo "phikal/compat.el"))

(with-delayed-execution-priority-high
  (message "Install compat...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/compat")))

6.10. dash

(eval-when-compile
  (el-clone :repo "magnars/dash.el"))

(with-delayed-execution-priority-high
  (message "Install dash...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dash")))

6.11. elquery

(eval-when-compile
  (el-clone :repo "AdamNiederer/elquery"))

(with-delayed-execution-priority-high
  (message "Install elquery...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elquery")))

6.12. esxml

(eval-when-compile
  (el-clone :repo "tali713/esxml"))

(with-delayed-execution-priority-high
  (message "Install esxml...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/esxml")))

6.13. emacsql

(eval-when-compile
  (el-clone :repo "magit/emacsql"))

(with-delayed-execution-priority-high
  (message "Install emacsql...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacsql")))

6.14. epl

(eval-when-compile
  (el-clone :repo "cask/epl"))

(with-delayed-execution-priority-high
  (message "Install epl...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/epl")))

6.15. ert-expectations

(eval-when-compile
  (el-clone :repo "emacsorphanage/ert-expectations"))

(with-delayed-execution-priority-high
  (message "Install ert-expectations...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ert-expectations")))

6.16. espuds

(eval-when-compile
  (el-clone :repo "ecukes/espuds"))

(with-delayed-execution-priority-high
  (message "Install espuds...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/espuds")))

6.17. f

(eval-when-compile
  (el-clone :repo "rejeep/f.el"))

(with-delayed-execution-priority-high
  (message "Install f...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/f")))

6.18. flx

(eval-when-compile
  (el-clone :repo "lewang/flx"))

(with-delayed-execution
  (message "Install flx...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/flx")))

6.19. frame-local

(eval-when-compile
  (el-clone :repo "sebastiencs/frame-local"))

(with-delayed-execution-priority-high
  (message "Install frame-local...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/frame-local")))

6.20. fringe-helper

(eval-when-compile
  (el-clone :repo "nschum/fringe-helper.el"))

(with-delayed-execution-priority-high
  (message "Install fringe-helper...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/fringe-helper")))

6.21. helm

(eval-when-compile
  (el-clone :repo "emacs-helm/helm"))

(with-delayed-execution-priority-high
  (message "Install helm...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/helm")))

6.22. hide-lines

(eval-when-compile
  (el-clone :repo "vapniks/hide-lines"))

(with-delayed-execution-priority-high
  (message "Install hide-lines...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hide-lines")))

6.23. hsluv

(eval-when-compile
  (el-clone :repo "hsluv/hsluv-emacs"))

(with-delayed-execution-priority-high
  (message "Install hsluv-emacs...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hsluv-emacs")))

6.24. ht

(eval-when-compile
  (el-clone :repo "Wilfred/ht.el"))

(with-delayed-execution-priority-high
  (message "Install ht...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ht")))

6.25. hydra

(eval-when-compile
  (el-clone :repo "abo-abo/hydra"))

(with-delayed-execution-priority-high
  (message "Install hydra...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hydra")))

6.26. iedit

(eval-when-compile
  (el-clone :repo "victorhge/iedit"))

(with-delayed-execution-priority-high
  (message "Install iedit...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/iedit")))

6.27. jump

(eval-when-compile
  (el-clone :repo "eschulte/jump.el"))

(with-delayed-execution-priority-high
  (message "Install jump...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/jump")))

6.28. link-hint

(eval-when-compile
  (el-clone :repo "noctuid/link-hint.el"))

(with-delayed-execution
  (message "Install link-hint...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/link-hint")))

6.29. list-utils

(eval-when-compile
  (el-clone :repo "rolandwalker/list-utils"))

(with-delayed-execution-priority-high
  (message "Install list-utils...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/list-utils")))

6.30. log4e

(eval-when-compile
  (el-clone :repo "aki2o/log4e"))

(with-delayed-execution
  (message "Install log4e...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/log4e")))

6.31. marshal

(eval-when-compile
  (el-clone :repo "sigma/marshal.el"))

(with-delayed-execution-priority-high
  (message "Install marshal...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/marshal")))

6.32. mocker

(eval-when-compile
  (el-clone :repo "sigma/mocker.el"))

(with-delayed-execution-priority-high
  (message "Install mocker...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/mocker")))

6.33. mustache

(eval-when-compile
  (el-clone :repo "Wilfred/mustache.el"))

(with-delayed-execution-priority-high
  (message "Install mustache...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/mustache")))

6.34. nerd-icons

(eval-when-compile
  (el-clone :repo "rainstormstudio/nerd-icons.el"))

(with-delayed-execution-priority-high
  (message "Install nerd-icons...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nerd-icons")))

6.35. ov

(eval-when-compile
  (el-clone :repo "emacsorphanage/ov"))

(with-delayed-execution-priority-high
  (message "Install ov...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ov")))

6.36. peg

(eval-when-compile
  (el-clone :repo "emacsmirror/peg"))

(with-delayed-execution
  (message "Install peg...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/peg")))

6.37. persist

(eval-when-compile
  (el-clone :repo "emacsmirror/persist"))

(with-delayed-execution
  (message "Install persist...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/persist")))

6.38. pfuture

(eval-when-compile
  (el-clone :repo "Alexander-Miller/pfuture"))

(with-delayed-execution-priority-high
  (message "Install pfuture...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/pfuture")))

6.39. pkg-info

(eval-when-compile
  (el-clone :repo "emacsorphanage/pkg-info"))

(with-delayed-execution-priority-high
  (message "Install pkg-info...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/pkg-info")))

6.40. posframe

(eval-when-compile
  (el-clone :repo "tumashu/posframe"))

(with-delayed-execution-priority-high
  (message "Install posframe...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/posframe")))

6.41. popup

(eval-when-compile
  (el-clone :repo "auto-complete/popup-el"))

(with-delayed-execution-priority-high
  (message "Install popup-el...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/popup-el")))

6.42. powerline

(eval-when-compile
  (el-clone :repo "milkypostman/powerline"))

(with-delayed-execution-priority-high
  (message "Install powerline...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/powerline")))

6.43. queue

(eval-when-compile
  (el-clone :repo "emacsmirror/queue"))

(with-delayed-execution-priority-high
  (message "Install queue...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/queue")))

6.44. ripgrep

(eval-when-compile
  (el-clone :repo "nlamirault/ripgrep.el"))

(with-delayed-execution
  (message "Install ripgrep...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ripgrep")))

6.45. reformatter

(eval-when-compile
  (el-clone :repo "purcell/emacs-reformatter"))

(with-delayed-execution-priority-high
  (message "Install emacs-reformatter...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-reformatter")))

6.46. request

(eval-when-compile
  (el-clone :repo "tkf/emacs-request"))

(with-delayed-execution-priority-high
  (message "Install emacs-request...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-request")))

6.47. s

(eval-when-compile
  (el-clone :repo "magnars/s.el"))

(with-delayed-execution-priority-high
  (message "Install s...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/s")))

6.48. sesman

(eval-when-compile
  (el-clone :repo "vspinu/sesman"))

(with-delayed-execution-priority-high
  (message "Install sesman...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/sesman")))

6.49. simple-httpd

(eval-when-compile
  (el-clone :repo "skeeto/emacs-web-server"))

(with-delayed-execution-priority-high
  (message "Install emacs-web-server...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-web-server")))

6.50. spinner

(eval-when-compile
  (el-clone :repo "Malabarba/spinner.el"))

(with-delayed-execution-priority-high
  (message "Install spinner...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/spinner")))

6.51. shrink-path

(eval-when-compile
  (el-clone :fetcher "gitlab"
            :repo "bennya/shrink-path.el"))

(with-delayed-execution-priority-high
  (message "Install shrink-path...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/shrink-path")))

6.52. tablist

(eval-when-compile
  (el-clone :repo "politza/tablist"))

(with-delayed-execution-priority-high
  (message "Install tablist...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/tablist")))

6.53. tomelr

(eval-when-compile
  (el-clone :repo "kaushalmodi/tomelr"))

(with-delayed-execution-priority-high
  (message "Install tomelr...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/tomelr")))

6.54. treemacs

(eval-when-compile
  (el-clone :repo "Alexander-Miller/treemacs"
            :load-paths `(,(locate-user-emacs-file "el-clone/treemacs/src/elisp")
                          ,(locate-user-emacs-file "el-clone/treemacs/src/extra"))))

(with-delayed-execution-priority-high
  (message "Install treemacs...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/treemacs/src/elisp"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/treemacs/src/extra"))

  ;; for lsp
  (autoload-if-found '(treemacs-define-doubleclick-action) "treemacs-mouse-interface" nil t))

6.55. treepy

(eval-when-compile
  (el-clone :repo "volrath/treepy.el"))

(with-delayed-execution-priority-high
  (message "Install treepy...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/treepy")))

6.56. tree-mode

(eval-when-compile
  (el-clone :repo "emacsorphanage/tree-mode"))

(with-delayed-execution-priority-high
  (message "Install tree-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/tree-mode")))

6.57. ts

(eval-when-compile
  (el-clone :repo "alphapapa/ts.el"))

(with-delayed-execution-priority-high
  (message "Install ts...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ts")))

6.58. yaml

(eval-when-compile
  (el-clone :repo "zkry/yaml.el"))

(with-delayed-execution-priority-high
  (message "Install yaml...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/yaml")))

6.59. visual-fill-column

(eval-when-compile
  (el-clone :repo "joostkremers/visual-fill-column"))

(with-delayed-execution-priority-high
  (message "Install visual-fill-column...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/visual-fill-column")))

6.60. web-server

(eval-when-compile
  (el-clone :repo "skeeto/emacs-web-server"))

(with-delayed-execution-priority-high
  (message "Install emacs-web-server...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-web-server")))

6.61. websocket

(eval-when-compile
  (el-clone :repo "ahyatt/emacs-websocket"))

(with-delayed-execution-priority-high
  (message "Install emacs-websocket...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-websocket")))

6.62. xelb

(eval-when-compile
  (el-clone :repo "ch11ng/xelb"))

(with-delayed-execution-priority-high
  (message "Install xelb...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/xelb")))

6.63. xwidgets-reuse

(eval-when-compile
  (el-clone :repo "lordpretzel/xwidgets-reuse"))

(with-delayed-execution
  (message "Install xwidgets-reuse...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/xwidgets-reuse")))

6.64. gh-test

(eval-when-compile
  (el-clone :repo "edivangalindo/gh-test"))

(with-delayed-execution-priority-high
  (message "Install gh-test...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/gh-test")))

6.65. gh

(eval-when-compile
  (el-clone :repo "sigma/gh.el"))

(with-delayed-execution-priority-high
  (message "Install gh...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/gh")))

6.66. web-server

(eval-when-compile
  (el-clone :repo "eschulte/emacs-web-server" :name "web-server"))

(with-delayed-execution-priority-high
  (message "Install web-server...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/web-server")))

7. Language

7.1. apache-mode

(eval-when-compile
  (el-clone :repo "emacs-php/apache-mode"))

(with-delayed-execution
  (message "Install apache-mode")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/apache-mode"))

  (autoload-if-found '(apache-mode) "apache-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.htaccess$" . apache-mode)))

7.2. bazel-mode

(eval-when-compile
  (el-clone :repo "bazelbuild/emacs-bazel-mode"))

(with-delayed-execution
  (message "Install bazel-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-bazel-mode"))
  (autoload-if-found '(bazel-mode) "bazel" nil t))

7.3. bison-mode

(eval-when-compile
  (el-clone :repo "Wilfred/bison-mode"))

(with-delayed-execution
  (message "Install bison-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/bison-mode"))

  (autoload-if-found '(bison-mode flex-mode jison-mode) "bison-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.y\\'" . bison-mode))
  (add-to-list 'auto-mode-alist '("\\.l\\'" . flex-mode))
  (add-to-list 'auto-mode-alist '("\\.jison\\'" . jison-mode)))

7.4. c++-mode

(with-eval-after-load 'c++-mode
  (add-hook 'c++-mode-hook #'lsp-deferred))

7.5. c-mode

(with-eval-after-load 'cc-mode
  (add-hook 'c-mode-hook #'lsp-deferred))

7.6. cask-mode

(eval-when-compile
  (el-clone :repo "Wilfred/cask-mode"))

(with-delayed-execution
  (message "Install cask-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cask-mode"))

  (autoload-if-found '(cask-mode) "cask-mode" nil t)

  (add-to-list 'auto-mode-alist '("/Cask\\'" . cask-mode)))

7.7. cfn-mode

以下が必要

  • pip install cfn-lint
  • gem install cfn_nag
(eval-when-compile
  (el-clone :fetcher "gitlab"
            :repo "worr/cfn-mode"))

(with-delayed-execution
  (message "Install cfn-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cfn-mode/cfn-mode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cfn-mode/flycheck-cfn"))

  (autoload-if-found '(cfn-mode) "cfn-mode" nil t)
  (autoload-if-found '(flycheck-cfn-setup) "flycheck-cfn" nil t)

  (add-to-list 'magic-mode-alist '("\\(---\n\\)?AWSTemplateFormatVersion:" . cfn-mode))

  (with-eval-after-load 'cfn-mode
    (add-hook 'cfn-mode-hook #'flycheck-cfn-setup)))

7.8. clojure-mode

(eval-when-compile
  (el-clone :repo "clojure-emacs/clojure-mode"))

(with-delayed-execution
  (message "Install clojure-mode")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/clojure-mode"))

  (autoload-if-found '(clojure-mode clojurescript-mode) "clojure-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
  (add-to-list 'auto-mode-alist '("\\.cljs$" . clojurescript-mode))

  (with-eval-after-load 'clojure-mode
    ;; config
    (setq clojure-toplevel-inside-comment-form t)

    ;; hook
    ;; (add-hook 'clojure-mode-hook #'lsp-deferred)

    ;; keybind
    (define-key clojure-mode-map (kbd "C-:") #'avy-goto-word-1)))

7.9. cmake-mode

(eval-when-compile
  (el-clone :repo "emacsmirror/cmake-mode"))

(with-delayed-execution
  (message "Install cmake...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cmake-mode"))

  (autoload-if-found '(cmake-mode) "cmake-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.cmake$" . cmake-mode)))

7.10. coffee-mode

(eval-when-compile
  (el-clone :repo "defunkt/coffee-mode"))

(with-delayed-execution
  (message "Install coffee-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/coffee-mode"))

  (autoload-if-found '(coffee-mode) "coffee-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode)))

7.11. conf-mode

(add-to-list 'auto-mode-alist '("\\.cnf$" . conf-mode))

7.12. crontab-mode

(eval-when-compile
  (el-clone :repo "emacs-pe/crontab-mode"))

(with-delayed-execution
  (message "Install crontab-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/crontab-mode"))

  (autoload-if-found '(crontab-mode) "crontab-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.?cron\\(tab\\)?\\'" . crontab-mode)))

7.13. csharp-mode

(eval-when-compile
  (el-clone :repo "emacs-csharp/csharp-mode"))

(with-delayed-execution
  (message "Install csharp-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/csharp-mode"))

  (autoload-if-found '(csharp-mode) "csharp-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode)))

7.14. css-mode

(with-eval-after-load 'css-mode
  (add-hook 'css-mode-hook #'lsp-deferred))

7.15. csv-mode

(eval-when-compile
  (el-clone :repo "emacsmirror/csv-mode"))

(with-delayed-execution
  (message "Install csv-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/csv-mode"))

  (autoload-if-found '(csv-mode) "csv-mode" nil t)
  (push '("\\.csv$" . csv-mode) auto-mode-alist))

7.16. cuda-mode

(eval-when-compile
  (el-clone :repo "emacsmirror/cuda-mode"))

(with-delayed-execution
  (message "Install cuda-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cuda-mode"))

  (autoload-if-found '(cuda-mode) "cuda-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.cu$" . cuda-mode)))

7.17. crystal-mode

(eval-when-compile
  (el-clone :repo "jpellerin/emacs-crystal-mode"))

(with-delayed-execution
  (message "Install crystal-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-crystal-mode"))

  (autoload-if-found '(crystal-mode) "crystal-mode" nil t)

  (add-to-list 'auto-mode-alist '("Projectfile$" . crystal-mode))
  (add-to-list 'auto-mode-alist
               (cons (purecopy (concat "\\(?:\\."
                                       "cr"
                                       "\\)\\'")) 'crystal-mode)))

7.18. dart-mode

(eval-when-compile
  (el-clone :repo "bradyt/dart-mode"))

(with-delayed-execution
  (message "Install dart-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dart-mode"))

  (autoload-if-found '(dart-mode) "dart-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.dart$" . dart-mode)))

7.19. dbd-mode

(eval-when-compile
  (el-clone :repo "ccod/dbd-mode"))

(with-delayed-execution
  (message "Install dbd-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dbd-mode"))

  (autoload-if-found '(dbdiagram-mode) "dbdiagram-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.dbd\\'" . dbdiagram-mode))
  (add-to-list 'auto-mode-alist '("\\.dbml\\'" . dbdiagram-mode)))

7.20. dhall-mode

(eval-when-compile
  (el-clone :repo "psibi/dhall-mode"))

(with-delayed-execution
  (message "Install dhall-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dhall-mode"))

  (autoload-if-found '(dhall-mode) "dhall-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.dhall$" . dhall-mode)))

7.21. direnv-mode

(eval-when-compile
  (el-clone :repo "wbolster/emacs-direnv"))

(with-delayed-execution
  (message "Install direnv-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-direnv"))

  (autoload-if-found '(direnv-mode direnv-envrc-mode) "direnv" nil t)
  (add-to-list 'auto-mode-alist '("\\.envrc" . direnv-envrc-mode)))

7.22. docker-compose-mode

(eval-when-compile
  (el-clone :repo "meqif/docker-compose-mode"))

(with-delayed-execution
  (message "Install docker-comopse-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/docker-compose-mode"))

  (autoload-if-found '(docker-compose-mode) "docker-compose-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\docker-compose*" . docker-compose-mode)))

7.23. dockerfile-mode

(eval-when-compile
  (el-clone :repo "spotify/dockerfile-mode"))

(with-delayed-execution
  (message "Install dockerfile-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dockerfile-mode"))

  (autoload-if-found '(dockerfile-mode) "dockerfile-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\Dockerfile$" . dockerfile-mode))
  (add-to-list 'auto-mode-alist '("\\Dockerfile_Ecs$" . dockerfile-mode))
  (add-to-list 'auto-mode-alist '("\\Dockerfile_EcsDeploy" . dockerfile-mode))

  (with-eval-after-load 'dockerfile-mode
    (add-hook 'dockerfile-mode-hook #'flycheck-mode)))

7.24. dotenv-mode

(eval-when-compile
  (el-clone :repo "preetpalS/emacs-dotenv-mode"))

(with-delayed-execution
  (message "Install dotenv-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-dotenv-mode"))

  (autoload-if-found '(dotenv-mode) "dotenv-mode" nil t)
  (add-to-list 'auto-mode-alist '(".env" . dotenv-mode))
  (add-to-list 'auto-mode-alist '("\\.env\\..*\\'" . dotenv-mode)))

7.25. elixir-mode

(eval-when-compile
  (el-clone :repo "elixir-editors/emacs-elixir"))

(with-delayed-execution
  (message "Install elixir-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-elixir"))

  (autoload-if-found '(elixir-mode) "elixir-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.elixir$" . elixir-mode))
  (add-to-list 'auto-mode-alist '("\\.ex$" . elixir-mode))
  (add-to-list 'auto-mode-alist '("\\.exs$" . elixir-mode))
  (add-to-list 'auto-mode-alist '("mix\\.lock" . elixir-mode)))

7.26. elm-mode

(eval-when-compile
  (el-clone :repo "jcollard/elm-mode"))

(with-delayed-execution
  (message "Install elm-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elm-mode"))

  (autoload-if-found '(elm-mode) "elm-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.elm$" . elm-mode)))

7.27. emacs-lisp-mode

(with-delayed-execution
  (message "Install emacs-lisp-mode...")
  (add-to-list 'auto-mode-alist '("Keg" . emacs-lisp-mode)))

7.28. fish-mode

(eval-when-compile
  (el-clone :repo "wwwjfy/emacs-fish"))

(with-delayed-execution
  (message "Install fish-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-fish"))

  (autoload-if-found '(fish-mode) "fish-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.fish$" . fish-mode))

  (with-eval-after-load 'fish-mode
    (setq fish-enable-auto-indent t)))

7.29. forth-mode

(eval-when-compile
  (el-clone :repo "larsbrinkhoff/forth-mode"))

(with-delayed-execution
  (message "Install forth-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/forth-mode"))

  (autoload-if-found '(forth-mode) "forth-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.f$" . forth-mode))
  (add-to-list 'auto-mode-alist '("\\.fs$" . forth-mode))
  (add-to-list 'auto-mode-alist '("\\.fth$" . forth-mode))
  (add-to-list 'auto-mode-alist '("\\.forth$" . forth-mode))
  (add-to-list 'auto-mode-alist '("\\.4th$" . forth-mode)))

7.30. fortran

(with-delayed-execution
  (message "Install fortran...")
  (autoload-if-found '(f90-mode) "f90" nil t)
  (add-to-list 'auto-mode-alist '("\\.f\\(y90\\|y?pp\\)\\'" . f90-mode))
  (with-eval-after-load 'f90
    (add-hook 'f90-mode-hook #'lsp)))

7.31. fsharp-mode

(eval-when-compile
  (el-clone :repo "fsharp/emacs-fsharp-mode"))

(with-delayed-execution
  (message "Install fsharp-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-fsharp-mode"))

  (autoload-if-found '(fsharp-mode) "fsharp-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.fs[iylx]?$" . fsharp-mode)))

7.32. git-modes

(eval-when-compile
  (el-clone :repo "magit/git-modes"))

(with-delayed-execution
  (message "Install git-modes...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/git-modes"))
  (add-to-list 'load-path (locate-user-emacs-file (concat "el-clone/git-modes")))

  (autoload-if-found '(gitignore-mode gitconfig-mode gitattributes-mode) "git-modes" nil t)

  ;; gitignore-mode
  (add-to-list 'auto-mode-alist '("\\.dockerignore$" . gitignore-mode))
  (add-to-list 'auto-mode-alist '("\\.gitignore$" . gitignore-mode))
  (add-to-list 'auto-mode-alist '("\\.prettierignore$" . gitignore-mode))
  (add-to-list 'auto-mode-alist '("/git/ignore\\'" . gitignore-mode))
  (add-to-list 'auto-mode-alist '("/git/ignore\\'" . gitignore-mode))
  (add-to-list 'auto-mode-alist '("CODEOWNERS" . gitignore-mode))

  ;; gitconfig-mode
  (add-to-list 'auto-mode-alist '("\\.git-pr-release$" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("\\.editorconfig$" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("\\.gitconfig$" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("/\\.git/config\\'" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("/modules/.*/config\\'" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("/git/config\\'" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("/\\.gitmodules\\'" . gitconfig-mode))
  (add-to-list 'auto-mode-alist '("/etc/gitconfig\\'" . gitconfig-mode))

  ;; gitattributes
  (add-to-list 'auto-mode-alist '("/\\.gitattributes\\'" . gitattributes-mode))
  (add-to-list 'auto-mode-alist '("\.gitattributes$" . gitattributes-mode))
  (add-to-list 'auto-mode-alist '("/info/attributes\\'" . gitattributes-mode))
  (add-to-list 'auto-mode-alist '("/git/attributes\\'" . gitattributes-mode)))

7.33. glsl-mode

(eval-when-compile
  (el-clone :repo "jimhourihan/glsl-mode"))

(with-delayed-execution
  (message "Install glsl-mode")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/glsl-mode"))

  (autoload-if-found '(glsl-mode) "glsl-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.vsh$" . glsl-mode))
  (add-to-list 'auto-mode-alist '("\\.fsh$" . glsl-mode)))

7.34. go-mode

(eval-when-compile
  (el-clone :repo "dominikh/go-mode.el"))

(with-delayed-execution
  (message "Install go-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/go-mode"))

  (autoload-if-found '(go-mode) "go-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.go$" . go-mode))
  (add-to-list 'auto-mode-alist '("^go.mod$" . go-mode))

  (with-eval-after-load 'go-mode
    ;; config
    (setq gofmt-command "goimports")

    ;; hook
    (add-hook 'go-mode-hook #'lsp-deferred)
    (add-hook 'before-save-hook #'gofmt-before-save)))

7.35. gradle-mode

(eval-when-compile
  (el-clone :repo "jacobono/emacs-gradle-mode"))

(with-delayed-execution
  (message "Install gradle-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-gradle-mode"))

  (autoload-if-found '(gradle-mode) "gradle-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.gradle$" . gradle-mode)))

7.36. graphql-mode

(eval-when-compile
  (el-clone :repo "davazp/graphql-mode"))

(with-delayed-execution
  (message "Install graphql-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/graphql-mode"))

  (autoload-if-found '(graphql-mode) "graphql-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.graphql\\'" . graphql-mode))

  (with-eval-after-load 'graphql-mode
    (setq graphql-indent-level 4)))

7.37. graphviz-dot-mode

(eval-when-compile
  (el-clone :repo "ppareit/graphviz-dot-mode"))

(with-delayed-execution
  (message "Install graphviz-dot-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/graphviz-dot-mode"))

  (autoload-if-found '(graphviz-dot-mode) "graphviz-dot-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode))
  (add-to-list 'auto-mode-alist '("\\.gv\\'" . graphviz-dot-mode))

  (with-eval-after-load 'graphviz-dot-mode
    (setq graphviz-dot-auto-indent-on-semi nil)
    (setq graphviz-dot-indent-width 2)))

7.38. groovy-mode

(eval-when-compile
  (el-clone :repo "Groovy-Emacs-Modes/groovy-emacs-modes"))

(with-delayed-execution
  (message "Install groovy-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/groovy-emacs-modes"))

  (autoload-if-found '(groovy-mode) "groovy-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.g\\(?:ant\\|roovy\\|radle\\)\\'" . groovy-mode))
  (add-to-list 'auto-mode-alist '("/Jenkinsfile\\'" . groovy-mode))
  (add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode)))

7.39. hack-mode

(eval-when-compile
  (el-clone :repo "hhvm/hack-mode"))

(with-delayed-execution
  (message "Install hack-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hack-mode"))

  (autoload-if-found '(hack-mode) "hack-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.hack$" . hack-mode))
  (add-to-list 'auto-mode-alist '("\\.hck$" . hack-mode))
  (add-to-list 'auto-mode-alist '("\\.hhi$" . hack-mode)))

7.40. haskell-mode

(eval-when-compile
  (el-clone :repo "haskell/haskell-mode"))

(with-delayed-execution
  (message "Install haskell-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/haskell-mode"))

  (autoload-if-found '(haskell-doc-current-info) "haskell-doc" nil t)
  (autoload-if-found '(haskell-mode) "haskell-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.hs$" . haskell-mode))
  (add-to-list 'auto-mode-alist '("\\.cable$" . haskell-mode)))

7.41. hy-mode

(eval-when-compile
  (el-clone :repo "hylang/hy-mode"))

(with-delayed-execution
  (message "Install hy-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hy-mode"))

  (autoload-if-found '(hy-mode) "hy-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.hy$" . hy-mode)))

7.42. ini-mode

(eval-when-compile
  (el-clone :repo "Lindydancer/ini-mode"))

(with-delayed-execution
  (message "Install ini-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ini-mode"))

  (autoload-if-found '(ini-mode) "ini-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.ini$" . ini-mode)))

7.43. jade-mode

(eval-when-compile
  (el-clone :repo "brianc/jade-mode"))

(with-delayed-execution
  (message "Install jade-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/jade-mode"))

  (autoload-if-found '(jade-mode) "jade-mode" nil t)
  (autoload-if-found '(stylus-mode) "stylus-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.jade$" . jade-mode))
  (add-to-list 'auto-mode-alist '("\\.styl\\'" . stylus-mode)))

7.44. java-mode

(with-delayed-execution
  (message "Install java-mode...")
  (autoload-if-found '(java-mode) "java-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.java$" . java-mode)))

7.45. js2-mode

(eval-when-compile
  (el-clone :repo "mooz/js2-mode"))

(with-delayed-execution
  (message "Install js2-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/js2-mode"))

  (autoload-if-found '(js2-mode) "js2-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
  (add-to-list 'auto-mode-alist '("\\.mjs$" . js2-mode))

  (with-eval-after-load 'js2-mode
    ;; config
    (setq js2-strict-missing-semi-warning nil)
    (setq js2-missing-semi-one-line-override nil)

    ;; hook
    ;; (add-hook 'js2-mode-hook #'lsp-deferred)
    ))

7.46. json-mode

(eval-when-compile
  (el-clone :repo "Sterlingg/json-snatcher")
  (el-clone :repo "joshwnj/json-mode"))

(with-delayed-execution
  (message "Install json-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/json-snatcher"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/json-mode"))

  (autoload-if-found '(json-mode) "json-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.json$" . json-mode))
  (add-to-list 'auto-mode-alist '("\\.textlintrc$" . json-mode))
  (add-to-list 'auto-mode-alist '("\\.prettierrc$" . json-mode))
  (add-to-list 'auto-mode-alist '("\\.markuplintrc$" . json-mode))

  (with-eval-after-load 'json-mode
    (add-hook 'json-mode-hook #'flycheck-mode)))

7.47. jsonnet-mode

(eval-when-compile
  (el-clone :repo "tminor/jsonnet-mode"))

(with-delayed-execution
  (message "Install jsonnet-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/jsonnet-mode"))
  (autoload-if-found '(jsonnet-mode
                       jsonnet-eval-buffer
                       jsonnet-jump
                       jsonnet-reformat-buffer) "jsonnet-mode" nil t)

  (add-to-list 'auto-mode-alist (cons "\\.jsonnet\\'" 'jsonnet-mode))
  (add-to-list 'auto-mode-alist (cons "\\.libsonnet\\'" 'jsonnet-mode))

  (with-eval-after-load 'jsonnet-mode
    ;; config
    (setq jsonnet-indent-level 4)

    ;; keybind
    (define-key jsonnet-mode-map (kbd "C-c C-c") #'jsonnet-eval-buffer)
    (define-key jsonnet-mode-map (kbd "C-c C-f") #'jsonnet-jump)
    (define-key jsonnet-mode-map (kbd "C-c C-r") #'jsonnet-reformat-buffer)

    ;; hook
    (add-hook 'jsonnet-mode-hook #'(lambda ()
                                     (require 'lsp-jsonnet)
                                     (lsp)))))

7.48. kotlin-mode

(eval-when-compile
  (el-clone :repo "Emacs-Kotlin-Mode-Maintainers/kotlin-mode"))

(with-delayed-execution
  (message "Install kotlin-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/kotlin-mode"))

  (autoload-if-found '(kotlin-mode) "kotlin-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.kts?\\'" . kotlin-mode)))

7.49. lisp-mode

(with-delayed-execution
  (autoload-if-found '(lisp-mode) "lisp-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.lemrc$" . lisp-mode))
  (add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode)))

7.50. lua-mode

(eval-when-compile
  (el-clone :repo "immerrr/lua-mode"))

(with-delayed-execution
  (message "Install lua-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lua-mode"))

  (autoload-if-found '(lua-mode) "lua-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode)))

7.51. markdown-mode

(eval-when-compile
  (el-clone :repo "polymode/poly-markdown")
  (el-clone :repo "jrblevin/markdown-mode"))

(with-delayed-execution
  (message "Install markdown-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/poly-markdown"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/markdown-mode"))

  (autoload-if-found '(markdown-mode) "markdown-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
  (add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))

  (with-eval-after-load 'markdown-mode
    ;; config
    (setq markdown-code-lang-modes (append '(("diff" . diff-mode)
                                             ("hs" . haskell-mode)
                                             ("html" . web-mode)
                                             ("ini" . conf-mode)
                                             ("js" . web-mode)
                                             ("jsx" . web-mode)
                                             ("md" . markdown-mode)
                                             ("pl6" . raku-mode)
                                             ("py" . python-mode)
                                             ("rb" . ruby-mode)
                                             ("rs" . rustic-mode)
                                             ("sqlite3" . sql-mode)
                                             ("ts" . typescript-mode)
                                             ("typescript" . typescript-mode)
                                             ("tsx" . web-mode)
                                             ("yaml". yaml-mode)
                                             ("zsh" . sh-mode)
                                             ("php" . php-mode))
                                           markdown-code-lang-modes))

    ;; markdown
    (add-hook 'markdown-mode #'orgtbl-mode)))

7.52. mermaid-mode

(eval-when-compile
  (el-clone :repo "abrochard/mermaid-mode"))

(with-delayed-execution
  (message "Install mermaid-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/mermaid-mode"))

  (autoload-if-found '(mermaid-mode) "mermaid-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.mmd\\'" . mermaid-mode)))

7.53. makefile-mode

(with-delayed-execution
  (autoload-if-found '(makefile-mode) "makefile-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.mk$" . makefile-mode))
  (add-to-list 'auto-mode-alist '("Makefile" . makefile-mode))

  (with-eval-after-load 'makefile-mode
    ;; config
    (setq makefile-electric-keys t)

    ;; hook
    (add-hook 'makefile-mode #'flycheck-mode)))

7.54. nasm-mode

(eval-when-compile
  (el-clone :repo "skeeto/nasm-mode"))

(with-delayed-execution
  (message "Install nasm-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nasm-mode"))

  (autoload-if-found '(nasm-mode) "nasm-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.s$" . nasm-mode)))

7.55. neon-mode

(eval-when-compile
  (el-clone :repo "Fuco1/neon-mode"))

(with-delayed-execution
  (message "Install neon-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/neon-mode"))

  (autoload-if-found '(neon-mode) "neon-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.neon$" . neon-mode)))

7.56. nim-mode

(eval-when-compile
  (el-clone :repo "nim-lang/nim-mode"))

(with-delayed-execution
  (message "Install nim-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nim-mode"))

  (autoload-if-found '(nim-mode) "nim-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.nim\\'" . nim-mode)))

7.57. ninja-mode

(eval-when-compile
  (el-clone :repo "ninja-build/ninja"))

(with-delayed-execution
  (message "Install ninja-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ninja"))

  (autoload-if-found '(ninja-mode) "ninja-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.ninja$" . ninja-mode)))

7.58. nix-mode

(eval-when-compile
  (el-clone :repo "NixOS/nix-mode"))

(with-delayed-execution
  (message "Install nix-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nix-mode"))

  (autoload-if-found '(nix-mode) "nix-mode" nil t)
  (autoload-if-found '(nix-drv-mode) "nix-drv-mode" nil t)
  (autoload-if-found '(nix-shell-unpack nix-shell-configure nix-shell-build) "nix-shell" nil t)
  (autoload-if-found '(nix-repl) "nix-repl" nil t)
  (autoload-if-found '(nix-format-before-save) "nix-format" nil t)

  (add-to-list 'auto-mode-alist '("\\.nix$" . nix-mode))
  (add-to-list 'auto-mode-alist '("\\.drv$" . nix-drv-mode))

  (add-hook 'before-save-hook #'nix-format-before-save)

  (with-eval-after-load 'nix-mode
    (add-hook 'nix-mode-hook #'lsp)))

7.59. nginx-mode

(eval-when-compile
  (el-clone :repo "ajc/nginx-mode"))

(with-delayed-execution
  (message "Install nginx-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nginx-mode"))

  (autoload-if-found '(nginx-mode) "nginx-mode" nil t)

  (add-to-list 'auto-mode-alist '("nginx\\.conf\\'" . nginx-mode))
  (add-to-list 'auto-mode-alist '("/nginx/.+\\.conf\\'" . nginx-mode))
  (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/" . nginx-mode))

  (with-eval-after-load 'nginx-mode
    (setq nginx-indent-tabs-mode t)))

7.60. nov-mode

(eval-when-compile
  (el-clone :repo "wasamasa/nov.el"))

(with-delayed-execution
  (message "Install nov-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nov"))

  (autoload-if-found '(nov-mode) "nov" nil t)

  (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))

  (with-eval-after-load 'nov
    (add-hook 'nov-mode-hook #'(lambda () (view-mode -1)))))

7.61. pcap-mode

(eval-when-compile
  (el-clone :repo "orgcandman/pcap-mode"))

(with-delayed-execution
  (message "Install pcap-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/pcap-mode"))

  (autoload-if-found '(pcap-mode) "pcap" nil t)

  (add-to-list 'auto-mode-alist '("\\.pcap$" . pcap-mode)))

7.62. phel-mode

(with-delayed-execution
  (message "Install phel-mode...")

  (define-derived-mode phel-mode clojure-mode "Phel"
    "Major mode for editing Phel language source files."
    (setq-local comment-start "#")
    ;; We disable lockfiles so that ILT evaluation works.
    ;; The lockfiles seem to modify the buffer-file-name somehow, when the buffer changes
    ;; And that is detected by the currently running Phel process.
    ;; That interferes with evaluation, as the running Phel process starts behaving badly because of that.
    (setq-local create-lockfiles nil)
    )

  (add-to-list 'auto-mode-alist '("\\.phel$" . phel-mode)))

7.63. php-mode

(eval-when-compile
  (el-clone :repo "emacs-php/php-mode"))

(with-delayed-execution
  (message "Install php-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/php-mode/lisp"))

  (autoload-if-found '(php-mode php-current-class php-current-namespace) "php-mode" nil t)
  (autoload-if-found '(php-format-this-buffer-file
                       php-format-project
                       php-format-on-after-save-hook
                       php-format-auto-mode) "php-format" nil t)

  (add-to-list 'auto-mode-alist '("\\.php$" . php-mode))

  (with-eval-after-load 'php-mode
    ;; hook
    (add-hook 'php-mode-hook #'lsp)
    (add-hook 'php-mode-hook #'php-format-auto-mode)

    ;; keybind
    (define-key php-mode-map (kbd "C-c C--") #'php-current-class)
    (define-key php-mode-map (kbd "C-c C-=") #'php-current-namespace)
    (define-key php-mode-map (kbd "C-.") nil)

    ;; config
    (setq php-mode-coding-style 'psr2)

    ;; phpstan
    (define-derived-mode phpstan-mode php-mode "phpstan")))

7.64. php-ts-mode

(eval-when-compile
  (el-clone :repo "emacs-php/php-ts-mode"))

(with-delayed-execution
  (message "Install php-ts-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/php-ts-mode"))
  (autoload-if-found '(php-ts-mode) "php-ts-mode" nil t)

  ;; (add-to-list 'auto-mode-alist '("\\.php$" . php-ts-mode))

  (with-eval-after-load 'php-ts-mode
    ;; (add-hook 'php-ts-mode-hook #'eglot)
    ))

7.65. phpt-mode

(eval-when-compile
  (el-clone :repo "emacs-php/phpt-mode"))

(with-delayed-execution
  (message "Install phpt-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/phpt-mode"))

  (autoload-if-found '(phpt-mode) "phpt-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.phpt$" . phpt-mode)))

7.66. plantuml-mode

(eval-when-compile
  (el-clone :repo "skuro/plantuml-mode"))

(with-delayed-execution
  (message "Install plantuml-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/plantuml-mode"))

  (autoload-if-found '(plantuml-mode) "plantuml-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.pu$" . plantuml-mode)))

7.67. protobuf-mode

(eval-when-compile
  (el-clone :repo "protocolbuffers/protobuf"))

(with-delayed-execution
  (message "Install protobuf-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/protobuf/editors"))

  (autoload-if-found '(protobuf-mode) "protobuf-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.proto\\'" . protobuf-mode)))

7.68. pug-mode

(eval-when-compile
  (el-clone :repo "hlissner/emacs-pug-mode"))

(with-delayed-execution
  (message "Install pug-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-pug-mode"))

  (autoload-if-found '(pug-mode) "pug-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.pug$" . pug-mode)))

7.69. prisma-mode

(eval-when-compile
  (el-clone :repo "pimeys/emacs-prisma-mode"))

(with-delayed-execution
  (message "Install prisma-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-prisma-mode"))

  (autoload-if-found '(prisma-mode) "prisma-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.prisma" . prisma-mode)))

7.70. processing-mode

(eval-when-compile
  (el-clone :repo "ptrv/processing2-emacs"))

(with-delayed-execution
  (message "Install processing-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/processing2-emacs"))

  (autoload-if-found '(processing-mode) "processing-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.pde$" . processing-mode))

  (with-eval-after-load 'processing-mode
    (setq processing-location "/opt/processing/processing-java")
    (setq processing-output-dir "/tmp")))

7.71. python-mode

(eval-when-compile
  (el-clone :fetcher "gitlab"
            :repo "python-mode-devs/python-mode"))

(with-delayed-execution
  (message "Install python-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/python-mode"))

  (autoload-if-found '(python-mode) "python-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.py$" . python-mode))

  (with-eval-after-load 'python
    (add-hook 'python-mode #'lsp)))

7.72. qt-pro-mode

(eval-when-compile
  (el-clone :repo "emacsorphanage/qt-pro-mode"))

(with-delayed-execution
  (message "Install qt-pro-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/qt-pro-mode"))

  (autoload-if-found '(qt-pro-mode) "qt-pro-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.pr[io]$" . qt-pro-mode)))

7.73. robots-txt-mode

(eval-when-compile
  (el-clone :repo "emacs-php/robots-txt-mode"))

(with-delayed-execution
  (message "Install robots-txt-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/robots-txt-mode"))

  (autoload-if-found '(robots-txt-mode) "robots-txt-mode" nil t)

  (add-to-list 'auto-mode-alist '("/robots\\.txt\\'" . robots-txt-mode)))

7.74. ruby-mode

(with-delayed-execution
  (message "Install ruby-mode...")
  (autoload-if-found '(ruby-mode) "ruby-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.irbrc$" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Schemafile" . ruby-mode))
  (add-to-list 'auto-mode-alist '(".pryrc" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Fastfile" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Matchfile" . ruby-mode))
  (add-to-list 'auto-mode-alist '("Procfile" . ruby-mode))
  (add-to-list 'auto-mode-alist '(".git-pr-template" . ruby-mode))
  (add-to-list 'auto-mode-alist '(".gemrc" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.Brewfile" . ruby-mode))

  (with-eval-after-load 'ruby-mode
    ;; config
    (setq ruby-insert-encoding-magic-comment nil)))

7.75. rust-mode

(eval-when-compile
  (el-clone :repo "rust-lang/rust-mode"))

(with-delayed-execution
  (message "Install rust-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/rust-mode"))

  (autoload-if-found '(rust-mode) "rust-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.rs$" . rust-mode))

  (with-eval-after-load 'rust-mode
    (setq rust-format-on-save t)
    (add-hook 'rust-mode-hook #'lsp)))

7.76. scala-mode

(eval-when-compile
  (el-clone :repo "hvesalai/emacs-scala-mode"))

(with-delayed-execution
  (message "Install scala-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-scala-mode"))

  (autoload-if-found '(scala-mode) "scala-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode)))

7.77. scheme-mode

(with-delayed-execution
  (message "Install scheme...")
  (autoload-if-found '(scheme-mode) "scheme-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.scheme$" . scheme-mode))
  (add-to-list 'auto-mode-alist '(".guix-channel" . scheme-mode))
  (with-eval-after-load 'scheme
    (setq scheme-program-name "gosh -i")))

7.78. scad-mode

(eval-when-compile
  (el-clone :repo "openscad/emacs-scad-mode"))

(with-delayed-execution
  (message "Install scad-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-scad-mode"))
  (autoload-if-found '(scad-mode) "scad-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.scad\\'" . scad-mode)))

7.79. scss-mode

(eval-when-compile
  (el-clone :repo "antonj/scss-mode"))

(with-delayed-execution
  (message "Install scss-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/scss-mode"))

  (autoload-if-found '(scss-mode) "scss-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.scss$" . scss-mode))
  (add-to-list 'auto-mode-alist '("\\.sass$" . scss-mode))

  (with-eval-after-load 'scss-mode
    (add-hook 'scss-mode-hook #'flycheck-mode)
    (add-hook 'scss-mode-hook #'(lambda ()
                                  (let ((lsp-diagnostics-provider :none))
                                    (lsp-deferred))))))

7.80. shell-mode

(with-delayed-execution
  (autoload-if-found '(shell-mode) "shell-mode" nil t)
  (define-derived-mode console-mode shell-mode "console"))

7.81. slim-mode

(eval-when-compile
  (el-clone :repo "slim-template/emacs-slim"))

(with-delayed-execution
  (message "Install slim-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-slim"))

  (autoload-if-found '(slim-mode) "slim-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.slim$" . slim-mode)))

7.82. solidity-mode

(eval-when-compile
  (el-clone :repo "ethereum/emacs-solidity"))

(with-delayed-execution
  (message "Install solidity-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-solidity"))

  (autoload-if-found '(solidity-mode) "solidity-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.sol$" . solidity-mode)))

7.83. ssh-config-mode

(eval-when-compile
  (el-clone :repo "jhgorrell/ssh-config-mode-el"))

(with-delayed-execution
  (message "Install ssh-config-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ssh-config-mode-el"))

  (autoload-if-found '(ssh-config-mode ssh-known-hosts-mode ssh-authorized-keys-mode) "ssh-config-mode" nil t)

  (add-to-list 'auto-mode-alist '("/\\.ssh/config\\(\\.d/.*\\.conf\\)?\\'" . ssh-config-mode))
  (add-to-list 'auto-mode-alist '("/sshd?_config\\(\\.d/.*\\.conf\\)?\\'" . ssh-config-mode))
  (add-to-list 'auto-mode-alist '("/known_hosts\\'" . ssh-config-mode))
  (add-to-list 'auto-mode-alist '("/authorized_keys2?\\'" . ssh-config-mode)))

7.84. sql-mode

(with-eval-after-load 'sql
  (load-library "sql-indent")

  ;; config
  (setq indent-tabs-mode nil)
  (setq sql-user "root")
  (setq sql-password "P@ssw0rd")
  (setq sql-server "127.0.0.1")
  (setq sql-port 13306)
  (setq sql-mysql-login-params '(server port user password database))

  ;; hook
  (add-hook 'sql-mode-hook #'flycheck-mode))

7.85. swift-mode

(eval-when-compile
  (el-clone :repo "swift-emacs/swift-mode"))

(with-delayed-execution
  (message "Install swift-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/swift-mode"))

  (autoload-if-found '(swift-mode) "swift-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.swift$" . swift-mode)))

7.86. syslog-mode

(eval-when-compile
  (el-clone :repo "vapniks/syslog-mode"))

(with-delayed-execution
  (message "Install syslog-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/syslog-mode"))

  (autoload-if-found '(syslog-mode) "syslog-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.log$" . syslog-mode)))

7.87. systemd-mode

(eval-when-compile
  (el-clone :repo "holomorph/systemd-mode"))

(with-delayed-execution
  (message "Install systemd-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/systemd-mode"))

  (autoload-if-found '(systemd-mode) "systemd" nil t)

  (add-to-list 'auto-mode-alist '("\\.nspawn\\'" . systemd-mode))
  (add-to-list 'auto-mode-alist `(,(rx (+? (any "a-zA-Z0-9-_.@\\")) "."
                                       (or "automount" "busname" "mount" "service" "slice"
                                           "socket" "swap" "target" "timer" "link" "netdev" "network")
                                       string-end)
                                  . systemd-mode))
  (add-to-list 'auto-mode-alist `(,(rx ".#"
                                       (or (and (+? (any "a-zA-Z0-9-_.@\\")) "."
                                                (or "automount" "busname" "mount" "service" "slice"
                                                    "socket" "swap" "target" "timer" "link" "netdev" "network"))
                                           "override.conf")
                                       (= 16 (char hex-digit)) string-end)
                                  . systemd-mode))
  (add-to-list 'auto-mode-alist `(,(rx "/systemd/" (+? anything) ".d/" (+? (not (any ?/))) ".conf" string-end)
                                  . systemd-mode)))

7.88. terraform-mode

(eval-when-compile
  (el-clone :repo "syohex/emacs-hcl-mode")
  (el-clone :repo "emacsorphanage/terraform-mode"))

(with-delayed-execution
  (message "Install terraform-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-hcl-mode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/terraform-mode"))

  (autoload-if-found '(hcl-mode) "hcl-mode" nil t)
  (autoload-if-found '(terraform-mode terraform-format-on-save-mode) "terraform-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.hcl$" . hcl-mode))
  (add-to-list 'auto-mode-alist '("\\.tf$" . terraform-mode))

  (with-eval-after-load 'terraform-mode
    (add-hook 'terraform-mode-hook #'lsp)
    (add-hook 'terraform-mode-hook #'terraform-format-on-save-mode)
    (add-hook 'terraform-mode-hook #'flycheck-mode)))

7.89. text-mode

(with-delayed-execution
  (autoload-if-found '(conf-space-mode) "conf-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.tigrc$" . conf-space-mode))
  (add-to-list 'auto-mode-alist '("\\.editrc$" . conf-space-mode))
  (add-to-list 'auto-mode-alist '("\\.inputrc$" . conf-space-mode))
  (add-to-list 'auto-mode-alist '("\\.colorrc$" . conf-space-mode))
  (add-to-list 'auto-mode-alist '("\\.asdfrc$" . conf-space-mode))
  (add-to-list 'auto-mode-alist '("credentials$" . conf-space-mode)))

7.90. toml-mode

(eval-when-compile
  (el-clone :repo "dryman/toml-mode.el"))

(with-delayed-execution
  (message "Install toml-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/toml-mode"))

  (autoload-if-found '(toml-mode) "toml-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.toml$" . toml-mode))

  (with-eval-after-load 'toml-mode
    (add-hook 'toml-mode-hook #'flycheck-mode)))

7.91. tmux-mode

(eval-when-compile
  (el-clone :repo "nverno/tmux-mode"))

(with-delayed-execution
  (message "Install tmux-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/tmux-mode"))
  (autoload-if-found '(tmux-mode) "tmux-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.tmux\\.conf$" . tmux-mode)))

7.92. typescript-mode

(eval-when-compile
  (el-clone :repo "emacs-typescript/typescript.el"))

(with-delayed-execution
  (message "Install typescript-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/typescript"))

  (autoload-if-found '(typescript-mode typescript-tsx-mode) "typescript-mode" nil t)

  ;; for ts/deno
  (add-to-list 'auto-mode-alist '("\\.ts$" . typescript-mode))
  (add-hook 'typescript-mode-hook #'lsp-deferred)

  ;; for tsx
  (define-derived-mode typescript-tsx-mode typescript-mode "tsx")
  (add-to-list 'auto-mode-alist '("\\.js$" . typescript-tsx-mode))
  (add-to-list 'auto-mode-alist '("\\.jsx$" . typescript-tsx-mode))
  (add-to-list 'auto-mode-alist '("\\.tsx$" . typescript-tsx-mode))

  ;; hook
  (add-hook 'typescript-tsx-mode-hook #'lsp)
  (add-hook 'typescript-tsx-mode-hook #'emmet-mode))

7.93. v-mode

(eval-when-compile
  (el-clone :repo "damon-kwok/v-mode"))

(with-delayed-execution
  (message "Install v-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/v-mode"))

  (autoload-if-found '(v-mode v-menu v-format-buffer) "v-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\(\\.v?v\\|\\.vsh\\)$" . v-mode))

  (with-eval-after-load 'v-mode
    (define-key v-mode-map (kbd "M-z") #'v-menu)
    (define-key v-mode-map (kbd "C-c C-f") #'v-format-buffer)))

7.94. vue-mode

(eval-when-compile
  (el-clone :repo "AdamNiederer/ssass-mode")
  (el-clone :repo "AdamNiederer/vue-html-mode")
  (el-clone :repo "purcell/mmm-mode")
  (el-clone :repo "Fanael/edit-indirect")
  (el-clone :repo "AdamNiederer/vue-mode"))

(with-delayed-execution
  (message "Install vue-mode...")

  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ssass-mode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/vue-html-mode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/mmm-mode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/edit-indirect"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/vue-mode"))

  (autoload-if-found '(vue-mode) "vue-mode" nil t)
  (add-to-list 'auto-mode-alist '("\\.vue$" . vue-mode))

  (with-eval-after-load 'vue-html-mode
    (setq vue-html-extra-indent 4)))

7.95. vimrc-mode

(eval-when-compile
  (el-clone :repo "mcandre/vimrc-mode"))

(with-delayed-execution
  (message "Install vimrc-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/vimrc-mode"))

  (autoload-if-found '(vimrc-mode) "vimrc-mode" nil t)

  (add-to-list 'auto-mode-alist '("vimrc" . vimrc-mode))
  (add-to-list 'auto-mode-alist '("\\.vim\\(rc\\)?\\'" . vimrc-mode))

  (with-eval-after-load 'vimrc-mode
    (add-hook 'vimrc-mode-hook #'lsp-deferred)))

7.96. wat-mode

(eval-when-compile
  (el-clone :repo "devonsparks/wat-mode"))

(with-delayed-execution
  (message "Install wat-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/wat-mode"))

  (autoload-if-found '(wat-mode) "wat-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.wat?\\'" . wat-mode)))

7.97. web-mode

(eval-when-compile
  (el-clone :repo "fxbois/web-mode"))

(with-delayed-execution
  (message "Install web-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/web-mode"))

  (autoload-if-found '(web-mode) "web-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.html$" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.erb$" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.gsp$" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.svg$" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.tpl$" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.liquid$" . web-mode))

  (with-eval-after-load 'web-mode
    (setq web-mode-comment-style 2)
    (setq web-mode-enable-auto-pairing nil)
    (setq web-mode-enable-auto-indentation nil)))

7.98. web-php-blade-mode

(eval-when-compile
  (el-clone :repo "takeokunn/web-php-blade-mode"))

(with-delayed-execution
  (message "Install web-php-blade-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/web-php-blade-mode"))

  (autoload-if-found '(web-php-blade-mode) "web-php-blade-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.blade.php$" . web-php-blade-mode)))

7.99. wolfram-mode

(eval-when-compile
  (el-clone :repo "kawabata/wolfram-mode"))

(with-delayed-execution
  (message "Install wolfram-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/wolfram-mode"))

  (autoload-if-found '(wolfram-mode run-wolfram) "wolfram-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.m$" . wolfram-mode))
  (add-to-list 'auto-mode-alist '("\\.nb$" . wolfram-mode))
  (add-to-list 'auto-mode-alist '("\\.cbf$" . wolfram-mode))

  (with-eval-after-load 'wolfram-mode
    (setq wolfram-path "path-to-dir")))

7.100. yaml-mode

(eval-when-compile
  (el-clone :repo "yoshiki/yaml-mode"))

(with-delayed-execution
  (message "Install yaml-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/yaml-mode"))

  (autoload-if-found '(yaml-mode) "yaml-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.ya?ml$" . yaml-mode))
  (add-to-list 'auto-mode-alist '("\\.aclpolicy$" . yaml-mode))

  (with-eval-after-load 'yaml-mode
    (add-hook 'yaml-mode-hook #'flycheck-mode)))

7.101. yarn-mode

(eval-when-compile
  (el-clone :repo "anachronic/yarn-mode"))

(with-delayed-execution
  (message "Install yarn-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/yarn-mode"))

  (autoload-if-found '(yarn-mode) "yarn-mode" nil t)

  (add-to-list 'auto-mode-alist '("yarn\\.lock\\'" . yarn-mode)))

7.102. zig-mode

(eval-when-compile
  (el-clone :repo "ziglang/zig-mode"))

(with-delayed-execution
  (message "Install zig-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/zig-mode"))

  (autoload-if-found '(zig-mode) "zig-mode" nil t)

  (add-to-list 'auto-mode-alist '("\\.zig$" . zig-mode))

  (with-eval-after-load 'zig-mode
    (add-hook 'zig-mode-hook #'lsp-deferred)))

8. Awesome Package

8.1. Buffer

8.1.1. auto-save-buffers-enhanced

(eval-when-compile
  (el-clone :repo "kentaro/auto-save-buffers-enhanced"))

(with-delayed-execution
  (message "Install auto-save-buffers-enhanced...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/auto-save-buffers-enhanced"))

  (autoload-if-found '(auto-save-buffers-enhanced) "auto-save-buffers-enhanced" nil t)

  (with-eval-after-load 'auto-save-buffers-enhanced
    (setq auto-save-buffers-enhanced-interval 10)))

8.1.2. editorconfig

(eval-when-compile
  (el-clone :repo "editorconfig/editorconfig-emacs"))

(with-delayed-execution
  (message "Install editorconfig...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/editorconfig-emacs"))

  (autoload-if-found '(editorconfig-mode) "editorconfig" nil t)

  (editorconfig-mode 1))

8.1.3. persistent-scratch

(eval-when-compile
  (el-clone :repo "Fanael/persistent-scratch"))

(with-delayed-execution
  (message "Install persistent-scratch...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/persistent-scratch"))

  (autoload-if-found '(persistent-scratch-setup-default) "persistent-scratch" nil t)

  ;; (persistent-scratch-setup-default)

  (with-eval-after-load 'persistent-scratch
    (setq persistent-scratch-autosave-interval 100)))

8.1.4. popwin

(eval-when-compile
  (el-clone :repo "emacsorphanage/popwin"))

(with-delayed-execution
  (message "Install popwin...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/popwin"))

  (autoload-if-found '(popwin-mode) "popwin" nil t)

  (popwin-mode 1))

8.1.5. whitespace

(with-delayed-execution
  (message "Install whitespace...")
  (when (autoload-if-found '(global-whitespace-mode) "whitespace" nil t)
    (if window-system
        (global-whitespace-mode 1)))
  (with-eval-after-load 'whitespace
    (setq whitespace-style '(face tabs tab-mark spaces space-mark))
    (setq whitespace-display-mappings '((space-mark ?\u3000 [?\u25a1])
                                        (tab-mark ?\t [?\xBB ?\t] [?\\ ?\t])))))

8.2. Check

8.2.1. flycheck

(eval-when-compile
  (el-clone :repo "flycheck/flycheck"))

(with-delayed-execution
  (message "Install flycheck...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/flycheck"))

  (autoload-if-found '(flycheck-mode flycheck-define-checker) "flycheck" nil t))

8.2.2. flycheck-textlint

(with-delayed-execution
  (flycheck-define-checker textlint
    "A linter for prose."
    :command ("npx" "textlint" "--format" "unix" source-inplace)
    :error-patterns
    ((warning line-start (file-name) ":" line ":" column ": "
              (id (one-or-more (not (any " "))))
              (message (one-or-more not-newline)
                       (zero-or-more "\n" (any " ") (one-or-more not-newline)))
              line-end))
    :modes (org-mode))
  (with-eval-after-load 'flycheck
    (add-to-list 'flycheck-checkers 'textlint)))

8.2.3. flycheck-elsa

(eval-when-compile
  (el-clone :repo "emacs-elsa/flycheck-elsa"))

(with-delayed-execution
  (message "Install flycheck-elsa...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/flycheck-elsa"))

  (autoload-if-found '(flycheck-elsa-setup) "flycheck-elsa" nil t)

  (with-eval-after-load 'elisp-mode
    (add-hook 'emacs-lisp-mode-hook #'flycheck-elsa-setup)))

8.3. Client

8.3.1. md4rd

(eval-when-compile
  (el-clone :repo "ahungry/md4rd"))

(with-delayed-execution
  (message "Install md4rd...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/md4rd"))

  (autoload-if-found '(md4rd
                       md4rd-login
                       md4rd-visit
                       md4rd-widget-expand-all
                       md4rd-widget-collapse-all
                       md4rd-reply
                       md4rd-upvote
                       md4rd-downvote
                       md4rd-widget-toggle-line
                       md4rd-refresh-login
                       md4rd-indent-all-the-lines) "md4rd" nil t)

  (with-eval-after-load 'md4rd
    (add-hook 'md4rd-mode-hook #'md4rd-indent-all-the-lines)
    (run-with-timer 0 3540 #'md4rd-refresh-login)

    ;; config
    (setq md4rd-subs-active '(emacs lisp+Common_Lisp prolog clojure))
    ;; (setq md4rd--oauth-access-token "your-access-token-here")
    ;; (setq md4rd--oauth-refresh-token "your-refresh-token-here")

    ;; keymap
    (define-key md4rd-mode-map (kbd "u") 'tree-mode-goto-parent)
    (define-key md4rd-mode-map (kbd "o") 'md4rd-open)
    (define-key md4rd-mode-map (kbd "v") 'md4rd-visit)
    (define-key md4rd-mode-map (kbd "e") 'tree-mode-toggle-expand)
    (define-key md4rd-mode-map (kbd "E") 'md4rd-widget-expand-all)
    (define-key md4rd-mode-map (kbd "C") 'md4rd-widget-collapse-all)
    (define-key md4rd-mode-map (kbd "n") 'widget-forward)
    (define-key md4rd-mode-map (kbd "j") 'widget-forward)
    (define-key md4rd-mode-map (kbd "h") 'backward-button)
    (define-key md4rd-mode-map (kbd "p") 'widget-backward)
    (define-key md4rd-mode-map (kbd "k") 'widget-backward)
    (define-key md4rd-mode-map (kbd "l") 'forward-button)
    (define-key md4rd-mode-map (kbd "q") 'kill-current-buffer)
    (define-key md4rd-mode-map (kbd "r") 'md4rd-reply)
    (define-key md4rd-mode-map (kbd "u") 'md4rd-upvote)
    (define-key md4rd-mode-map (kbd "d") 'md4rd-downvote)
    (define-key md4rd-mode-map (kbd "t") 'md4rd-widget-toggle-line)))

8.4. Color

8.4.1. ansi-color

(with-delayed-execution
  (message "Install ansi-color...")
  (autoload 'ansi-color-for-comint-mode-on "ansi-color" "Set `ansi-color-for-comint-mode' to t." t)
  (autoload-if-found '(ansi-color-for-comint-mode-on) "ansi-color" nil t)

  (with-eval-after-load 'shell-mode
    (add-hook 'shell-mode-hook #'ansi-color-for-comint-mode-on))

  (with-eval-after-load 'compile
    (add-hook 'compilation-filter-hook #'(lambda ()
                                           (ansi-color-apply-on-region (point-min) (point-max))))))

8.4.2. highlight-indent-guides

(eval-when-compile
  (el-clone :repo "DarthFennec/highlight-indent-guides"))

(with-delayed-execution
  (message "Install highlight-indent-guides...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/highlight-indent-guides"))

  (autoload-if-found '(highlight-indent-guides-mode) "highlight-indent-guides" nil t)

  (with-eval-after-load 'yaml-mode
    (add-hook 'yaml-mode-hook 'highlight-indent-guides-mode))

  (with-eval-after-load 'highlight-indent-guides
    (setq highlight-indent-guides-responsive 'stack)
    (setq highlight-indent-guides-method 'bitmap)))

8.4.3. hl-todo

(eval-when-compile
  (el-clone :repo "tarsius/hl-todo"))

(with-delayed-execution
  (message "Install hl-todo...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hl-todo"))

  (autoload-if-found '(global-hl-todo-mode) "hl-todo" nil t)

  (global-hl-todo-mode)

  (with-eval-after-load 'hl-todo
    (setq hl-todo-keyword-faces
          '(("HOLD" . "#d0bf8f")
            ("TODO" . "#cc9393")
            ("NOW" . "#dca3a3")
            ("SOMEDAY" . "#dc8cc3")
            ("WAIT" . "#7cb8bb")
            ("DONE" . "#afd8af")
            ("FIXME" . "#cc9393")))))

8.4.4. xterm-color

(eval-when-compile
  (el-clone :repo "atomontage/xterm-color"))

(with-delayed-execution
  (message "Install xterm-color...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/xterm-color"))

  (autoload-if-found '(xterm-color-filter) "xterm-color" nil t)

  (setenv "TERM" "xterm-256color")

  (with-eval-after-load 'xterm-color
    (setq xterm-color-preserve-properties t)))

8.5. Command

8.5.1. amx

(eval-when-compile
  (el-clone :repo "DarwinAwardWinner/amx"))

(with-delayed-execution-priority-high
  (message "Install amx...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/amx"))

  (with-eval-after-load 'amx
    (setq amx-history-length 100)))

8.6. Completion

8.6.1. corfu

(eval-when-compile
  (el-clone :repo "minad/corfu"))

(with-delayed-execution
  (message "Install corfu...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/corfu"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/corfu/extensions"))

  (autoload-if-found '(global-corfu-mode) "corfu" nil t)

  (global-corfu-mode)

  (with-eval-after-load 'corfu
    (setq corfu-auto t)
    (setq corfu-auto-delay 0.2)
    (setq corfu-cycle t)
    (setq corfu-on-exact-match nil))

  (with-eval-after-load 'indent
    (setq tab-always-indent 'complete)))

8.6.2. cape

(eval-when-compile
  (el-clone :repo "minad/cape"))

(with-delayed-execution
  (message "Install cape...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cape"))

  (autoload-if-found '(cape-file
                       cape-dabbrev
                       cape-elisp-block
                       cape-history
                       cape-keyword) "cape" nil t)

  (with-eval-after-load 'minibuffer
    (add-to-list 'completion-at-point-functions #'cape-dabbrev)
    (add-to-list 'completion-at-point-functions #'cape-file)
    (add-to-list 'completion-at-point-functions #'cape-elisp-block)
    (add-to-list 'completion-at-point-functions #'cape-history)))

8.6.3. prescient

(eval-when-compile
  (el-clone :repo "radian-software/prescient.el"))

(with-delayed-execution
  (message "Install prescient...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/prescient"))

  (autoload-if-found '(prescient-persist-mode) "prescient" nil t)

  (prescient-persist-mode)

  (with-eval-after-load 'prescient
    (setq prescient-aggressive-file-save t)))

8.6.4. kind-icon

(eval-when-compile
  (el-clone :repo "jdtsmith/kind-icon"))

(with-delayed-execution
  (message "Install kind-icon...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/kind-icon"))

  (autoload-if-found '(kind-icon-margin-formatter) "kind-icon" nil t)

  (with-eval-after-load 'corfu
    (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)))

8.7. Cursor

8.7.1. avy

(eval-when-compile
  (el-clone :repo "abo-abo/avy"))

(with-delayed-execution
  (message "Install avy...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/avy"))

  (autoload-if-found '(avy-goto-word-1) "avy" nil t)

  (global-set-key (kbd "C-:") #'avy-goto-word-1)

  (with-eval-after-load 'avy
    (setq avy-all-windows nil)
    (setq avy-background t)))

8.7.2. avy-zap

(eval-when-compile
  (el-clone :repo "cute-jumper/avy-zap"))

(with-delayed-execution
  (message "Install avy-zap...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/avy-zap"))

  (autoload-if-found '(avy-zap-up-to-char-dwim) "avy-zap" nil t)

  (global-set-key (kbd "M-z") 'avy-zap-up-to-char-dwim))

8.7.3. expand-region

(eval-when-compile
  (el-clone :repo "magnars/expand-region.el"))

(with-delayed-execution
  (message "Install expand-region...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/expand-region"))

  (autoload-if-found '(er/expand-region) "expand-region" nil t)

  (transient-mark-mode)

  (global-set-key (kbd "C-M-@") 'er/expand-region))

8.8. multiple-cursors

(eval-when-compile
  (el-clone :repo "magnars/multiple-cursors.el"))

(with-delayed-execution
  (message "Install multiple-cursors...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/multiple-cursors"))

  (autoload-if-found '(mc/mark-next-like-this mc/mark-previous-like-this mc/mark-all-like-this) "multiple-cursors" nil t)

  (global-set-key (kbd "C->") #'mc/mark-next-like-this)
  (global-set-key (kbd "C-<") #'mc/mark-previous-like-this)
  (global-set-key (kbd "C-c C-<") #'mc/mark-all-like-this))

8.8.1. subword

(with-delayed-execution
  (message "Install subword...")
  (autoload-if-found '(my/delete-forward-block) "subword" nil t)

  (global-set-key (kbd "M-d") #'my/delete-forward-block)

  (defun my/delete-forward-block ()
    (interactive)
    (if (eobp)
        (message "End of buffer")
      (let* ((syntax-move-point
              (save-excursion
                (skip-syntax-forward (string (char-syntax (char-after))))
                (point)))
             (subword-move-point
              (save-excursion
                (subword-forward)
                (point))))
        (kill-region (point) (min syntax-move-point subword-move-point))))))

8.9. Dictionary

8.9.1. define-word

(eval-when-compile
  (el-clone :repo "abo-abo/define-word"))

(with-delayed-execution
  (message "Install define-word...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/define-word"))

  (defun my/define-word ()
    (interactive)
    (if (use-region-p)
        (call-interactively #'define-word-at-point)
      (call-interactively #'define-word)))

  (with-eval-after-load 'define-word
    (setq define-word-displayfn-alist
          '((wordnik . takeokunn/define-word--display-in-buffer)
            (openthesaurus . takeokunn/define-word--display-in-buffer)
            (webster . takeokunn/define-word--display-in-buffer)
            (weblio . takeokunn/define-word--display-in-buffer)))))

8.10. Dired

8.10.1. basic

(eval-when-compile
  (el-clone :repo "Fuco1/dired-hacks"))

(with-delayed-execution
  (message "Install dired...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dired-hacks"))

  (with-eval-after-load 'dired
    ;; config
    (setq dired-dwim-target nil)
    (setq dired-hide-details-hide-symlink-targets nil)
    (setq dired-listing-switches "-alh")
    (setq dired-recursive-copies 'always)
    (setq dired-use-ls-dired nil)

    ;; hook
    (add-hook 'dired-mode-hook #'(lambda () (display-line-numbers-mode -1)))))

8.10.2. dired-collapse

(with-delayed-execution
  (message "Install dired-collapse...")

  (autoload-if-found '(dired-collapse-mode) "dired-collapse" nil t)

  (with-eval-after-load 'dired
    (add-hook 'dired-mode #'dired-collapse-mode)))

8.10.3. dired-filter

(with-delayed-execution
  (message "Install dired-filter...")
  (autoload-if-found '(dired-filter-mode) "dired-filter" nil t)
  (with-eval-after-load 'dired
    (add-hook 'dired-mode #'dired-filter-mode)))

8.10.4. dired-narrow

(with-delayed-execution
  (message "Install dired-narrow...")

  (autoload-if-found '(dired-narrow-mode) "dired-narrow" nil t)

  (with-eval-after-load 'dired
    (add-hook 'dired-mode-hook #'dired-narrow-mode)))

8.10.5. dired-open

(with-delayed-execution
  (message "Install dired-open...")

  (autoload-if-found '(dired-open-file) "dired-open" nil t)

  (with-eval-after-load 'dired
    (define-key dired-mode-map [remap dired-find-file] #'dired-open-file)))

8.10.6. dired-ranger

(with-delayed-execution
  (message "Install dired-ranger...")
  (autoload-if-found '() "dired-ranger" nil t))

8.10.7. dired-quick-sort

(eval-when-compile
  (el-clone :fetcher "gitlab"
            :repo "xuhdev/dired-quick-sort"))

(with-delayed-execution
  (message "Install dired-quick-sort...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dired-quick-sort"))

  (autoload-if-found '(dired-quick-sort-setup) "dired-quick-sort" nil t)

  (with-eval-after-load 'dired
    (add-hook 'dired-mode-hook #'dired-quick-sort-setup)))

8.10.8. dired-subtree

(with-delayed-execution
  (message "Install dired-subtree...")
  (autoload-if-found '(dired-subtree-apply-filter) "dired-subtree" nil t))

8.10.9. diredfl

(eval-when-compile
  (el-clone :repo "purcell/diredfl"))

(with-delayed-execution
  (message "Install diredfl...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/diredfl"))
  (autoload-if-found '(diredfl-global-mode) "diredfl" nil t)
  (diredfl-global-mode))

8.11. EWW

8.11.1. basic

(with-delayed-execution
  (message "Install eww...")

  (defun my/eww-rename-buffer ()
    "Rename the name of current EWW buffer."
    (let* ((title (plist-get eww-data :title))
           (url (file-name-base (eww-current-url)))
           (buffer-name (or (if (and title (> (length title) 0))
                                title
                              nil)
                            url "")))
      (rename-buffer (format "eww: %s" buffer-name) t)))

  ;; config
  (with-eval-after-load 'eww
    (setq eww-header-line-format nil)
    (setq eww-search-prefix "http://www.google.co.jp/search?q="))

  ;; keybind
  (with-eval-after-load 'eww
    (define-key eww-mode-map (kbd "C") #'eww-set-character-encoding)
    (define-key eww-mode-map (kbd "C-j") #'eww-follow-link)
    (define-key eww-mode-map (kbd "T") #'eww-goto-title-heading)
    (define-key eww-mode-map (kbd "T") #'eww-goto-title-heading))

  ;; hooks
  (with-eval-after-load 'eww
    (add-hook 'eww-after-render #'my/eww-rename-buffer)))

8.11.2. eww-lnum

(eval-when-compile
  (el-clone :repo "m00natic/eww-lnum"))

(with-delayed-execution
  (message "Install eww-lnum...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eww-lnum"))

  (autoload-if-found '(eww-lnum-follow eww-lnum-universal) "eww-lnum" nil t)

  (with-eval-after-load 'eww
    (define-key eww-mode-map "f" #'eww-lnum-follow)
    (define-key eww-mode-map "F" #'eww-lnum-universal)))

8.12. File

8.12.1. recentf

(with-delayed-execution
  (message "Install recentf...")
  (autoload-if-found '(recentf-mode) "recentf" nil t)
  (recentf-mode 1)
  (with-eval-after-load 'recentf
    (setq recentf-max-menu-items 10000)
    (setq recentf-max-saved-items 10000)
    (setq recentf-auto-cleanup 'never)
    (setq recentf-save-file  "~/.emacs.d/.recentf")
    (setq recentf-exclude '(".recentf" "\\.gpg\\"))))

8.12.2. open-junk-file

(eval-when-compile
  (el-clone :repo "rubikitch/open-junk-file"))

(with-delayed-execution
  (message "Install open-junk-file...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/open-junk-file"))

  (autoload-if-found '(open-junk-file) "open-junk-file" nil t)

  (global-set-key (kbd "C-x j") #'open-junk-file)

  (with-eval-after-load 'open-junk-file
    (setq open-junk-file-format "~/.emacs.d/.junk/%Y-%m-%d-%H%M%S.")))

8.12.3. vlf

(eval-when-compile
  (el-clone :repo "m00natic/vlfi"))

(with-delayed-execution
  (message "Install vlfi...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/vlfi"))

  (autoload-if-found '(vlf-disable-for-function) "vlf-setup" t)

  (vlf-disable-for-function tags-verify-table "etags")
  (vlf-disable-for-function tag-find-file-of-tag-noselect "etags")
  (vlf-disable-for-function helm-etags-create-buffer "helm-tags")

  (with-eval-after-load 'dired
    (define-key dired-mode-map (kbd "V") #'dired-vlf)))

8.13. Font

8.13.1. font-lock-studio

(eval-when-compile
  (el-clone :repo "Lindydancer/font-lock-studio"))

(with-delayed-execution
  (message "Install font-lock-studio...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/font-lock-studio"))

  (autoload-if-found '(font-lock-studio) "font-lock-studio" nil t))

8.14. GC

8.14.1. gcmh

(eval-when-compile
  (el-clone :repo "emacsmirror/gcmh"))

(with-delayed-execution
  (message "Install gcmh...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/gcmh"))

  (autoload-if-found '(gcmh-mode) "gcmh" nil t)

  (gcmh-mode)

  (defvar my/gcmh-status nil)

  (advice-add #'garbage-collect
              :before
              (defun my/gcmh-log-start (&rest _)
                (when gcmh-verbose
                  (setq my/gcmh-status "Running GC..."))))

  (advice-add #'gcmh-message
              :override
              (defun my/gcmh-message (format-string &rest args)
                (setq my/gcmh-status
                      (apply #'format-message format-string args))
                (run-with-timer 2 nil
                                (lambda ()
                                  (setq my/gcmh-status nil)))))

  (with-eval-after-load 'gcmh
    ;; config
    (setq gcmh-verbose t)))

8.15. Git

8.15.1. magit

(eval-when-compile
  (el-clone :repo "magit/transient"
            :load-paths `(,(locate-user-emacs-file "el-clone/transient/lisp")))
  (el-clone :repo "magit/ghub"
            :load-paths `(,(locate-user-emacs-file "el-clone/ghub/lisp")))
  (el-clone :repo "magit/magit-popup")
  (el-clone :repo "magit/with-editor"
            :load-paths `(,(locate-user-emacs-file "el-clone/with-editor/lisp")))
  (el-clone :repo "magit/magit"
            :load-paths `(,(locate-user-emacs-file "el-clone/magit/lisp"))))

(with-delayed-execution-priority-high
  (message "Install magit...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/transient/lisp"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ghub/lisp"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/magit-popup"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/with-editor/lisp"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/magit/lisp"))

  (autoload-if-found '(global-git-commit-mode) "git-commit" nil t)
  (autoload-if-found '(magit-status magit-blame) "magit")

  (global-git-commit-mode)

  (defun my/magit-status ()
    (interactive)
    (let ((default-directory (locate-dominating-file default-directory ".git")))
      (magit-status)))

  (global-set-key (kbd "C-x g") #'my/magit-status)
  (global-set-key (kbd "C-x G") #'magit-blame)

  (with-eval-after-load 'magit
    (setq magit-refresh-status-buffer nil))

  (with-eval-after-load 'magit-status
    (define-key magit-status-mode-map (kbd "C-j") #'magit-visit-thing))

  (with-eval-after-load 'magit-log
    (define-key magit-log-mode-map (kbd "C-j") #'magit-visit-thing))

  (with-eval-after-load 'git-commit
    (define-key git-commit-mode-map (kbd "C-h") #'delete-backward-char)))

8.15.2. magit-forge

(eval-when-compile
  (el-clone :repo "magit/forge"
            :load-paths `(,(locate-user-emacs-file "el-clone/forge/lisp"))))

(with-delayed-execution
  (message "Install magit-forge...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/forge/lisp"))

  ;; (add-hook 'magit-mode-hook #'(lambda () (require 'forge)))
  )

8.15.3. git-gutter

(eval-when-compile
  (el-clone :repo "emacsorphanage/git-gutter"))

(with-delayed-execution
  (message "Install git-gutter...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/git-gutter"))

  (autoload-if-found '(git-gutter-mode) "git-gutter" nil t)

  (with-eval-after-load 'git-gutter
    ;; (add-hook 'prog-mode-hook #'git-gutter-mode)
    (setq git-gutter:update-hooks '(after-save-hook after-revert-hook))))

8.15.4. git-gutter-fringe

(eval-when-compile
  (el-clone :repo "emacsorphanage/git-gutter-fringe"))

(with-delayed-execution
  (message "Install git-gutter-fringe...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/git-gutter-fringe"))

  (autoload-if-found '(git-gutter-fr:init
                       git-gutter-fr:view-diff-infos
                       git-gutter-fr:clear) "git-gutter-fringe" nil t)

  (with-eval-after-load 'git-gutter
    (setq git-gutter-fr:side 'right-fringe)
    (setq git-gutter:window-width -1)
    (setq git-gutter:init-function #'git-gutter-fr:init)
    (setq git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos)
    (setq git-gutter:clear-function #'git-gutter-fr:clear)))

8.15.5. git-timemachine

(eval-when-compile
  (el-clone :repo "emacsmirror/git-timemachine"))

(with-delayed-execution
  (message "Install git-timemachine...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/git-timemachine"))

  (autoload-if-found '(git-timemachine) "git-timemachine" nil t))

8.15.6. gist

(eval-when-compile
  (el-clone :repo "defunkt/gist.el"))

(with-delayed-execution
  (message "Install gist...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/gist"))

  (autoload-if-found '(gist-mode) "gist" nil t))

8.15.7. blamer

(eval-when-compile
  (el-clone :repo "Artawower/blamer.el"))

(with-delayed-execution
  (message "Install blamer...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/blamer"))

  (autoload-if-found '(blamer-mode) "blamer" nil t))

8.15.8. git-auto-commit-mode

(eval-when-compile
  (el-clone :repo "ryuslash/git-auto-commit-mode"))

(with-delayed-execution
  (message "Install git-auto-commit-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/git-auto-commit-mode"))

  (autoload-if-found '(git-auto-commit-mode) "git-auto-commit-mode" nil t)

  (with-eval-after-load 'git-auto-commit-mode
    (setq gac-automatically-push-p t)
    (setq gac-silent-message-p t)
    (setq gac-debounce-interval (* 60 60 3))
    (setq gac-default-message "Update")))

8.16. Googling

8.16.1. google-this

(eval-when-compile
  (el-clone :repo "Malabarba/emacs-google-this"))

(with-delayed-execution
  (message "Install google-this...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-google-this"))

  (autoload-if-found '(google-this) "google-this" nil t))

8.16.2. google-translate

(eval-when-compile
  (el-clone :repo "zonuexe/google-translate"))

(with-delayed-execution
  (message "Install google-translate...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/google-translate"))

  (autoload-if-found '(google-translate-at-point) "google-translate" nil t))

8.17. GPG

8.17.1. epa-file

(with-delayed-execution
  (message "Install epa-file...")
  (autoload-if-found '(epa-file-enable) "epa-file" nil t)

  (epa-file-enable)

  (with-eval-after-load 'epa-file
    (setq epa-file-encrypt-to '("bararararatty@gmail.com"))
    (setq epa-file-select-keys 'silent)
    (setq epa-file-cache-passphrase-for-symmetric-encryption t)
    (setq epg-pinentry-mode 'loopback)

    (fset 'epg-wait-for-status 'ignore)))

8.17.2. pinentry

https://github.com/ch11ng/exwm/wiki#gpg-pinentry

(eval-when-compile
  (el-clone :repo "ueno/pinentry-el"))

(with-delayed-execution
  (message "Install pinentry...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/pinentry-el"))

  (autoload-if-found '(pinentry-start) "pinentry" nil t)
  (when-guix
   (pinentry-start)))

8.18. Help

8.18.1. helpful

(eval-when-compile
  (el-clone :repo "Wilfred/helpful"))

(with-delayed-execution
  (message "Install helpful...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/helpful"))

  (autoload-if-found '(helpful-callable
                       helpful-function
                       helpful-macro
                       helpful-command
                       helpful-key
                       helpful-variable
                       helpful-at-point) "helpful" nil t)
  ;; keybinds
  (when (not my/enable-c-h-backspace)
    (global-set-key (kbd "C-h f") #'helpful-callable)
    (global-set-key (kbd "C-h v") #'helpful-variable)
    (global-set-key (kbd "C-h k") #'helpful-key)
    (global-set-key (kbd "C-c C-d") #'helpful-at-point)
    (global-set-key (kbd "C-h F") #'helpful-function)
    (global-set-key (kbd "C-h C") #'helpful-command)))

8.19. IME

8.19.1. ddskk

(eval-when-compile
  (el-clone :repo "skk-dev/ddskk"))

(with-delayed-execution-priority-high
  (message "Install ddskk...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ddskk"))

  (autoload-if-found '(skk-mode) "skk-autoloads" nil t)

  (global-set-key (kbd "C-x C-j") #'skk-mode)

  (defun my/skk-C-j-key (arg)
    (interactive "P")
    (cond
     ((and (null (skk-in-minibuffer-p))
           (null skk-henkan-mode))
      (skk-emulate-original-map arg))
     (t
      (skk-kakutei arg))))

  (with-eval-after-load 'skk
    ;; config
    (setq skk-preload t)
    (setq default-input-method "japanese-skk"))

  (with-eval-after-load 'skk-vars
    ;; use skkserv
    (when-darwin
     (setq skk-server-host "localhost")
     (setq skk-server-portnum 1178))

    ;; guix
    (when-guix
     (setq skk-user-directory "~/.my-skk-jisyo"))

    (setq skk-byte-compile-init-file t)
    (setq skk-isearch-mode-enable 'always)
    (setq skk-egg-like-newline t)
    (setq skk-show-annotation nil)
    (setq skk-auto-insert-paren t)

    ;; azik
    (setq skk-use-azik t)
    (setq skk-azik-keyboard-type 'jp106)

    ;; ref: https://github.com/skk-dev/ddskk/blob/master/etc/dot.skk#L752-L768
    (add-to-list 'skk-rom-kana-rule-list '(skk-kakutei-key nil my/skk-C-j-key))))

8.19.2. ddskk-posframe

(eval-when-compile
  (el-clone :repo "conao3/ddskk-posframe.el"))

(with-delayed-execution
  (message "Install ddskk-posframe...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ddskk-posframe"))

  (autoload-if-found '(ddskk-posframe-mode) "ddskk-posframe" nil t)

  (with-eval-after-load 'skk
    (add-hook 'skk-mode-hook #'ddskk-posframe-mode)))

8.20. Joke

8.20.1. hacker-typer

(eval-when-compile
  (el-clone :repo "dieggsy/emacs-hacker-typer"))

(with-delayed-execution
  (message "Install hacker-typer...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-hacker-typer"))

  (autoload-if-found '(hacker-typer) "hacker-typer" nil t))

8.20.2. power-mode

(eval-when-compile
  (el-clone :repo "elizagamedev/power-mode.el"))

(with-delayed-execution
  (message "Install power-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/power-mode"))

  (autoload-if-found '(power-mode) "power-mode" nil t))

8.20.3. sudden-death

(eval-when-compile
  (el-clone :repo "yewton/sudden-death.el"))

(with-delayed-execution
  (message "Install sudden-death...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/sudden-death"))

  (autoload-if-found '(sudden-death) "sudden-death" nil t))

8.20.4. redacted

(eval-when-compile
  (el-clone :repo "bkaestner/redacted.el"))

(with-delayed-execution
  (message "Install redacted...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/redacted"))

  (autoload-if-found '(redacted-mode) "redacted" nil t)

  (defun my/redacted-mode ()
    (interactive)
    (read-only-mode (if redacted-mode -1 1))
    (redacted-mode (if redacted-mode -1 1))))

8.20.5. lorem ipsum

(eval-when-compile
  (el-clone :repo "jschaf/emacs-lorem-ipsum"))

(with-delayed-execution
  (message "Install lorem-ipsum...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-lorem-ipsum"))

  (autoload-if-found '(lorem-ipsum-insert-sentences
                       lorem-ipsum-insert-paragraphs
                       lorem-ipsum-insert-list) "lorem-ipsum" nil t)

  (global-set-key (kbd "C-c C-l s") #'lorem-ipsum-insert-sentences)
  (global-set-key (kbd "C-c C-l p") #'lorem-ipsum-insert-paragraphs)
  (global-set-key (kbd "C-c C-l l") #'lorem-ipsum-insert-list))

8.21. Keyboard

8.21.1. key-chord

(eval-when-compile
  (el-clone :repo "emacsorphanage/key-chord"))

(with-delayed-execution
  (message "Install key-chord...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/key-chord"))

  (autoload-if-found '(key-chord-mode key-chord-define-global) "key-chord" nil t)
  (key-chord-mode 1)

  ;; for global
  (key-chord-define-global "fj" #'view-mode)
  (key-chord-define-global "jf" #'view-mode))

8.21.2. key-combo

(eval-when-compile
  (el-clone :repo "uk-ar/key-combo"))

(with-delayed-execution
  (message "Install key-combo...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/key-combo"))

  (autoload-if-found '(key-combo-mode key-combo-define-local) "key-combo" nil t)

  ;; for php-mode
  (with-eval-after-load 'php-mode
    ;; (add-hook 'php-mode-hook
    ;;           #'(lambda ()
    ;;               (key-combo-mode)
    ;;               (when (window-system)
    ;;                 (key-combo-define-local (kbd ",>") " => "))
    ;;               ;; (key-combo-define-local (kbd "+") '("+" " + " "++" " ++ "))
    ;;               ;; (key-combo-define-local (kbd "-") '("-" " - " "--" " -- "))
    ;;               ;; (key-combo-define-local (kbd "*") '("*" "**" " * "))
    ;;               ;; (key-combo-define-local (kbd "=") '("=" " = " "==" "==="))
    ;;               ))
    )

  ;; for typescript-tsx-mode
  (with-eval-after-load 'typescript-tsx-mode
    (add-hook 'typescript-tsx-mode
              #'(lambda ()
                  (key-combo-mode)
                  (key-combo-define-local (kbd "</") #'web-mode-element-close)))))

8.21.3. which-key

(eval-when-compile
  (el-clone :repo "justbur/emacs-which-key"))

(with-delayed-execution
  (message "Install which-key...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-which-key"))

  (autoload-if-found '(which-key-mode) "which-key" nil t)

  (which-key-mode))

8.21.4. dmacro

(eval-when-compile
  (el-clone :repo "emacs-jp/dmacro"))

(with-delayed-execution
  (message "Install dmacro...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dmacro"))

  (autoload-if-found '(global-dmacro-mode) "dmacro" nil t)

  (global-dmacro-mode))

8.22. LSP

8.22.1. eglot

(with-delayed-execution
  (message "Install eglot...")

  (autoload-if-found '(eglot) "eglot" nil t)

  (with-eval-after-load 'eglot
    ;; config
    (setq eglot-events-buffer-size nil)
    (setq eglot-autoshutdown t)
    (setq eglot-extend-to-xref t)

    ;; language server
    (add-to-list 'eglot-server-programs '(php-mode . ("intelephense" "--stdio")))
    (add-to-list 'eglot-server-programs '(clojure-mode clojurescript-mode clojurec-mode
                                                       . ("/Users/take/.emacs.d/.cache/lsp/clojure/clojure-lsp"
                                                          "listen" "--verbose")))))

8.22.2. lsp-mode

(eval-when-compile
  (el-clone :repo "emacs-lsp/lsp-mode"
            :load-paths `(,(locate-user-emacs-file "el-clone/lsp-mode/clients"))))

(with-delayed-execution
  (message "Install lsp-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-mode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-mode/clients"))

  (autoload-if-found '(lsp lsp-deferred lsp-org) "lsp-mode" nil t)
  (autoload-if-found '(lsp-lens-mode lsp-lens-refresh lsp-lens--enable) "lsp-lens" nil t)
  (autoload-if-found '(lsp-modeline-workspace-status-mode) "lsp-modeline" nil t)
  (autoload-if-found '(lsp-headerline-breadcrumb-mode) "lsp-headerline" nil t)

  (advice-add 'lsp-rename :before #'(lambda (&rest _) (remove-hook 'find-file-hooks #'view-mode)))
  (advice-add 'lsp-rename :after #'(lambda (&rest _) (add-hook 'find-file-hooks #'view-mode)))

  (with-eval-after-load 'lsp-mode
    (add-to-list 'lsp-language-id-configuration '("php-ts-mode" . "php"))

    ;; ignore path
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]vendor")
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]storage")
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]docs")
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]target")
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\].calva")
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\].clj-kondo")
    (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\].direnv")

    ;; enable flycheck
    (add-hook 'lsp-mode-hook #'flycheck-mode)

    ;; config
    (setq lsp-idle-delay 0.8)
    (setq lsp-enable-links nil)
    (setq lsp-log-io nil)
    (setq lsp-file-watch-threshold 20000))

  (with-eval-after-load 'lsp-completion
    (setq lsp-completion-no-cache t)
    (setq lsp-prefer-capf t))

  (with-eval-after-load 'lsp-diagnostics
    (setq lsp-diagnostics-provider :flycheck))

  (with-eval-after-load 'lsp-php
    ;; for intelephense
    (setq lsp-intelephense-clear-cache t)
    (setq lsp-intelephense-php-version "8.2")
    (setq lsp-intelephense-telemetry-enabled t)
    (setq lsp-intelephense-files-exclude ["**/.git/**" "**/.svn/**" "**/.hg/**" "**/CVS/**" "**/.DS_Store/**"
                                          "**/node_modules/**" "**/bower_components/**" "**/vendor/**/{Test,test,Tests,tests}/**"
                                          "**/.direnv/**"]))


  (with-eval-after-load 'lsp-completion
    (setq lsp-completion-provider :none))

  (with-eval-after-load 'lsp-ruby
    (setq lsp-solargraph-autoformat t)
    (setq lsp-solargraph-multi-root nil)))

8.22.3. lsp-php-key

(with-delayed-execution
  (message "Install lsp-php-key...")
  (with-eval-after-load 'lsp-php
    (setq lsp-intelephense-licence-key "00OXTX8OROOJH9P")))

8.22.4. consult-lsp

(eval-when-compile
  (el-clone :repo "gagbo/consult-lsp"))

(with-delayed-execution
  (message "Install consult-lsp...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/consult-lsp"))

  (autoload-if-found '(consult-lsp-symbols) "consult-lsp" nil t)

  (with-eval-after-load 'lsp-mode
    (define-key lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols)))

8.22.5. lsp-treemacs

(eval-when-compile
  (el-clone :repo "emacs-lsp/lsp-treemacs"))

(with-delayed-execution
  (message "Install lsp-treemacs...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-treemacs"))

  (autoload-if-found '(lsp-treemacs-sync-mode) "lsp-treemacs" nil t)

  (with-eval-after-load 'lsp-mode
    (add-hook 'lsp-mode-hook #'lsp-treemacs-sync-mode))

  (with-eval-after-load 'lsp-treemacs
    (setq lsp-treemacs-error-list-severity 1)
    (setq lsp-treemacs-error-list-current-project-only t)))

8.22.6. lsp-docker

(eval-when-compile
  (el-clone :repo "emacs-lsp/lsp-docker"))

(with-delayed-execution
  (message "Install lsp-docker...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-docker"))

  (autoload-if-found '(lsp-docker-start) "lsp-docker" nil t))

8.22.7. dap-mode

(eval-when-compile
  (el-clone :repo "emacs-lsp/dap-mode"))

(with-delayed-execution
  (message "Install dap-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dap-mode"))

  (autoload-if-found '(dap-debug) "dap-mode" nil t)
  (autoload-if-found '(dap-hydra) "dap-hydra" nil t)
  (autoload-if-found '(dap-ui-mode dap-ui-controls-mode) "dap-ui" nil t)
  (autoload-if-found '(dap-tooltip-mode) "dap-mouse" nil t)
  (autoload-if-found '(dap-php-setup) "dap-php" nil t)
  (autoload-if-found '(dap-node-setup) "dap-node" nil t)
  (autoload-if-found '(dap-go-setup) "dap-go" nil t)
  (autoload-if-found '(dap-ruby-setup) "dap-ruby" nil t)

  (with-eval-after-load 'dap-mode
    ;; keybind
    (define-key dap-mode-map (kbd "C-c d") #'dap-breakpoint-toggle)

    ;; hook
    (add-hook 'dap-mode-hook #'dap-ui-mode)
    (add-hook 'dap-mode-hook #'dap-ui-controls-mode)
    (add-hook 'dap-mode-hook #'tooltip-mode)
    (add-hook 'dap-mode-hook #'dap-tooltip-mode)
    (add-hook 'dap-stopped-hook #'(lambda (arg) (call-interactively #'dap-hydra))))

  (with-eval-after-load 'php-mode
    (add-hook 'php-mode-hook #'dap-php-setup))

  (with-eval-after-load 'dap-php
    ;; config
    (setq dap-php-debug-path `,(expand-file-name "xdebug/vscode-php-debug" dap-utils-extension-path))

    ;; register
    (dap-register-debug-template "Laravel Run Configuration"
                                 (list :type "php"
                                       :request "launch"
                                       :mode "remote"
                                       :host "localhost"
                                       :port 9003)))

  ;; (with-eval-after-load 'js2-mode
  ;;   (add-hook 'js2-mode-hook #'dap-node-setup))

  (with-eval-after-load 'go-mode
    (add-hook 'go-mode-hook #'dap-go-setup))

  (with-eval-after-load 'ruby-mode
    (add-hook 'ruby-mode-hook #'dap-ruby-setup)))

8.22.8. lsp-ui

(eval-when-compile
  (el-clone :repo "emacs-lsp/lsp-ui"))

(with-delayed-execution
  (message "Install lsp-ui...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-ui"))

  (autoload-if-found '(lsp-ui-mode) "lsp-ui" nil t)

  ;; hook
  (with-eval-after-load 'lsp-mode
    (add-hook 'lsp-mode-hook #'lsp-ui-mode))

  ;; lsp-ui-doc
  (with-eval-after-load 'lsp-ui-doc
    (setq lsp-ui-doc-enable nil)
    (setq lsp-ui-doc-show-with-cursor t)
    (setq lsp-ui-doc-use-webkit t)
    (setq lsp-ui-doc-include-signature t)
    (setq lsp-ui-doc-delay 1)
    (setq lsp-ui-doc-max-height 30))

  ;; lsp-ui-peek
  (autoload-if-found '(lsp-ui-peek-find-references lsp-ui-peek-find-definitions lsp-ui-peek-find-implementation) "lsp-ui-peek" nil t)
  (with-eval-after-load 'lsp-ui-peek
    (setq lsp-ui-peek-enable nil)
    (setq lsp-ui-peek-peek-height 30)
    (setq lsp-ui-peek-list-width 60)
    (setq lsp-ui-peek-fontify 'on-demand))

  ;; lsp-ui-imenu
  (autoload-if-found '(lsp-ui-imenu) "lsp-ui-imenu" nil t)
  (with-eval-after-load 'lsp-ui-imenu
    (setq lsp-ui-imenu-enable nil)
    (setq lsp-ui-imenu-kind-position 'top))

  ;; lsp-ui-sideline
  (autoload-if-found '(lsp-ui-sideline-mode) "lsp-ui-sideline" nil t)
  (with-eval-after-load 'lsp-ui-sideline
    (setq lsp-ui-sideline-enable nil)
    (setq lsp-ui-sideline-show-hover t))

  ;; keybind
  (with-eval-after-load 'lsp-mode
    (define-key lsp-mode-map (kbd "C-c C-r") #'lsp-ui-peek-find-references)
    (define-key lsp-mode-map (kbd "C-c C-j") #'lsp-ui-peek-find-definitions)
    (define-key lsp-mode-map (kbd "C-c C-i") #'lsp-ui-peek-find-implementation)
    (define-key lsp-mode-map (kbd "C-c C-m") #'lsp-ui-imenu)
    (define-key lsp-mode-map (kbd "C-c C-s") #'lsp-ui-sideline-mode)
    (define-key lsp-mode-map (kbd "C-c C-d") #'lsp-ui-doc-mode)))

8.22.9. lsp-scheme

(eval-when-compile
  (el-clone :repo "takeokunn/emacs-lsp-scheme"))

(with-delayed-execution
  (message "Install lsp-scheme...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-lsp-scheme"))

  (autoload-if-found '(lsp-scheme) "lsp-scheme" nil t)

  (with-eval-after-load 'scheme
    ;; (add-hook 'scheme-mode-hook #'lsp-scheme)
    )

  (with-eval-after-load 'lsp-scheme
    (setq lsp-scheme-implementation "guile")))

8.22.10. lsp-haskell

(eval-when-compile
  (el-clone :repo "emacs-lsp/lsp-haskell"))

(with-delayed-execution
  (message "Install lsp-haskell...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-haskell"))

  (autoload-if-found '(lsp) "lsp-haskell" nil t)

  (with-eval-after-load 'haskell-mode
    (add-hook 'haskell-mode-hook #'lsp)
    (add-hook 'haskell-literate-mode-hook #'lsp)))

8.22.11. TODO lsp-pyright

(eval-when-compile
  (el-clone :repo "emacs-lsp/lsp-pyright"))

(with-delayed-execution
  (message "Install lsp-pyright...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-pyright"))

  ;; (with-eval-after-load 'python-mode
  ;;   (add-hook 'python-mode-hook #'(lambda ()
  ;;                                   (require 'lsp-pyright)
  ;;                                   (lsp))))
  )

8.22.12. lsp-bridge

(eval-when-compile
  (el-clone :repo "manateelazycat/lsp-bridge"))

(with-delayed-execution
  (message "Install lsp-bridge...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lsp-bridge"))

  (autoload-if-found '(lsp-bridge-mode) "lsp-bridge" nil t)

  (with-eval-after-load 'lsp-bridge
    ;; config
    (setq lsp-bridge-php-lsp-server "phpactor")

    ;; keybind
    (define-key lsp-bridge-mode-map (kbd "M-.") #'lsp-bridge-find-impl)
    (define-key lsp-bridge-mode-map (kbd "C-c C-r") #'lsp-bridge-find-references)))

8.23. Mail

8.23.1. mu4e

(with-delayed-execution
  (message "Install mu4e...")
  (add-to-list 'load-path (locate-user-emacs-file "/nix/store/w9ifyfgj31lp0l4ksdx66a3c07qpi2b9-emacs-mu4e-1.12.0/share/emacs/site-lisp/elpa/mu4e-1.12.0"))

  (autoload-if-found '(mu4e) "mu4e" nil t)
  (global-set-key (kbd "C-x C-w") #'mu4e)

  (with-eval-after-load 'mu4e
    ;; config
    (setq mail-user-agent 'mu4e-user-agent))

  (with-eval-after-load 'mu4e-update
    ;; config
    (setq mu4e-get-mail-command "offlineimap")
    (setq mu4e-update-interval (* 5 60))
    (setq mu4e-index-cleanup nil)
    (setq mu4e-index-lazy-check t))

  (with-eval-after-load 'mu4e-view
    ;; config
    (setq mu4e-split-view 'horizontal))

  (with-eval-after-load 'mu4e-folders
    ;; config
    (setq mu4e-maildir-shortcuts '((:maildir "/INBOX" :key ?i)
                                   (:maildir "/Redmine" :key ?r)
                                   (:maildir "/GitHub" :key ?g)
                                   (:maildir "/Emacs" :key ?e)
                                   (:maildir "/Guix" :key ?u))))

  (with-eval-after-load 'mm-decode
    (add-to-list 'mm-discouraged-alternatives "text/html")
    (add-to-list 'mm-discouraged-alternatives "text/richtext")))

8.23.2. mu4e-views

(eval-when-compile
  (el-clone :repo "lordpretzel/mu4e-views"))

(with-delayed-execution
  (message "Install mu4e-views...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/mu4e-views"))

  ;; (autoload-if-found '(mu4e-views-mu4e-select-view-msg-method
  ;;                      mu4e-views-cursor-msg-view-window-down
  ;;                      mu4e-views-cursor-msg-view-window-up
  ;;                      mu4e-views-toggle-auto-view-selected-message
  ;;                      mu4e-views-mu4e-view-as-nonblocked-html
  ;;                      mu4e-views-mu4e-use-view-msg-method) "mu4e-views" nil t)

  ;; (mu4e-views-mu4e-use-view-msg-method "html")

  ;; (with-eval-after-load 'mu4e
  ;;   (define-key mu4e-headers-mode-map (kbd "v") #'mu4e-views-mu4e-select-view-msg-method)
  ;;   (define-key mu4e-headers-mode-map (kbd "M-n") #'mu4e-views-mu4e-select-view-msg-method)
  ;;   (define-key mu4e-headers-mode-map (kbd "M-p") #'mu4e-views-cursor-msg-view-window-up)
  ;;   (define-key mu4e-headers-mode-map (kbd "f") #'mu4e-views-toggle-auto-view-selected-message)
  ;;   (define-key mu4e-headers-mode-map (kbd "f") #'mu4e-views-mu4e-view-as-nonblocked-html))

  ;; (with-eval-after-load 'mu4e-view
  ;;   (setq mu4e-views-completion-method 'ivy)
  ;;   (setq mu4e-views-default-view-method "html")
  ;;   (setq mu4e-views-next-previous-message-behaviour 'stick-to-current-window)
  ;;   (setq mu4e-views-auto-view-selected-message t))
  )

8.23.3. mu4e-dashboard

(eval-when-compile
  (el-clone :repo "rougier/mu4e-dashboard"))

(with-delayed-execution
  (message "Install mu4e-dashboard...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/mu4e-dashboard"))

  (autoload-if-found '() "mu4e-dashboard" nil t))

8.24. Minor Modes

8.24.1. command-log-mode

(eval-when-compile
  (el-clone :repo "lewang/command-log-mode"))

(with-delayed-execution
  (message "Install command-log-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/command-log-mode"))

  (autoload-if-found '(clm/toggle-command-log-buffer) "command-log-mode" nil t)

  (defalias 'command-log #'clm/toggle-command-log-buffer))

8.25. Narrowing

8.25.1. fancy-narrow

(eval-when-compile
  (el-clone :repo "takeokunn/fancy-narrow"))

(with-delayed-execution
  (message "Install fancy-narrow...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/fancy-narrow"))

  (autoload-if-found '(fancy-narrow-mode) "fancy-narrow" nil t)

  ;; (with-eval-after-load 'org
  ;;   (add-hook 'org-mode-hook #'fancy-narrow-mode))

  ;; (with-eval-after-load 'elisp-mode
  ;;   (add-hook 'emacs-lisp-mode-hook #'fancy-narrow-mode))

  ;; (with-eval-after-load 'lisp-mode
  ;;   (add-hook 'lisp-mode-hook #'fancy-narrow-mode))

  ;; (with-eval-after-load 'clojure-mode
  ;;   (add-hook 'clojure-mode-hook #'fancy-narrow-mode))
  )

8.25.2. origami

(eval-when-compile
  (el-clone :repo "gregsexton/origami.el"))

(with-delayed-execution
  (message "Install origami...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/origami"))

  (autoload-if-found '(global-origami-mode origami-recursively-toggle-node origami-recursively-toggle-node) "origami" nil t)
  (global-origami-mode)

  (global-set-key (kbd "C-c t") #'origami-recursively-toggle-node)
  (global-set-key (kbd "C-c C-t") #'origami-recursively-toggle-node))

8.26. Process

8.26.1. proced

(with-delayed-execution
  (message "Install proced...")
  (autoload-if-found '(proced) "proced" nil t)
  (add-hook 'proced-mode-hook #'(lambda () (proced-toggle-auto-update 1)))
  (with-eval-after-load 'proced
    (setq proced-auto-update-interval 10)
    (setq proced-tree-flag t)
    (setq proced-format 'long)))

8.26.2. proced-narrow

(eval-when-compile
  (el-clone :repo "travisjeffery/proced-narrow"))

(with-delayed-execution
  (message "Install proced-narrow...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/proced-narrow"))

  (autoload-if-found '(proced-narrow) "proced-narrow" nil t)

  (with-eval-after-load 'proced
    (define-key proced-mode-map (kbd "/") #'proced-narrow)))

8.27. Project

8.27.1. projectile

(eval-when-compile
  (el-clone :repo "bbatsov/projectile"))

(with-delayed-execution-priority-high
  (message "Install projectile...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/projectile"))

  (autoload-if-found '(projectile-mode) "projectile" nil t)

  (projectile-mode)

  (defun my/update-projectile-known-projects ()
    (interactive)
    (setq projectile-known-projects (mapcar
                                     (lambda (x)
                                       (abbreviate-file-name (concat x "/")))
                                     (split-string (shell-command-to-string "ghq list --full-path")))))

  (with-eval-after-load 'projectile
    ;; keybind
    (global-set-key (kbd "M-p") #'projectile-command-map)
    (global-set-key (kbd "C-c p") #'projectile-command-map)

    ;; hook
    (add-hook 'projectile-mode-hook #'my/update-projectile-known-projects)

    ;; config
    (setq projectile-switch-project-action 'projectile-dired)
    (setq projectile-enable-caching t)
    (setq projectile-use-git-grep t)))

8.27.2. consult-projectile

(eval-when-compile
  (el-clone :fetcher "gitlab" :repo "OlMon/consult-projectile"))

(with-delayed-execution
  (message "Install consult-projectile...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/consult-projectile"))

  (autoload-if-found '(consult-projectile-switch-to-buffer
                       consult-projectile-switch-to-buffer-other-window
                       consult-projectile-switch-to-buffer-other-frame
                       consult-projectile-find-dir
                       consult-projectile-find-file
                       consult-projectile-find-file-other-window
                       consult-projectile-find-file-other-frame
                       consult-projectile-recentf
                       consult-projectile-switch-project) "consult-projectile" nil t)

  (with-eval-after-load 'projectile
    (advice-add 'projectile-switch-to-buffer :override #'consult-projectile-switch-to-buffer)
    (advice-add 'projectile-switch-to-buffer-other-window :override #'consult-projectile-switch-to-buffer-other-window)
    (advice-add 'projectile-switch-to-buffer-other-frame :override #'consult-projectile-switch-to-buffer-other-frame)
    (advice-add 'projectile-find-dir :override #'consult-projectile-find-dir)
    (advice-add 'projectile-find-file :override #'consult-projectile-find-file)
    (advice-add 'projectile-find-file-other-window :override #'consult-projectile-find-file-other-window)
    (advice-add 'projectile-find-file-other-frame :override #'consult-projectile-find-file-other-frame)
    (advice-add 'projectile-recentf :override #'consult-projectile-recentf)
    (advice-add 'projectile-switch-project :override #'consult-projectile-switch-project)))

8.28. Refactor

8.28.1. emr

(eval-when-compile
  (el-clone :repo "Wilfred/emacs-refactor"))

(with-delayed-execution
  (message "Install emr...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-refactor"))

  (autoload-if-found '(emr-show-refactor-menu) "emr" nil t)

  (with-eval-after-load 'prog-mode
    (define-key prog-mode-map (kbd "M-RET") #'emr-show-refactor-menu)))

8.29. Search

8.29.1. migemo

(eval-when-compile
  (el-clone :repo "emacs-jp/migemo"))

;; (with-delayed-execution
;;   (message "Install migemo...")
;;   (add-to-list 'load-path (locate-user-emacs-file "el-clone/migemo"))

;;   (autoload-if-found '(migemo-init) "migemo" nil t)

;;   (with-eval-after-load 'migemo
;;     (setq migemo-command "cmigemo")
;;     (setq migemo-dictionary "~/.nix-profile/share/migemo/utf-8/migemo-dict")
;;     (setq migemo-user-dictionary nil)
;;     (setq migemo-regex-dictionary nil)
;;     (setq migemo-coding-system 'utf-8-unix)
;;     (setq migemo-use-pattern-alist t)
;;     (setq migemo-use-frequent-pattern-alist t))

;;   ;; (migemo-init)
;;   )

8.29.2. wgrep

(eval-when-compile
  (el-clone :repo "mhayashi1120/Emacs-wgrep"))

(with-delayed-execution
  (message "Install wgrep...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-wgrep"))

  (autoload-if-found '(wgrep-setup) "wgrep" nil t)

  (with-eval-after-load 'grep
    (add-hook 'grep-setup-hook 'wgrep-setup)))

8.29.3. consult

(eval-when-compile
  (el-clone :repo "minad/consult"))

(with-delayed-execution
  (message "Install consult...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/consult"))

  (autoload-if-found '(consult-bookmark
                       consult-buffer
                       consult-buffer-other-frame
                       consult-buffer-other-tab
                       consult-buffer-other-window
                       consult-complex-command
                       consult-find
                       consult-flycheck
                       consult-focus-lines
                       consult-git-grep
                       consult-global-mark
                       consult-goto-line
                       consult-grep
                       consult-history
                       consult-isearch-history
                       consult-keep-lines
                       consult-line
                       consult-line-multi
                       consult-locate
                       consult-man
                       consult-mark
                       consult-outline
                       consult-project-buffer
                       consult-register
                       consult-register-load
                       consult-register-store
                       consult-ripgrep
                       consult-yank-pop
                       consult-mode-command

                       ;; other
                       consult-preview-at-point-mode
                       consult-register-window) "consult" nil t)
  (autoload-if-found '(consult-compile-error) "consult-compile" nil t)
  (autoload-if-found '(consult-org-heading consult-org-agenda) "consult-org" nil t)
  (autoload-if-found '(consult-imenu consult-imenu-multi) "consult-imenu" nil t)
  (autoload-if-found '(consult-kmacro) "consult-kmacro" nil t)
  (autoload-if-found '(consult-xref) "consult-xref" nil t)

  ;; keybind
  ;; C-c bindings in `mode-specific-map'
  (global-set-key (kbd "C-c M-x") #'consult-mode-command)
  (global-set-key (kbd "C-c h") #'consult-history)

  ;; C-x bindings in `ctl-x-map'
  (global-set-key (kbd "C-x M-:") #'consult-complex-command)
  (global-set-key (kbd "C-x b") #'consult-buffer)
  (global-set-key (kbd "C-x 4 b") #'consult-buffer-other-window)
  (global-set-key (kbd "C-x 5 b") #'consult-buffer-other-frame)

  ;; Other custom bindings
  (global-set-key (kbd "M-y") #'consult-yank-pop)

  ;; M-g bindings in `goto-map'
  (global-set-key (kbd "M-g e") #'consult-compile-error)
  (global-set-key (kbd "M-g f") #'consult-flycheck)
  (global-set-key (kbd "M-g g") #'consult-goto-line)
  (global-set-key (kbd "M-g M-g") #'consult-goto-line)
  (global-set-key (kbd "M-g o") #'consult-outline)
  (global-set-key (kbd "M-g m") #'consult-mark)
  (global-set-key (kbd "M-g k") #'consult-global-mark)
  (global-set-key (kbd "M-g i") #'consult-imenu)
  (global-set-key (kbd "M-g I") #'consult-imenu-multi)

  ;; C-o bindings in `search-map'
  (global-set-key (kbd "C-o") #'(lambda ()
                                  (interactive)
                                  (let ((word (thing-at-point 'symbol 'no-properties)))
                                    (consult-line word))))

  ;; Isearch integration
  (with-eval-after-load 'isearch
    (define-key isearch-mode-map (kbd "M-e") #'consult-isearch-history))

  ;; Minibuffer history
  (with-eval-after-load 'minibuffer
    (define-key minibuffer-local-map (kbd "M-s") #'consult-history)
    (define-key minibuffer-local-map (kbd "M-r") #'consult-history))

  (with-eval-after-load 'simple
    (add-hook 'completion-list-mode #'consult-preview-at-point-mode))

  (with-eval-after-load 'register
    (advice-add #'register-preview :override #'consult-register-window))

  (with-eval-after-load 'xref
    (setq xref-show-xrefs-function #'consult-xref)
    (setq xref-show-definitions-function #'consult-xref)))

8.29.4. affe

(eval-when-compile
  (el-clone :repo "minad/affe"))

(with-delayed-execution
  (message "Install affe...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/affe"))

  (autoload-if-found '(affe-grep) "affe" nil t)

  (with-eval-after-load 'affe
    (setq affe-highlight-function 'orderless-highlight-matches)
    (setq affe-find-command "fd --color=never --full-path")
    (setq affe-regexp-function 'orderless-pattern-compiler)))

8.29.5. compile-multi

(eval-when-compile
  (el-clone :repo "mohkale/compile-multi"))

(with-delayed-execution
  (message "Install compile-multi...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/compile-multi"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/compile-multi/extensions/consult-compile-multi"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/compile-multi/extensions/compile-multi-embark"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/compile-multi/extensions/compile-multi-all-the-icons"))


  (autoload-if-found '(compile-multi) "compile-multi" nil t)
  (autoload-if-found '(consult-compile-multi-mode) "consult-compile-multi" nil t)
  (autoload-if-found '(compile-multi-embark-mode) "compile-multi-embark" nil t)

  (global-set-key (kbd "C-x m") #'compile-multi)

  (with-eval-after-load 'consult
    (consult-compile-multi-mode))

  (with-eval-after-load 'embark
    (compile-multi-embark-mode)))

8.29.6. vertico

(eval-when-compile
  (el-clone :repo "minad/vertico"))

(with-delayed-execution
  (message "Install vertico...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/vertico"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/vertico/extensions"))

  (autoload-if-found '(vertico-mode) "vertico" nil t)
  (autoload-if-found '(vertico-directory-tidy
                       vertico-directory-enter
                       vertico-directory-delete-char
                       vertico-directory-delete-word) "vertico-directory" nil t)
  (autoload-if-found '(vertico-flat-mode) "vertico-flat" nil t)

  (vertico-mode)

  (with-eval-after-load 'rfn-eshadow
    (add-hook 'rfn-eshadow-update-overlay #'vertico-directory-tidy))

  (with-eval-after-load 'vertico
    (setq vertico-count 8)
    (setq vertico-cycle t)))

8.29.7. marginalia

(eval-when-compile
  (el-clone :repo "minad/marginalia"))

(with-delayed-execution
  (message "Install marginalia...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/marginalia"))
  (autoload-if-found '(marginalia-mode) "marginalia" nil t)

  (marginalia-mode)

  (with-eval-after-load 'minibuffer
    (define-key minibuffer-local-map (kbd "M-A") #'marginalia-cycle)))

8.29.8. orderless

(eval-when-compile
  (el-clone :repo "oantolin/orderless"))

(with-delayed-execution
  (message "Install orderless...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/orderless"))

  (autoload-if-found '(orderless-all-completions
                       orderless-try-completion) "orderless" nil t)

  (with-eval-after-load 'minibuffer
    (setq completion-styles '(orderless basic))
    ;; (setq completion-category-overrides '((file (styles basic partial-completion))))

    (add-to-list 'completion-styles-alist '(orderless orderless-try-completion orderless-all-completions
                                                      "Completion of multiple components, in any order."))))

8.30. Shell

8.30.1. exec-path-from-shell

(eval-when-compile
  (el-clone :repo "purcell/exec-path-from-shell"))

(with-delayed-execution-priority-high
  (message "Install exec-path-from-shell...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/exec-path-from-shell"))

  (autoload-if-found '(exec-path-from-shell-initialize) "exec-path-from-shell")
  (exec-path-from-shell-initialize)

  (with-eval-after-load 'exec-path-from-shell
    (setq exec-path-from-shell-variables '("PATH"
                                           "GEM_HOME"
                                           "GOROOT"
                                           "GOPATH"
                                           "LSP_USE_PLISTS"
                                           "TERM"
                                           "SSH_AUTH_SOCK"
                                           "NATIVE_FULL_AOT"
                                           "GPG_TTY"))))

8.31. Snippet

8.31.1. yasnippet

(eval-when-compile
  (el-clone :repo "joaotavora/yasnippet"))

(with-delayed-execution
  (message "Install yasnippet...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/yasnippet"))

  (autoload-if-found '(yas-global-mode) "yasnippet" nil t)

  (yas-global-mode 1))

8.31.2. consult-yasnippet

(eval-when-compile
 (el-clone :repo "mohkale/consult-yasnippet"))

(with-delayed-execution
  (message "Install consult-yasnippet...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/consult-yasnippet"))

  (autoload-if-found '(consult-yasnippet) "consult-yasnippet" nil t)

  (global-set-key (kbd "C-c y") #'consult-yasnippet)
  (global-set-key (kbd "C-c C-y") #'consult-yasnippet))

8.31.3. yasnippet-org

(eval-when-compile
  (el-clone :repo "takeokunn/yasnippet-org"))

(with-delayed-execution
  (message "Install yasnippet-org...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/yasnippet-org"))

  (autoload-if-found '(yasnippet-org) "yasnippet-org" nil t)

  (with-eval-after-load 'yasnippet-org
    (setq yasnippet-org-verbose t)))

8.32. Statistics

8.32.1. esup

(eval-when-compile
  (el-clone :repo "jschaf/esup"))

(with-delayed-execution
  (message "Install esup...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/esup"))

  (autoload-if-found '(esup) "esup" nil t))

8.32.2. explain-pause-mode

(eval-when-compile
  (el-clone :repo "lastquestion/explain-pause-mode"))

(with-delayed-execution
  (message "Install explain-pause-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/explain-pause-mode"))

  (autoload-if-found '(explain-pause-mode) "explain-pause-mode" nil t))

8.32.3. disk-usage

(eval-when-compile
  (el-clone :repo "emacs-straight/disk-usage"))

(with-delayed-execution
  (message "Install disk-usage...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/disk-usage"))

  (autoload-if-found '(disk-usage disk-usage-here) "disk-usage" nil t))

8.32.4. keyfreq

(eval-when-compile
  (el-clone :repo "dacap/keyfreq"))

(with-delayed-execution
  (message "Install keyfreq...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/keyfreq"))

  (autoload-if-found '(keyfreq-mode keyfreq-autosave-mode) "keyfreq" nil t)

  (keyfreq-mode 1)
  (keyfreq-autosave-mode 1))

8.32.5. uptimes

(eval-when-compile
  (el-clone :repo "davep/uptimes.el"))

(with-delayed-execution
  (message "Install uptimes...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/uptimes"))

  (autoload-if-found '(uptimes) "uptimes" nil t))

8.33. Syntax

8.33.1. syntax-subword

(eval-when-compile
  (el-clone :repo "jpkotta/syntax-subword"))

(with-delayed-execution
  (message "Install syntax-subword...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/syntax-subword"))

  (autoload-if-found '(global-syntax-subword-mode) "syntax-subword" nil t)

  (global-syntax-subword-mode))

8.34. System

8.34.1. symon

(eval-when-compile
  (el-clone :repo "zk-phi/symon"))

(with-delayed-execution
  (message "Install symon...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/symon"))

  (autoload-if-found '(symon-mode) "symon" nil t)

  (when-guix
   (symon-mode)))

8.35. Tab

8.35.1. tab-bar

(with-delayed-execution
  (message "Install tab-bar...")
  (autoload-if-found '(tab-bar-mode
                       tab-bar-history-mode
                       tab-previous
                       tab-next) "tab-bar" nil t)

  (tab-bar-history-mode)

  (global-set-key (kbd "C-x C-t") tab-prefix-map)
  (global-set-key (kbd "M-[") #'tab-previous)
  (global-set-key (kbd "M-]") #'tab-next)

  (with-eval-after-load 'tab-bar
    (setq tab-bar-close-button-show nil)
    (setq tab-bar-close-last-tab-choice nil)
    (setq tab-bar-close-tab-select 'left)
    (setq tab-bar-history-mode nil)
    (setq tab-bar-new-tab-choice "*scratch*")
    (setq tab-bar-new-button-show nil)
    (setq tab-bar-tab-name-truncated-max 12)
    (setq tab-bar-separator " | "))

  (defun my/tab-bar-rename-tab ()
    (interactive)
    (let ((proj-name (projectile-project-name)))
      (tab-bar-rename-tab proj-name)))

  ;; rename tab-bar with projectile
  (define-key tab-prefix-map (kbd "r") #'my/tab-bar-rename-tab)

  ;; close neotree when tab bar action
  (advice-add 'tab-new :before #'(lambda (&rest _) (neotree-hide)))
  (advice-add 'tab-next :before #'(lambda (&rest _) (neotree-hide)))
  (advice-add 'tab-bar-switch-to-tab :before #'(lambda (&rest _) (neotree-hide)))

  ;; hook
  (add-hook 'tab-bar-mode-hook #'(lambda () (display-line-numbers-mode -1))))

8.36. Template

8.36.1. auto-insert

(with-delayed-execution
  (message "Install autoinsert...")
  (autoload-if-found '(auto-insert-mode) "autoinsert" nil t)

  (auto-insert-mode)

  (with-eval-after-load 'autoinsert
    (setq auto-insert-directory "~/.emacs.d/auto-insert")))

8.37. Theme

8.37.1. all-the-icons

(eval-when-compile
  (el-clone :repo "domtronn/all-the-icons.el"))

(with-delayed-execution-priority-high
  (message "Install all-the-icons...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/all-the-icons")))

8.37.2. all-the-icons-dired

(eval-when-compile
  (el-clone :repo "jtbm37/all-the-icons-dired"))

(with-delayed-execution
  (message "Install all-the-icons-dired...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/all-the-icons-dired"))

  (autoload-if-found '(all-the-icons-dired-mode) "all-the-icons-dired")

  (with-eval-after-load 'dired
    (add-hook 'dired-mode-hook #'all-the-icons-dired-mode)))

8.37.3. all-the-icons-completion

(eval-when-compile
  (el-clone :repo "iyefrat/all-the-icons-completion"))

(with-delayed-execution
  (message "Install all-the-icons-completion...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/all-the-icons-completion"))

  (autoload-if-found '(all-the-icons-completion-marginalia-setup) "all-the-icons-completion" nil t)

  (all-the-icons-completion-marginalia-setup))

8.37.4. dashboard

(eval-when-compile
  (el-clone :repo "emacs-dashboard/emacs-dashboard"))

(with-delayed-execution
  (message "Install dashboard...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-dashboard"))

  (autoload-if-found '(dashboard-refresh-buffer) "dashboard" nil t)

  (with-eval-after-load 'dashboard
    (setq dashboard-startup-banner 'logo)
    (setq dashboard-set-file-icons t)
    (setq dashboard-startup-banner 4)
    (setq dashboard-items '((recents . 10)))))

8.37.5. dimmer

(eval-when-compile
  (el-clone :repo "gonewest818/dimmer.el"))

(with-eval-after-load 'dimmer
  (message "Install dimmer...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dimmer"))

  (autoload-if-found '(dimmer-configure-which-key
                       dimmer-configure-org
                       dimmer-mode)
                     "dimmer" nil t)

  (dimmer-configure-which-key)
  (dimmer-configure-org)
  (dimmer-mode t))

8.37.6. doom-themes

(eval-when-compile
  (el-clone :repo "doomemacs/themes"
            :load-paths `(,(locate-user-emacs-file "el-clone/themes/extensions"))))

(with-delayed-execution-priority-high
  (message "Install doom-themes...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/themes"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/themes/extensions"))

  (autoload-if-found '(doom-themes-enable-org-fontification) "doom-themes-ext-org" nil t)
  (autoload-if-found '(doom-themes-neotree-config) "doom-themes-ext-neotree" nil t)

  (doom-themes-enable-org-fontification)
  (doom-themes-neotree-config)

  (when (require 'doom-themes)
    (load-theme 'doom-dracula t))

  (with-eval-after-load 'doom-themes
    (setq doom-themes-padded-modeline t)
    (setq doom-themes-enable-bold t)
    (setq doom-themes-enable-italic t)))

8.37.7. doom-modeline

(eval-when-compile
  (el-clone :repo "seagle0128/doom-modeline"))

(with-delayed-execution-priority-high
  (message "Install doom-modeline...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/doom-modeline"))

  (autoload-if-found '(doom-modeline-mode) "doom-modeline" nil t)

  (doom-modeline-mode 1)
  (line-number-mode 0)
  (column-number-mode 0)

  (with-eval-after-load 'doom-modeline
    (setq doom-modeline-buffer-file-name-style 'truncate-with-project)
    (setq doom-modeline-icon `,(display-graphic-p))
    (setq doom-modeline-major-mode-icon `,(display-graphic-p))
    (setq doom-modeline-minor-modes nil)))

8.37.8. emojify

(eval-when-compile
  (el-clone :repo "iqbalansari/emacs-emojify"))

(with-delayed-execution
  (message "Install emojify...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-emojify"))

  (autoload-if-found '(global-emojify-mode global-emojify-mode-line-mode) "emojify" nil t)

  (global-emojify-mode)
  (global-emojify-mode-line-mode))

8.37.9. hl-line

(with-delayed-execution
  (message "Install hl-line...")
  (autoload-if-found '(global-hl-line-mode) "hl-line-mode" nil t)
  (when (not window-system)
    (global-hl-line-mode))
  (with-eval-after-load 'hl-line
    (set-face-attribute 'hl-line nil :inherit nil)
    (set-face-background 'hl-line "#444642")))

8.37.10. idle-highlight-mode

(eval-when-compile
  (el-clone :repo "nonsequitur/idle-highlight-mode"))

(with-delayed-execution
  (message "Install idle-highlight-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/idle-highlight-mode"))

  (autoload-if-found '(idle-highlight-mode) "idle-highlight-mode" nil t)

  (with-eval-after-load 'idle-highlight-mode
    (setq idle-highlight-idle-time 0.1))

  (with-eval-after-load 'prog-mode
    (add-hook 'prog-mode-hook #'idle-highlight-mode)))

8.37.11. neotree

(eval-when-compile
  (el-clone :repo "jaypei/emacs-neotree"))

(with-delayed-execution
  (message "Install neotree...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-neotree"))

  (autoload-if-found '(neotree-hide neotree-dir neotree-make-executor neo-open-file neo-open-dir) "neotree" nil t)

  (defun my/neotree-toggle ()
    (interactive)
    (let ((default-directory (locate-dominating-file default-directory ".git")))
      (if (and (fboundp 'neo-global--window-exists-p)
               (neo-global--window-exists-p))
          (neotree-hide)
        (neotree-dir default-directory))))

  (if window-system
      (defun neo-buffer--insert-fold-symbol (name &optional file-name)
        (or
         (and
          (equal name 'open)
          (insert
           (format " %s "
                   (all-the-icons-icon-for-dir file-name "down"))))
         (and
          (equal name 'close)
          (insert
           (format " %s "
                   (all-the-icons-icon-for-dir file-name "right"))))
         (and
          (equal name 'leaf)
          (insert
           (format " %s "
                   (all-the-icons-icon-for-file file-name)))))))

  (global-set-key (kbd "C-q") #'my/neotree-toggle)

  (with-eval-after-load 'neotree
    ;; config
    (setq neo-autorefresh nil)
    (setq neo-theme 'nerd2)
    (setq neo-show-hidden-files t)
    (setq neo-window-fixed-size nil)

    ;; hook
    (add-hook 'neotree-mode-hook #'(lambda () (display-line-numbers-mode -1)))

    ;; keybind
    (define-key neotree-mode-map (kbd "C-j") (neotree-make-executor
                                              :file-fn #'neo-open-file
                                              :dir-fn  #'neo-open-dir))))

8.37.12. nyan-mode

(eval-when-compile
  (el-clone :repo "TeMPOraL/nyan-mode"))

(with-delayed-execution-priority-high
  (message "Install nyan-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nyan-mode"))

  (autoload-if-found '(nyan-mode) "nyan-mode" nil t)

  (nyan-mode)

  (with-eval-after-load 'nyan-mode
    (setq nyan-cat-face-number 5)
    (setq nyan-animate-nyancat t)))

8.37.13. volatile-highlights

(eval-when-compile
  (el-clone :repo "k-talo/volatile-highlights.el"))

(with-delayed-execution
  (message "Install volatile-highlights...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/volatile-highlights"))

  (autoload-if-found '(volatile-highlights-mode) "volatile-highlights" nil t)

  (volatile-highlights-mode t))

8.37.14. idle-highlight-mode

(eval-when-compile
  (el-clone :repo "nonsequitur/idle-highlight-mode"))

(with-delayed-execution
  (message "Install idle-highlight-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/idle-highlight-mode"))

  (autoload-if-found '(idle-highlight-mode) "idle-highlight-mode" nil t)

  (with-eval-after-load 'prog-mode
    (add-hook 'prog-mode-hook #'idle-highlight-mode))

  (with-eval-after-load 'idle-highlight-mode
    (setq idle-highlight-idle-time 0.1)))

8.38. Undo

8.38.1. undo-tree

(eval-when-compile
  (el-clone :repo "apchamberlain/undo-tree.el"))

(with-delayed-execution
  (message "Install undo-tree...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/undo-tree"))

  (autoload-if-found '(global-undo-tree-mode) "undo-tree" nil t)
  (global-undo-tree-mode)

  (with-eval-after-load 'undo-tree
    (setq undo-tree-auto-save-history nil)))

8.39. View Mode

8.39.1. view-mode

(with-delayed-execution
  (message "Install view-mode...")

  (defun my/org-view-next-heading ()
    (interactive)
    (if (and (derived-mode-p 'org-mode)
             (org-at-heading-p))
        (org-next-visible-heading 1)
      (next-line)))

  (defun my/org-view-previous-heading ()
    (interactive)
    (if (and (derived-mode-p 'org-mode)
             (org-at-heading-p))
        (org-previous-visible-heading 1)
      (previous-line)))

  (defun my/view-tab ()
    (interactive)
    (when (and (derived-mode-p 'org-mode)
               (or (org-at-heading-p)
                   (org-at-property-drawer-p)))
      (let ((view-mode nil))
        (org-cycle))))

  (defun my/view-shifttab ()
    (interactive)
    (when (derived-mode-p 'org-mode)
      (let ((view-mode nil))
        (org-shifttab))))

  (defun my/org-edit-special ()
    (interactive)
    (when (derived-mode-p 'org-mode)
      (view-mode -1)
      (org-edit-special)))

  (defun my/org-ctrl-c-ctrl-c ()
    (interactive)
    (when (derived-mode-p 'org-mode)
      (view-mode -1)
      (org-ctrl-c-ctrl-c)))

  (defvar my/view-mode-timer nil)
  (defun my/enable-view-mode-automatically ()
    (if view-mode
        (when my/view-mode-timer
          (cancel-timer my/view-mode-timer))
      (setq my/view-mode-timer (run-with-idle-timer (* 60 10) nil #'view-mode))))

  (add-hook 'view-mode-hook #'my/enable-view-mode-automatically)
  (advice-add 'view--disable :before #'(lambda (&rest _) (view-lock-mode -1)))

  (with-eval-after-load 'files
    (add-hook 'find-file-hooks #'view-mode))

  (with-eval-after-load "view"
    (define-key view-mode-map (kbd "f") #'forward-char)
    (define-key view-mode-map (kbd "b") #'backward-char)
    (define-key view-mode-map (kbd "n") #'my/org-view-next-heading)
    (define-key view-mode-map (kbd "p") #'my/org-view-previous-heading)
    (define-key view-mode-map (kbd "@") #'set-mark-command)
    (define-key view-mode-map (kbd "C-c '") #'my/org-edit-special)
    (define-key view-mode-map (kbd "C-c C-C") #'my/org-ctrl-c-ctrl-c)
    (define-key view-mode-map (kbd "e") nil)
    (define-key view-mode-map (kbd "C-j") nil)
    (define-key view-mode-map (kbd "C-i") #'my/view-tab)
    (define-key view-mode-map (kbd "S-C-i") #'my/view-shifttab)))

8.39.2. view-lock-mode

(eval-when-compile
  (el-clone :repo "s-fubuki/view-lock-mode"))

(with-delayed-execution
  (message "Install view-lock-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/view-lock-mode"))

  (autoload-if-found '(view-lock-timer-start view-lock-quit) "view-lock-mode" nil t)

  (with-eval-after-load 'view
    (add-hook 'view-mode-hook #'view-lock-timer-start))

  (with-eval-after-load 'view-lock-mode
    (setq view-lock-start-time (* 30 60))))

8.40. Password

8.40.1. password-store

(eval-when-compile
  (el-clone :repo "zx2c4/password-store"))

(with-delayed-execution
  (message "Install password-store...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/password-store/contrib/emacs")))

8.40.2. password-store-otp

(eval-when-compile
  (el-clone :repo "volrath/password-store-otp.el"))

(with-delayed-execution
  (message "Install password-store-otp...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/password-store-otp")))

8.40.3. pass

(eval-when-compile
  (el-clone :repo "NicolasPetton/pass"))

(with-delayed-execution
  (message "Install pass...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/pass"))

  (autoload-if-found '(pass pass-view-mode) "pass" nil t)

  (add-to-list 'auto-mode-alist (cons (substitute-in-file-name "$HOME/ghq/github.com/takeokunn/password-store/.*\\.gpg") 'pass-view-mode))

  (with-eval-after-load 'pass
    (setq pass-suppress-confirmations t)))

8.41. Utility

8.41.1. comint

(with-eval-after-load 'comint
  (setq comint-buffer-maximum-size 100000)
  (setq comint-prompt-read-only t)
  (setq comint-terminfo-terminal "eterm-256color"))

8.41.2. crux

(eval-when-compile
  (el-clone :repo "bbatsov/crux"))

(with-delayed-execution
  (message "Install crux...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/crux"))

  (autoload-if-found '(crux-open-with
                       crux-smart-open-line-above
                       crux-cleanup-buffer-or-region
                       crux-view-url
                       crux-transpose-windows
                       crux-duplicate-current-line-or-region
                       crux-duplicate-and-comment-current-line-or-region
                       crux-rename-file-and-buffer
                       crux-visit-term-buffer
                       crux-kill-other-buffers
                       crux-indent-defun
                       crux-top-join-lines
                       crux-kill-line-backwards) "crux" nil t)

  ;; keybind
  (global-set-key (kbd "C-c o") #'crux-open-with)
  (global-set-key (kbd "C-S-o") #'crux-smart-open-line-above)
  ;; (global-set-key (kbd "C-c n") #'crux-cleanup-buffer-or-region)
  (global-set-key (kbd "C-c u") #'crux-view-url)
  (global-set-key (kbd "C-x 4 t") #'crux-transpose-windows)
  (global-set-key (kbd "C-c d") #'crux-duplicate-current-line-or-region)
  (global-set-key (kbd "C-c M-d") #'crux-duplicate-and-comment-current-line-or-region)
  (global-set-key (kbd "C-c r") #'crux-rename-file-and-buffer)
  (global-set-key (kbd "C-c M-t") #'crux-visit-term-buffer)
  (global-set-key (kbd "C-c k") #'crux-kill-other-buffers)
  (global-set-key (kbd "C-M-z") #'crux-indent-defun)
  (global-set-key (kbd "C-^") #'crux-top-join-lines)
  (global-set-key (kbd "C-DEL") #'crux-kill-line-backwards))

8.41.3. delsel

(with-delayed-execution
  (message "Install delsel...")
  (autoload-if-found '(delete-selection-mode) "delsel" nil t)
  (delete-selection-mode))

8.41.4. dogears

(eval-when-compile
  (el-clone :repo "alphapapa/dogears.el"))

(with-delayed-execution
  (message "Install dogears...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/dogears"))

  (autoload-if-found '(dogears-go
                       dogears-back
                       dogears-forward
                       dogears-list
                       dogears-sidebar) "dogears" nil t)

  ;; keybind
  (global-set-key (kbd "M-g d") #'dogears-go)
  (global-set-key (kbd "M-g M-b") #'dogears-back)
  (global-set-key (kbd "M-g M-f") #'dogears-forward)
  (global-set-key (kbd "M-g M-d") #'dogears-list)
  (global-set-key (kbd "M-g M-D") #'dogears-sidebar))

8.41.5. embark

(eval-when-compile
  (el-clone :repo "oantolin/embark"))

(with-delayed-execution
  (message "Install embark...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/embark"))

  (autoload-if-found '(embark-act embark-dwim embark-prefix-help-command) "embark" nil t)
  (autoload-if-found '(embark-consult-outline-candidates
                       embark-consult-imenu-candidates
                       embark-consult-imenu-or-outline-candidates) "embark-consult" nil t)

  (global-set-key (kbd "C-.") #'embark-act)
  (global-set-key (kbd "C-;") #'embark-dwim)
  (global-set-key (kbd "C-h B") #'embark-prefix-help-command)

  (defmacro my/embark-ace-action (fn)
    `(defun ,(intern (concat "my/embark-ace-" (symbol-name fn))) ()
       (interactive)
       (with-demoted-errors "%s"
         (aw-switch-to-window (aw-select nil))
         (call-interactively (symbol-function ',fn)))))

  (defmacro my/embark-split-action (fn split-type)
    `(defun ,(intern (concat "my/embark-"
                             (symbol-name fn)
                             "-"
                             (car (last (split-string
                                         (symbol-name split-type) "-"))))) ()
       (interactive)
       (funcall #',split-type)
       (call-interactively #',fn)))

  (defun my/sudo-find-file (file)
    "Open FILE as root."
    (interactive "FOpen file as root: ")
    (when (file-writable-p file)
      (user-error "File is user writeable, aborting sudo"))
    (find-file (if (file-remote-p file)
                   (concat "/" (file-remote-p file 'method) ":"
                           (file-remote-p file 'user) "@" (file-remote-p file 'host)
                           "|sudo:root@"
                           (file-remote-p file 'host) ":" (file-remote-p file 'localname))
                 (concat "/sudo:root@localhost:" file))))

  (with-eval-after-load 'embark
    (setq embark-mixed-indicator-delay 0.1)
    (setq prefix-help-command #'embark-prefix-help-command)

    ;; ace-window
    (define-key embark-file-map     (kbd "o") (my/embark-ace-action find-file))
    (define-key embark-buffer-map   (kbd "o") (my/embark-ace-action switch-to-buffer))
    (define-key embark-bookmark-map (kbd "o") (my/embark-ace-action bookmark-jump))

    ;; split window(2)
    (define-key embark-file-map     (kbd "2") (my/embark-split-action find-file split-window-below))
    (define-key embark-buffer-map   (kbd "2") (my/embark-split-action switch-to-buffer split-window-below))
    (define-key embark-bookmark-map (kbd "2") (my/embark-split-action bookmark-jump split-window-below))

    ;; split window(3)
    (define-key embark-file-map     (kbd "3") (my/embark-split-action find-file split-window-right))
    (define-key embark-buffer-map   (kbd "3") (my/embark-split-action switch-to-buffer split-window-right))
    (define-key embark-bookmark-map (kbd "3") (my/embark-split-action bookmark-jump split-window-right))

    ;; sudo
    (define-key embark-file-map (kbd "S") #'my/sudo-find-file)

    ;; consult
    (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)))

8.41.6. goto-addr

(with-delayed-execution
  (message "Install goto-addr...")
  (autoload-if-found '(goto-address-prog-mode goto-address-mode) "goto-address" nil t)

  (with-eval-after-load 'prog-mode
    (add-hook 'prog-mode-hook #'goto-address-prog-mode))

  (with-eval-after-load 'text-mode
    (add-hook 'text-mode-hook #'goto-address-mode)))

8.41.7. htmlize

(eval-when-compile
  (el-clone :repo "hniksic/emacs-htmlize"))

(with-delayed-execution
  (message "Install htmlize...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-htmlize"))

  (with-eval-after-load 'htmlize
    (setq htmlize-html-charset 'utf-8)))

8.41.8. midnight

(with-delayed-execution
  (message "Install midnight...")
  (autoload-if-found '(midnight-mode) "midnight" nil t)
  (midnight-mode)
  (with-eval-after-load 'midnight
    (setq clean-buffer-list-delay-general 1)))

8.41.9. minimap

(eval-when-compile
  (el-clone :repo "dengste/minimap"))

(with-delayed-execution
  (message "Install minimap...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/minimap"))

  (autoload-if-found '(minimap-mode) "minimap" nil t)

  (global-set-key (kbd "C-c m") #'minimap-mode)

  (with-eval-after-load 'minimap
    (setq minimap-window-location 'right)
    (setq minimap-update-delay 0.2)
    (setq minimap-minimum-width 20)
    (setq minimap-major-modes '(prog-mode org-mode))))

8.41.10. puni

(eval-when-compile
  (el-clone :repo "AmaiKinono/puni"))

(with-delayed-execution
  (message "Install puni...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/puni"))

  (autoload-if-found '(puni-global-mode puni-disable-puni-mode) "puni" nil t)
  (puni-global-mode)

  (with-eval-after-load 'lisp-mode
    (add-hook 'lisp-mode-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'emacs-lisp-mode
    (add-hook 'emacs-lisp-mode-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'clojure-mode
    (add-hook 'clojure-mode-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'lisp-interaction-mode
    (add-hook 'lisp-interacton-mode-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'scheme
    (add-hook 'scheme-mode-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'simple
    (add-hook 'eval-expression-minibuffer-setup-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'ielm
    (add-hook 'inferior-emacs-lisp-mode-hook #'puni-disable-puni-mode))

  (with-eval-after-load 'minibuffer
    (add-hook 'minibuffer-mode-hook #'puni-disable-puni-mode)))

8.41.11. quickrun

(eval-when-compile
  (el-clone :repo "emacsorphanage/quickrun"))

(with-delayed-execution
  (message "Install quickrun...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/quickrun"))

  (autoload-if-found '(quickrun) "quickrun" nil t))

8.41.12. restclient

(eval-when-compile
  (el-clone :repo "pashky/restclient.el"))

(with-delayed-execution
  (message "Install restclient...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/restclient"))

  (autoload-if-found '(restclient-mode) "restclient" nil t))

8.41.13. smartparens

(eval-when-compile
  (el-clone :repo "Fuco1/smartparens"))

(with-delayed-execution
  (message "Install smartparens...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/smartparens"))

  (with-eval-after-load 'smartparens))

8.41.14. smart-jump

(eval-when-compile
  (el-clone :repo "jojojames/smart-jump"))

(with-delayed-execution
  (message "Install smart-jump...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/smart-jump"))

  (with-eval-after-load 'smart-jump))

8.41.15. string-inflection

(eval-when-compile
  (el-clone :repo "akicho8/string-inflection"))

(with-delayed-execution
  (message "Install string-inflection...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/string-inflection"))

  (autoload-if-found '(string-inflection-all-cycle) "string-inflection" nil t))

8.41.16. sudo-edit

(eval-when-compile
  (el-clone :repo "nflath/sudo-edit"))

(with-delayed-execution
  (message "Install sudo-edit...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/sudo-edit"))

  (autoload-if-found '(sudo-edit-current-file) "sudo-edit" nil t))

8.41.17. topsy

(eval-when-compile
  (el-clone :repo "alphapapa/topsy.el"))

(with-delayed-execution
  (message "Install topsy...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/topsy"))

  (autoload-if-found '(topsy-mode) "topsy" nil t)
  ;; (with-eval-after-load 'prog-mode
  ;;   (add-hook 'prog-mode-hook #'topsy-mode))

  ;; (with-eval-after-load 'lsp-ui-mode
  ;;   (add-hook 'lsp-ui-mode-hook #'(lambda () (topsy-mode -1))))
  )

8.41.18. uuid

(eval-when-compile
  (el-clone :repo "nicferrier/emacs-uuid"))

(with-delayed-execution
  (message "Install uuid...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-uuid"))

  (autoload-if-found '(uuid-string) "uuid" nil t)

  (defun my/uuid ()
    (interactive)
    (insert (uuid-string)))

  (defalias 'uuid #'my/uuid))

8.41.19. woman

(with-delayed-execution
  (autoload-if-found '(woman woman-find-file) "woman" nil t))

8.42. Window

8.42.1. ace-window

(eval-when-compile
  (el-clone :repo "abo-abo/ace-window"))

(with-delayed-execution
  (message "Install ace-window...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ace-window"))

  (autoload-if-found '(ace-window) "ace-window" nil t)

  (global-set-key (kbd "C-x o") #'ace-window)

  (with-eval-after-load 'ace-window
    (setq aw-dispatch-always t)
    (setq aw-scope 'frame)
    (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
    (setq aw-minibuffer-flag t)))

8.42.2. writeroom-mode

(eval-when-compile
  (el-clone :repo "joostkremers/writeroom-mode"))

(with-delayed-execution
  (message "Install writeroom-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/writeroom-mode"))

  (autoload-if-found '(writeroom-mode
                       writeroom-decrease-width
                       writeroom-increase-width
                       writeroom-adjust-width
                       writeroom-width)
                     "writeroom-mode" nil t)

  (with-eval-after-load 'writeroom-mode
    ;; keybind
    (define-key writeroom-mode-map (kbd "C-M-<") #'writeroom-decrease-width)
    (define-key writeroom-mode-map (kbd "C-M->") #'writeroom-increase-width)
    (define-key writeroom-mode-map (kbd "C-M-=") #'writeroom-adjust-width)

    ;; config
    (setq writeroom-width 150)
    (setq writeroom-maximize-window nil)))

8.42.3. zoom-window

(eval-when-compile
  (el-clone :repo "emacsorphanage/zoom-window"))

(with-delayed-execution
  (message "Install zoom-window...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/zoom-window"))

  (autoload-if-found '(zoom-window-zoom) "zoom-window" nil t)

  (global-set-key (kbd "C-c C-z") #'zoom-window-zoom))

8.43. Remote Access

8.43.1. docker-tramp

(eval-when-compile
  (el-clone :repo "emacs-pe/docker-tramp.el"))

(with-delayed-execution
  (message "Install docker-tramp...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/docker-tramp"))

  (autoload-if-found '(docker-tramp-add-method) "docker-tramp" nil t)
  (docker-tramp-add-method)

  (with-eval-after-load 'tramp
    (tramp-set-completion-function docker-tramp-method docker-tramp-completion-function-alist)))

8.43.2. consult-tramp

(eval-when-compile
  (el-clone :repo "Ladicle/consult-tramp"))

(with-delayed-execution
  (message "Install consult-tramp...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/consult-tramp"))
  (autoload-if-found '(consult-tramp) "consult-tramp" nil t))

9. Language Specific

9.1. Basic Lisp

9.1.1. paredit

(eval-when-compile
  (el-clone :repo "emacsmirror/paredit"))

(with-delayed-execution
  (message "Install paredit...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/paredit"))

  (autoload-if-found '(enable-paredit-mode
                       paredit-forward-slurp-sexp
                       paredit-splice-sexp
                       paredit-define-keys)
                     "paredit" nil t)

  (global-set-key (kbd "C-c f") #'paredit-forward-slurp-sexp)
  (global-set-key (kbd "M-s") #'paredit-splice-sexp)

  (with-eval-after-load 'paredit
    (add-hook 'paredit-mode-hook #'paredit-define-keys))

  (with-eval-after-load 'lisp-mode
    (add-hook 'lisp-mode-hook #'enable-paredit-mode)
    (add-hook 'lisp-data-mode-hook #'enable-paredit-mode))

  (with-eval-after-load 'emacs-lisp-mode
    (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode))

  (with-eval-after-load 'clojure-mode
    (add-hook 'clojure-mode-hook #'enable-paredit-mode))

  (with-eval-after-load 'lisp-interaction-mode
    (add-hook 'lisp-interacton-mode-hook #'enable-paredit-mode))

  (with-eval-after-load 'scheme
    (add-hook 'scheme-mode-hook #'enable-paredit-mode))

  (with-eval-after-load 'simple
    (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))

  (with-eval-after-load 'ielm
    (add-hook 'inferior-emacs-lisp-mode-hook #'enable-paredit-mode)))

9.1.2. rainbow-delimiter

(eval-when-compile
  (el-clone :repo "Fanael/rainbow-delimiters"))

(with-delayed-execution
  (message "Install rainbow-delimiters...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/rainbow-delimiters"))

  (autoload-if-found '(rainbow-delimiters-mode-enable) "rainbow-delimiters" nil t)

  (with-eval-after-load 'lisp-mode
    (add-hook 'lisp-mode-hook #'rainbow-delimiters-mode-enable))

  (with-eval-after-load 'emacs-lisp-mode
    (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode-enable))

  (with-eval-after-load 'clojure-mode
    (add-hook 'clojure-mode-hook #'rainbow-delimiters-mode-enable))

  (with-eval-after-load 'scheme
    (add-hook 'scheme-mode-hook #'rainbow-delimiters-mode-enable)))

9.2. Common Lisp

9.2.1. slime

(eval-when-compile
  (el-clone :repo "slime/slime"
            :load-paths `(,(locate-user-emacs-file "el-clone/slime/lib")
                          ,(locate-user-emacs-file "el-clone/slime/contrib")
                          ,(locate-user-emacs-file "el-clone/slime/swank"))))

(with-delayed-execution
  (message "Install slime...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/slime"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/slime/lib"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/slime/contrib"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/slime/swank"))

  (require 'slime)
  (slime-setup '(slime-repl slime-fancy slime-banner slime-indentation))

  (when-darwin
   (defun my/roswell-configdir ()
     (substring (shell-command-to-string "ros roswell-internal-use version confdir") 0 -1))

   (defun my/roswell-opt (var)
     (with-temp-buffer
       (insert-file-contents (concat (my/roswell-configdir) "config"))
       (goto-char (point-min))
       (re-search-forward (concat "^" var "\t[^\t]+\t\\(.*\\)$"))
       (match-string 1)))

   (defun my/roswell-directory (type)
     (concat
      (my/roswell-configdir)
      "lisp/"
      type
      "/"
      (my/roswell-opt (concat type ".version"))
      "/"))

   (with-eval-after-load 'slime
     (setq slime-path `,(expand-file-name "swank-loader.lisp" (my/roswell-directory "slime")))
     (setq slime-backend `,(expand-file-name "swank-loader.lisp" (my/roswell-directory "slime")))
     (setq inferior-lisp-program "ros -Q run")))

  (when-guix
   (with-eval-after-load 'slime
     (setq inferior-lisp-program "sbcl")))

  (defun my/slime-history ()
    (interactive)
    (if (and (fboundp '-distinct)
             (fboundp 'f-read-text))
        (insert
         (completing-read
          "choice history: "
          (-distinct (read (f-read-text "~/.slime-history.eld")))))))

  (with-eval-after-load 'slime-repl
    (define-key slime-repl-mode-map (kbd "C-c C-r") #'my/slime-history)))

9.2.2. hyperspec

(with-delayed-execution
  (message "Install hyperspec...")
  (autoload-if-found '(hyperspec-lookup) "hyperspec" nil t)

  (defadvice common-lisp-hyperspec (around common-lisp-hyperspec-around activate)
    (let ((buf (current-buffer)))
      ad-do-it
      (switch-to-buffer buf)
      (pop-to-buffer "*eww*")))

  (defadvice common-lisp-hyperspec-lookup-reader-macro (around common-lisp-hyperspec-lookup-reader-macro-around activate)
    (let ((buf (current-buffer)))
      ad-do-it
      (switch-to-buffer buf)
      (pop-to-buffer "*eww*")))

  (defadvice common-lisp-hyperspec-format (around common-lisp-hyperspec-format activate)
    (let ((buf (current-buffer)))
      ad-do-it
      (switch-to-buffer buf)
      (pop-to-buffer "*eww*")))

  (with-eval-after-load 'hyperspec
    (setq common-lisp-hyperspec--reader-macros nil)
    (setq common-lisp-hyperspec--format-characters nil))

  (with-eval-after-load 'lisp-mode
    (define-key lisp-mode-map (kbd "C-c h") #'hyperspec-lookup)))

9.3. Emacs Lisp

9.3.1. eros

(eval-when-compile
  (el-clone :repo "xiongtx/eros"))

(with-delayed-execution
  (message "Install eros...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eros"))

  (autoload-if-found '(eros-mode) "eros" nil t)

  (with-eval-after-load 'emacs-lisp
    (add-hook 'emacs-lisp-mode-hook #'eros-mode)))

9.3.2. eldoc

(with-delayed-execution
  (message "Install eldoc...")
  (autoload-if-found '(turn-on-eldoc-mode) "eldoc" nil t)

  (with-eval-after-load 'elisp-mode
    (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode)
    (add-hook 'lisp-interaction-mode-hook #'turn-on-eldoc-mode))

  (with-eval-after-load 'ielm
    (add-hook 'ielm-mode-hook #'turn-on-eldoc-mode)))

9.3.3. trinary

(eval-when-compile
  (el-clone :repo "emacs-elsa/trinary-logic"))

(with-delayed-execution
  (message "Install trinary...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/trinary-logic")))

9.3.4. elsa

(eval-when-compile
  (el-clone :repo "emacs-elsa/Elsa"))

(with-delayed-execution
  (message "Install elsa...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/Elsa"))
  (autoload-if-found '(elsa-run) "elsa" nil t))

9.3.5. lispxmp

(eval-when-compile
  (el-clone :repo "emacsmirror/lispxmp"))

(with-delayed-execution
  (message "Install lispxmp...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/lispxmp"))

  (autoload-if-found '(lispxmp) "lispxmp" nil t))

9.3.6. macrostep

(eval-when-compile
  (el-clone :repo "joddie/macrostep"))

(with-delayed-execution
  (message "Install macrostep...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/macrostep"))

  (autoload-if-found '(macrostep-expand macrostep-mode) "macrostep" nil t)

  (with-eval-after-load 'elisp-mode
    (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)))

9.3.7. elisp-slime-nav

(eval-when-compile
  (el-clone :repo "purcell/elisp-slime-nav"))

(with-delayed-execution
  (message "Install eslisp-slime-nav...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elisp-slime-nav"))

  (autoload-if-found '(elisp-slime-nav-mode) "elisp-slime-nav" nil t)

  (with-eval-after-load 'elisp-mode
    (add-hook 'emacs-lisp-mode-hook #'elisp-slime-nav-mode))

  (with-eval-after-load 'ielm
    (add-hook 'ielm-mode-hook #'elisp-slime-nav-mode)))

9.3.8. nameless

(eval-when-compile
  (el-clone :repo "Malabarba/Nameless"))

(with-delayed-execution
  (message "Install nameless...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/Nameless"))

  (autoload-if-found '(nameless-mode) "nameless" nil t)

  (with-eval-after-load 'elisp-mode
    (add-hook 'emacs-lisp-mode-hook #'nameless-mode))

  (with-eval-after-load 'ielm
    (add-hook 'ielm-mode-hook #'nameless-mode)))

9.3.9. elisp-refs

(eval-when-compile
  (el-clone :repo "Wilfred/elisp-refs"))

(with-delayed-execution
  (message "Install elisp-refs...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elisp-refs"))

  (autoload-if-found '(elisp-refs-function
                       elisp-refs-macro
                       elisp-refs-variable
                       elisp-refs-special
                       elisp-refs-symbol) "elisp-refs" nil t))

9.3.10. highlight-quoted

(eval-when-compile
  (el-clone :repo "Fanael/highlight-quoted"))

(with-delayed-execution
  (message "Install highlight-quoted...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/highlight-quoted"))

  (autoload-if-found '(highlight-quoted-mode) "highlight-quoted" nil t)

  (with-eval-after-load 'elisp-mode
    (add-hook 'emacs-lisp-mode-hook #'highlight-quoted-mode)))

9.3.11. highlight-defined

(eval-when-compile
  (el-clone :repo "Fanael/highlight-defined"))

(with-delayed-execution
  (message "Install highlight-defined...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/highlight-defined"))
  (autoload-if-found '(highlight-defined-mode) "highlight-defined" nil t)

  (with-eval-after-load 'elisp-mode
    (add-hook 'emacs-lisp-mode-hook #'highlight-defined-mode)))

9.3.12. my/ielm-history

(with-delayed-execution
  (when (autoload-if-found '(my/ielm-history) "ielm" nil t))
  (defun my/ielm-history ()
    (interactive)
    (insert
     (completing-read
      "choice history: "
      (progn
        (let ((history nil)
              (comint-input-ring nil))
          (dotimes (index (ring-length comint-input-ring))
            (push (ring-ref comint-input-ring index) history))
          history))))))

9.4. Clojure

9.4.1. anakondo

(eval-when-compile
  (el-clone :repo "didibus/anakondo"))

(with-delayed-execution
  (message "Install anakondo...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/anakondo"))

  (autoload-if-found '(anakondo-minor-mode) "anakondo" nil t)
  ;; (with-eval-after-load 'clojure-mode
  ;;   (add-hook 'clojure-mode-hook #'anakondo-minor-mode)
  ;;   (add-hook 'clojurescript-mode-hook #'anakondo-minor-mode)
  ;;   (add-hook 'clojurec-mode-hook #'anakondo-minor-mode))
  )

9.4.2. cider

(eval-when-compile
  (el-clone :repo "clojure-emacs/parseclj")
  (el-clone :repo "clojure-emacs/parseedn")
  (el-clone :repo "clojure-emacs/cider"))

(with-delayed-execution
  (message "Install cider...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/parseclj"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/parseedn"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/cider"))

  (autoload-if-found '(cider cider-format-buffer cider-switch-to-last-clojure-buffer) "cider" nil t)
  (autoload-if-found '(cider-doc) "cider-doc" nil t)

  ;; (add-hook 'before-save-hook #'cider-format-buffer t t)

  (with-eval-after-load 'cider-common
    (setq cider-special-mode-truncate-lines nil))

  (with-eval-after-load 'cider-mode
    (setq cider-font-lock-reader-conditionals nil)
    (setq cider-font-lock-dynamically '(macro core function var)))

  (with-eval-after-load 'cider-repl
    (setq cider-repl-buffer-size-limit 1000000)
    (setq cider-repl-wrap-history t)
    (setq cider-repl-history-size 10000)
    (setq cider-repl-tab-command #'indent-for-tab-command)
    (setq cider-repl-display-in-current-window t))

  (with-eval-after-load 'nrepl-client
    (setq nrepl-use-ssh-fallback-for-remote-hosts t)
    (setq nrepl-hide-special-buffers t))

  (with-eval-after-load 'cider-eval
    (setq cider-show-error-buffer nil)
    (setq cider-auto-select-error-buffer nil))

  (with-eval-after-load 'clojure-mode
    (define-key clojure-mode-map (kbd "C-c h") #'cider-doc)))

9.4.3. kibit-helper

(eval-when-compile
  (el-clone :repo "brunchboy/kibit-helper"))

(with-delayed-execution
  (message "Install kibit-helper...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/kibit-helper"))

  (autoload-if-found '(kibit kibit-current-file kibit-accept-proposed-change) "kibit-helper" nil t))

9.4.4. clj-refactor

(eval-when-compile
  (el-clone :repo "clojure-emacs/clj-refactor.el"))

(with-delayed-execution
  (message "Install clj-refactor...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/clj-refactor"))

  ;; (autoload-if-found '(clj-refactor-mode cljr-add-keybindings-with-prefix) "clj-refactor" nil t)

  ;; (add-hook 'clojure-mode-hook #'clj-refactor-mode)
  ;; (cljr-add-keybindings-with-prefix "C-c C-m")

  ;; (with-eval-after-load 'clj-refactor
  ;;   (setq cljr-suppress-middleware-warnings t)
  ;;   (setq cljr-hotload-dependencies t))
  )

9.4.5. inf-clojure

(eval-when-compile
  (el-clone :repo "clojure-emacs/inf-clojure"))

(with-delayed-execution
  (message "Install inf-clojure...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/inf-clojure"))

  (autoload-if-found '(inf-clojure) "inf-clojure" nil t))

9.5. C/C++

9.5.1. clang-format

(eval-when-compile
  (el-clone :repo "emacsmirror/clang-format"))

(with-delayed-execution
  (message "Install clang-format...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/clang-format"))

  (autoload-if-found '(clang-format-buffer) "clang-format" nil t)

  (add-hook 'before-save-hook #'(lambda ()
                                  (when (member major-mode '(c-mode c++-mode))
                                    (clang-format-buffer)))))

9.5.2. inferior-cling

(eval-when-compile
  (el-clone :repo "brianqq/inferior-cling"))

(with-delayed-execution
  (message "Install inferior-cling...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/inferior-cling")))

9.6. Csv

9.6.1. rainbow-csv

(eval-when-compile
  (el-clone :repo "emacs-vs/rainbow-csv"))

(with-delayed-execution
  (message "Install rainbow-csv...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/rainbow-csv"))

  (autoload-if-found '(rainbow-csv-mode) "rainbow-csv" nil t)

  (with-eval-after-load 'csv-mode
    (add-hook 'csv-mode-hook #'rainbow-csv-mode)))

9.7. JavaScript/TypeScript

9.7.1. js2-refactor

(eval-when-compile
  (el-clone :repo "js-emacs/js2-refactor.el"))

(with-delayed-execution
  (message "Install js2-refactor...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/js2-refactor"))

  (autoload-if-found '(js2-refactor-mode) "js2-refactor" nil t)

  (with-eval-after-load 'js2-refactor
    (setq js2r-use-strict t))

  (with-eval-after-load 'js2-mode
    (add-hook 'js2-mode-hook #'js2-refactor-mode))

  (with-eval-after-load 'typescript-mode
    (add-hook 'typescript-mode-hook #'js2-refactor-mode)))

9.7.2. TODO tree-sitter

(eval-when-compile
  (el-clone :repo "emacs-tree-sitter/elisp-tree-sitter")
  (el-clone :repo "emacs-tree-sitter/tree-sitter-langs"))

;; (with-delayed-execution
;;   (message "Install tree-sitter...")
;;   (add-to-list 'load-path (locate-user-emacs-file "el-clone/elisp-tree-sitter/core"))
;;   (add-to-list 'load-path (locate-user-emacs-file "el-clone/elisp-tree-sitter/lisp"))
;;   (add-to-list 'load-path (locate-user-emacs-file "el-clone/tree-sitter-langs"))

;;   (autoload-if-found '(tree-sitter-mode) "tree-sitter" nil t)
;;   (autoload-if-found '(tree-sitter-require) "tree-sitter-load" nil t)
;;   (autoload-if-found '(tree-sitter-hl-mode tree-sitter-hl-add-patterns) "tree-sitter-hl" nil t)

;;   (when (require 'tree-sitter-langs)
;;     (tree-sitter-require 'tsx))

;;   (tree-sitter-hl-add-patterns 'tsx
;;     [(call_expression
;;       ;; styled.div``
;;       function: (member_expression
;;                  object: (identifier) @function.call
;;                  (.eq? @function.call "styled"))
;;       arguments: ((template_string) @property.definition
;;                   (.offset! @property.definition 0 1 0 -1)))
;;      (call_expression
;;       ;; styled(Component)``
;;       function: (call_expression
;;                  function: (identifier) @function.call
;;                  (.eq? @function.call "styled"))
;;       arguments: ((template_string) @property.definition
;;                   (.offset! @property.definition 0 1 0 -1)))])

;;   (add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))

;;   (with-eval-after-load 'typescript-mode
;;     (add-hook 'typescript-tsx-mode-hook #'tree-sitter-mode))

;;   (with-eval-after-load 'tree-sitter
;;     (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)))

9.8. Ruby

9.8.1. robe

(eval-when-compile
  (el-clone :repo "dgutov/robe"))

(with-delayed-execution
  (message "Install robe...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/robe"))

  (autoload-if-found '(robe-mode inf-ruby-console-auto) "robe" nil t))

9.8.2. rubocop

(eval-when-compile
  (el-clone :repo "takeokunn/rubocop-emacs"))

(with-delayed-execution
  (message "Install rubocop...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/rubocop-emacs"))

  (autoload-if-found '(rubocop-mode) "rubocop" nil t)

  (with-eval-after-load 'ruby-mode
    ;; hook
    (add-hook 'ruby-mode-hook #'rubocop-mode)))

9.8.3. ruby-refactor

(eval-when-compile
  (el-clone :repo "ajvargo/ruby-refactor"))

(with-delayed-execution
  (message "Install ruby-refactor...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ruby-refactor"))

  (autoload-if-found '(ruby-refactor-mode-launch) "ruby-refactor" nil t)

  (with-eval-after-load 'ruby-mode
    (add-hook 'ruby-mode-hook #'ruby-refactor-mode-launch)))

9.8.4. inf-ruby

(eval-when-compile
  (el-clone :repo "nonsequitur/inf-ruby"))

(with-delayed-execution
  (message "Install inf-ruby...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/inf-ruby"))

  (autoload-if-found '(inf-ruby inf-ruby-minor-mode) "inf-ruby" nil t)

  (defun my/irb-history ()
    (interactive)
    (when (and (fboundp '-distinct)
               (fboundp 's-lines)
               (fboundp 'f-read-text))
      (insert
       (completing-read
        "choose history: "
        (mapcar #'list (-distinct (s-lines (f-read-text "~/.irb_history"))))))))

  (with-eval-after-load 'ruby-mode
    (add-hook 'ruby-mode-hook #'inf-ruby-minor-mode)))

9.8.5. yard-mode

(eval-when-compile
  (el-clone :repo "pd/yard-mode.el"))

(with-delayed-execution
  (message "Install yard-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/yard-mode"))

  (autoload-if-found '(yard-mode) "yard-mode" nil t)

  (with-eval-after-load 'ruby-mode
    (add-hook 'ruby-mode-hook #'yard-mode)))

9.9. SQL

9.9.1. sql-indent

(eval-when-compile
  (el-clone :repo "alex-hhh/emacs-sql-indent"))

(with-delayed-execution
  (message "Install sql-indent...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-sql-indent"))

  (autoload-if-found '(sqlind-setup sqlind-minor-mode) "sql-indent" nil t)

  (with-eval-after-load 'sql
    (add-hook 'sql-mode-hook #'sqlind-setup)
    (add-hook 'sql-mode-hook #'sqlind-minor-mode)))

9.10. PHP

9.10.1. composer

(eval-when-compile
  (el-clone :repo "emacs-php/composer.el"))

(with-delayed-execution
  (message "Install composer...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/composer")))

9.10.2. php-runtime

(eval-when-compile
  (el-clone :repo "emacs-php/php-runtime.el"))

(with-delayed-execution
  (message "Install php-runtime...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/php-runtime"))

  (autoload-if-found '(php-runtime-expr php-runtime-eval) "php-runtime" nil t))

9.10.3. psysh

(eval-when-compile
  (el-clone :repo "emacs-php/psysh.el"))

(with-delayed-execution
  (message "Install psysh...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/psysh"))

  (autoload-if-found '(psysh psysh-doc) "psysh" nil t)

  (with-eval-after-load 'php-mode
    (define-key php-mode-map (kbd "C-c h") #'psysh-doc)))

9.10.4. laravel-tinker-repl

(eval-when-compile
  (el-clone :repo "takeokunn/laravel-tinker-repl.el"))

(with-delayed-execution
  (message "Install laravel-tinker-repl...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/laravel-tinker-repl"))

  (autoload-if-found '(laravel-tinker-repl) "laravel-tinker-repl" nil t)

  (with-eval-after-load 'php-mode
    (define-key php-mode-map (kbd "C-c C-c") #'laravel-tinker-repl-send-line)
    (define-key php-mode-map (kbd "C-c C-z") #'laravel-tinker-repl-switch-to-repl)))

9.10.5. emacs-php-doc-block

(eval-when-compile
  (el-clone :repo "moskalyovd/emacs-php-doc-block"))

(with-delayed-execution
  (message "Install emacs-php-doc-block...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-php-doc-block"))

  (autoload-if-found '(php-doc-block) "php-doc-block" nil t))

9.10.6. phpstan

(eval-when-compile
  (el-clone :repo "emacs-php/phpstan.el"))

(with-delayed-execution
  (message "Install phpstan...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/phpstan"))

  (autoload-if-found '(phpstan-analyze-file phpstan-analyze-this-file) "phpstan" nil t)

  (defun my/flycheck-phpstan-setup ()
    "Setup Flycheck with PHPStan."
    (require 'flycheck-phpstan))

  (with-eval-after-load 'php-mode
    (add-hook 'php-mode-hook #'my/flycheck-phpstan-setup))

  (with-eval-after-load 'php-ts-mode
    (add-hook 'php-ts-mode-hook #'my/flycheck-phpstan-setup))

  (with-eval-after-load 'phpstan
    (setq phpstan-memory-limit "4G")))

9.10.7. phpunit

(eval-when-compile
  (el-clone :repo "nlamirault/phpunit.el"))

(with-delayed-execution
  (message "Install phpunit...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/phpunit"))

  (autoload-if-found '(phpunit-current-test
                       phpunit-current-class
                       phpunit-current-project
                       phpunit-group) "phpunit" nil t))

9.10.8. phpactor

(eval-when-compile
  (el-clone :repo "emacs-php/phpactor.el"))

(with-delayed-execution
  (message "Install phpactor...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/phpactor"))

  (autoload-if-found '(phpactor-install-or-update) "phpactor" nil t))

9.11. Markdown

9.11.1. poly-markdown

(eval-when-compile
  (el-clone :repo "polymode/polymode")
  (el-clone :repo "polymode/poly-markdown"))

(with-delayed-execution
  (message "Install polymode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/polymode"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/poly-markdown"))

  (when (autoload-if-found '(poly-markdown-mode) "poly-markdown" nil t)
    (add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))))

9.11.2. markdown-preview-mode

(eval-when-compile
  (el-clone :repo "ancane/markdown-preview-mode"))

(with-delayed-execution
  (message "Install markdown-preview-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/markdown-preview-mode"))

  (autoload-if-found '(markdown-preview-open-browser markdown-preview-mode) "markdown-preview-mode" nil t)

  (with-eval-after-load 'markdown-preview-mode
    (setq markdown-preview-stylesheets (list "http://thomasf.github.io/solarized-css/solarized-light.min.css"))))

9.12. Fish

9.12.1. fish-repl

(eval-when-compile
  (el-clone :repo "takeokunn/fish-repl.el"))

(with-delayed-execution
  (message "Install fish-repl...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/fish-repl"))

  (autoload-if-found '(fish-repl) "fish-repl" nil t))

9.13. NodeJS

9.13.1. nodejs-repl

(eval-when-compile
  (el-clone :repo "abicky/nodejs-repl.el"))

(with-delayed-execution
  (message "Install nodejs-repl...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/nodejs-repl"))

  (autoload-if-found '(nodejs-repl
                       nodejs-repl-send-last-expression
                       nodejs-repl-send-line
                       nodejs-repl-send-region
                       nodejs-repl-send-buffer
                       nodejs-repl-load-file
                       nodejs-repl-switch-to-repl) "nodejs-repl" nil t)

  (with-eval-after-load 'js2-mode
    (define-key js2-mode-map (kbd "C-x C-e") #'nodejs-repl-send-last-expression)
    (define-key js2-mode-map (kbd "C-c C-j") #'nodejs-repl-send-line)
    (define-key js2-mode-map (kbd "C-c C-r") #'nodejs-repl-send-region)
    (define-key js2-mode-map (kbd "C-c C-c") #'nodejs-repl-send-buffer)
    (define-key js2-mode-map (kbd "C-c C-l") #'nodejs-repl-load-file)
    (define-key js2-mode-map (kbd "C-c C-z") #'nodejs-repl-switch-to-repl)))

9.13.2. jest

(eval-when-compile
  (el-clone :repo "edmundmiller/emacs-jest"))

(with-delayed-execution
  (message "Install jest...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-jest"))

  (autoload-if-found '(jest-minor-mode) "jest" nil t)

  (with-eval-after-load 'js2-mode
    (add-hook 'js2-mode-hook #'jest-minor-mode)))

9.14. Haskell

9.14.1. hindent

(eval-when-compile
  (el-clone :repo "mihaimaruseac/hindent"))

(with-delayed-execution
  (message "Install hindent...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/hindent"))

  (autoload-if-found '(hindent-mode) "hindent" nil t)

  (with-eval-after-load 'haskell-mode
    (add-hook 'haskell-mode-hook #'hindent-mode)))

9.15. Web

9.15.1. emmet-mode

(eval-when-compile
  (el-clone :repo "smihica/emmet-mode"))

(with-delayed-execution
  (message "Install emmet-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emmet-mode"))

  (autoload-if-found '(emmet-mode) "emmet-mode" nil t)

  (with-eval-after-load 'html-mode
    (add-hook 'html-mode-hook #'emmet-mode))

  (with-eval-after-load 'web-mode
    (add-hook 'web-mode-hook #'emmet-mode))

  (with-eval-after-load 'css-mode
    (add-hook 'css-mode-hook #'emmet-mode))

  (with-eval-after-load 'nxml-mode
    (add-hook 'nxml-mode-hook #'emmet-mode))

  (with-eval-after-load 'web-php-blade-mode
    (add-hook 'web-php-blade-mode #'emmet-mode))

  (with-eval-after-load 'typescript-mode
    (add-hook 'typescript-tsx-mode-hook #'emmet-mode))

  (with-eval-after-load 'vue-mode
    (add-hook 'vue-mode-hook #'emmet-mode))

  (with-eval-after-load 'emmet-mode
    (define-key emmet-mode-keymap (kbd "C-j") nil)
    (define-key emmet-mode-keymap (kbd "M-j") #'emmet-expand-line)
    (setq emmet-self-closing-tag-style "")
    (setq emmet-indent-after-insert nil)))

9.16. JSON

9.16.1. jq-mode

(eval-when-compile
  (el-clone :repo "ljos/jq-mode"))

(with-delayed-execution
  (message "Install jq-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/jq-mode"))

  (autoload-if-found '(jq-interactively) "jq-mode" nil t)

  (with-eval-after-load 'json-mode
    (define-key json-mode-map (kbd "C-c C-j") #'jq-interactively)))

9.16.2. json-reformat

(eval-when-compile
  (el-clone :repo "gongo/json-reformat"))

(with-delayed-execution
  (message "Install json-reformat...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/json-reformat"))

  (autoload-if-found '(json-reformat-region) "json-reformat" nil t))

9.17. Python

9.17.1. py-isort

(eval-when-compile
  (el-clone :repo "paetzke/py-isort.el"))

(with-delayed-execution
  (message "Install py-isort...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/py-isort"))

  (autoload-if-found '(py-isort-region
                       py-isort-buffer
                       py-isort-before-save) "py-isort" nil t))

10. Elfeed

10.1. elfeed

(eval-when-compile
  (el-clone :repo "skeeto/elfeed"))

(with-delayed-execution
  (message "Install elfeed...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elfeed"))

  (autoload-if-found '(elfeed) "elfeed" nil t)

  (with-eval-after-load 'elfeed-show
    (setq elfeed-show-entry-switch #'display-buffer))

  (with-eval-after-load 'elfeed-db
    (setq elfeed-db-directory "~/.cache/elfeed"))

  (with-eval-after-load 'elfeed-search
    (setq elfeed-search-filter "@2-week-ago"))

  (with-eval-after-load 'elfeed-curl
    (setq elfeed-curl-max-connections 32)))

10.2. elfeed-org

(eval-when-compile
  (el-clone :repo "remyhonig/elfeed-org"))

(with-delayed-execution
  (message "Install elfeed-org...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elfeed-org"))

  (autoload-if-found '(elfeed-org) "elfeed-org" nil t)
  (elfeed-org)

  (with-eval-after-load 'elfeed-org
    (setq rmh-elfeed-org-files '("~/.ghq/github.com/takeokunn/private/elfeed.org"))
    (setq rmh-elfeed-org-auto-ignore-invalid-feeds t)))

10.3. elfeed-dashboard

(eval-when-compile
  (el-clone :repo "manojm321/elfeed-dashboard"))

(with-delayed-execution
  (message "Install elfeed-dashboard...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elfeed-dashboard"))

  (autoload-if-found '(elfeed-dashboard) "elfeed-dashboard" nil t)

  (global-set-key (kbd "C-x w") #'elfeed-dashboard)

  (with-eval-after-load 'elfeed-dashboard
    (setq elfeed-dashboard-file (locate-user-emacs-file "elfeed-dashboard.org"))))

10.4. elfeed-goodies

(eval-when-compile
  (el-clone :repo "jeetelongname/elfeed-goodies"))

(with-delayed-execution
  (message "Install elfeed-goodies...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/elfeed-goodies"))
  (autoload-if-found '(elfeed-goodies/setup) "elfeed-goodies" nil t)

  (with-eval-after-load 'elfeed-dashboard
    (add-hook 'elfeed-dashboard-mode-hook #'elfeed-goodies/setup))

  (with-eval-after-load 'elfeed-goodies
    (setq elfeed-goodies/entry-pane-size 0.6)))

11. Eshell

11.1. basic

(with-delayed-execution
  (message "Install eshell...")

  ;; configurations
  (with-eval-after-load 'esh-mode
    ;; hook
    (add-hook 'eshell-mode-hook #'(lambda () (display-line-numbers-mode -1)))

    ;; keymap
    (define-key eshell-mode-map (kbd "C-h") #'delete-backward-char)
    (define-key eshell-mode-map (kbd "M-p") #'eshell-previous-matching-input-from-input))

  (with-eval-after-load 'em-cmpl
    (setq eshell-cmpl-ignore-case t))

  (with-eval-after-load 'em-glob
    (setq eshell-glob-include-dot-files t)
    (setq eshell-glob-include-dot-dot nil)
    (setq eshell-glob-show-progress t))

  (with-eval-after-load 'em-hist
    (setq eshell-history-size 100000)
    (setq eshell-hist-ignoredups t))

  (with-eval-after-load 'em-alias
    (setq eshell-command-aliases-list '(("ll" "ls -la"))))

  (with-eval-after-load 'esh-cmd
    (setq eshell-prefer-lisp-functions nil))

  (with-eval-after-load 'em-term
    (setq eshell-destroy-buffer-when-process-dies t)))

11.2. functions

(with-delayed-execution
  (message "Install eshell functions...")

  (defun eshell/ff (&rest args)
    "Open a file in Emacs with ARGS, Some habits die hard."
    (if (null args)
        (bury-buffer)
      (mapc #'find-file (mapcar #'expand-file-name (eshell-flatten-list (reverse args))))))

  (defun eshell/unpack (file &rest args)
    "Unpack FILE with ARGS."
    (let ((command (some (lambda (x)
                           (if (string-match-p (car x) file)
                               (cadr x)))
                         '((".*\.tar.bz2" "tar xjf")
                           (".*\.tar.gz" "tar xzf")
                           (".*\.bz2" "bunzip2")
                           (".*\.rar" "unrar x")
                           (".*\.gz" "gunzip")
                           (".*\.tar" "tar xf")
                           (".*\.tbz2" "tar xjf")
                           (".*\.tgz" "tar xzf")
                           (".*\.zip" "unzip")
                           (".*\.Z" "uncompress")
                           (".*" "echo 'Could not unpack the file:'")))))
      (let ((unpack-command(concat command " " file " " (mapconcat 'identity args " "))))
        (eshell/printnl "Unpack command: " unpack-command)
        (eshell-command-result unpack-command))))

  (defun my/cat-with-syntax-highlight (filename)
    "Like cat(1) but with syntax highlighting."
    (let ((existing-buffer (get-file-buffer filename))
          (buffer (find-file-noselect filename)))
      (eshell-print
       (with-current-buffer buffer
         (if (fboundp 'font-lock-ensure)
             (font-lock-ensure)
           (with-no-warnings
             (font-lock-fontify-buffer)))
         (let ((contents (buffer-string)))
           (remove-text-properties 0 (length contents) '(read-only nil) contents)
           contents)))
      (unless existing-buffer
        (kill-buffer buffer))
      nil))

  (advice-add 'eshell/cat :override #'my/cat-with-syntax-highlight))

11.3. prompt

(with-delayed-execution
  (message "Install eshell prompt...")

  (defun my/eshell-prompt ()
    (concat (abbreviate-file-name (eshell/pwd))
            (if (= (user-uid) 0) " # " " $ ")))

  (with-eval-after-load 'em-prompt
    (setq eshell-prompt-function #'my/eshell-prompt)))

11.4. eshell-fringe-status

(eval-when-compile
  (el-clone :repo "ryuslash/eshell-fringe-status"))

(with-delayed-execution
  (message "Install eshell-fringe-status...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eshell-fringe-status"))

  (autoload-if-found '(eshell-fringe-status-mode) "eshell-fringe-status" nil t)

  (with-eval-after-load 'esh-mode
    (add-hook 'eshell-mode-hook #'eshell-fringe-status-mode)))

11.5. esh-help

(eval-when-compile
  (el-clone :repo "tom-tan/esh-help"))

(with-delayed-execution
  (message "Install esh-help...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/esh-help"))

  (autoload-if-found '(setup-esh-help-eldoc) "esh-help" nil t)

  (setup-esh-help-eldoc))

11.6. eshell-multiple

(eval-when-compile
  (el-clone :repo "takeokunn/eshell-multiple"))

(with-delayed-execution
  (message "Install eshell-multiple...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eshell-multiple"))

  (autoload-if-found '(eshell-multiple-new
                       eshell-multiple-next
                       eshell-multiple-prev
                       eshell-multiple-clear-buffer
                       eshell-multiple-switch-buffer
                       eshell-multiple-dedicated-toggle
                       eshell-multiple-dedicated-open
                       eshell-multiple-dedicated-close)
                     "eshell-multiple" nil t)

  (defalias 'eshell/new #'eshell-multiple-new)
  (defalias 'eshell/next #'eshell-multiple-next)
  (defalias 'eshell/prev #'eshell-multiple-prev)
  (defalias 'eshell/clear #'eshell-multiple-clear-buffer)

  (with-eval-after-load 'esh-mode
    (define-key eshell-mode-map (kbd "C-l") #'eshell-multiple-clear-buffer)))

11.7. eshell-z

(eval-when-compile
  (el-clone :repo "xuchunyang/eshell-z"))

(with-delayed-execution
  (message "Install eshell-z...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eshell-z"))

  (autoload-if-found '(eshell-z) "eshell-z" nil t)

  (with-eval-after-load 'esh-mode
    (define-key eshell-mode-map (kbd "C-c C-q") #'eshell-z)))

11.8. eshell-did-you-mean

(eval-when-compile
  (el-clone :repo "xuchunyang/eshell-did-you-mean"))

(with-delayed-execution
  (message "Install eshell-did-you-mean...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eshell-did-you-mean"))

  (autoload-if-found '(eshell-did-you-mean-setup) "eshell-did-you-mean" nil t)

  (with-eval-after-load 'esh-mode
    (add-hook 'eshell-mode-hook #'eshell-did-you-mean-setup)))

11.9. eshell-syntax-highlight

(eval-when-compile
  (el-clone :repo "akreisher/eshell-syntax-highlighting"))

(with-delayed-execution
  (message "Install eshell-syntax-highlighting...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/eshell-syntax-highlighting"))

  (autoload-if-found '(eshell-syntax-highlighting-global-mode) "eshell-syntax-highlighting" nil t)

  (eshell-syntax-highlighting-global-mode))

11.10. emacs-fish-completion

(eval-when-compile
  (el-clone :repo "Ambrevar/emacs-fish-completion"))

(with-delayed-execution
  (message "Install emacs-fish-completion")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-fish-completion"))

  (autoload-if-found '(global-fish-completion-mode) "fish-completion" nil t)

  (when (executable-find "fish")
    (global-fish-completion-mode)))

11.11. eat

(eval-when-compile
  (el-clone :url "https://codeberg.org/akib/emacs-eat.git"
            :repo "emacs-eat"))

(with-delayed-execution
  (message "Install emacs-eat...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/emacs-eat"))
  (autoload-if-found '(eat) "eat" nil t))

12. Org Mode

12.1. Basic

12.1.1. org

(with-eval-after-load 'org
  ;; keybind
  (define-key org-mode-map (kbd "C-c ,") #'org-insert-structure-template)
  (define-key org-mode-map (kbd "C-c C-,") #'org-insert-structure-template)

  ;; directory
  (setq org-directory "~/.ghq/github.com/takeokunn/private")

  ;; todo
  (setq org-todo-keywords '((sequence "TODO(t)" "SOMEDAY(s)" "WAIT(w)" "|" "DONE(d)")))

  ;; startup
  (setq org-startup-folded 'show3levels)
  (setq org-startup-truncated nil)
  (setq org-src-window-setup 'current-window)

  ;; archive
  (advice-add 'org-archive-subtree :before #'(lambda (&rest _) (remove-hook 'find-file-hooks #'view-mode)))
  (advice-add 'org-archive-subtree :after #'(lambda (&rest _) (add-hook 'find-file-hooks #'view-mode)))

  (defvar my/org-agenda-files `(,(concat org-directory "/agenda")
                                ,(concat org-directory "/archive/2023")
                                ,(concat org-directory "/archive/2024")))

  (setq org-agenda-files my/org-agenda-files)
  (setq org-archive-location `,(format (expand-file-name "archive/%s/%s.org::* Archived Tasks" org-directory)
                                       (format-time-string "%Y" (current-time))
                                       (format-time-string "%Y-%m-%d" (current-time))))

  ;; log
  (setq org-log-into-drawer t)
  (setq org-log-done 'time)

  (defun my/update-org-agenda-files ()
    (interactive)
    (setq org-agenda-files my/org-agenda-files)))

12.1.2. org-clock

(with-eval-after-load 'org-clock
  (add-hook 'org-mode-hook #'org-clock-load)
  (add-hook 'kill-emacs-hook #'org-clock-save)

  (setq org-clock-out-remove-zero-time-clocks t)
  (setq org-clock-clocked-in-display 'mode-line))

12.1.3. org-list

(with-eval-after-load 'org-list
  (setq org-list-allow-alphabetical t))

12.1.4. org-keys

(with-eval-after-load 'org-keys
  (setq org-use-extra-keys t)
  (setq org-use-speed-commands t)

  (add-to-list 'org-speed-commands '("d" org-todo "DONE"))
  (add-to-list 'org-speed-commands '("j" call-interactively #'consult-org-heading)))

12.1.5. org-capture

(with-delayed-execution
  (autoload-if-found '(org-capture) "org-capture" nil t)
  (global-set-key (kbd "C-c c") #'org-capture)

  (advice-add 'org-capture :before #'(lambda (&rest _) (remove-hook 'find-file-hooks #'view-mode)))
  (advice-add 'org-capture :after #'(lambda (&rest _) (add-hook 'find-file-hooks #'view-mode)))

  (with-eval-after-load 'org-capture
    (setq org-capture-use-agenda-date t)
    (setq org-capture-bookmark nil)
    (setq org-capture-templates `(("t" "Todo" entry (file ,(expand-file-name "todo.org" org-directory))
                                   "* %?")
                                  ("m" "Memo" entry (file ,(expand-file-name "memo.org" org-directory))
                                   "* %?")
                                  ("j" "Journal" entry (file+olp+datetree ,(expand-file-name "journal.org" org-directory))
                                   "* %U\n%?\n%i\n")))))

12.1.6. org-duration

(with-eval-after-load 'org-duration
 (setq org-duration-format (quote h:mm)))

12.1.7. org-id

(with-delayed-execution
  (message "Install org-id...")

  (autoload-if-found '(org-id-store-link) "org-id" nil t)

  (with-eval-after-load 'org-id
    (setq org-id-locations-file (expand-file-name ".org-id-locations" org-directory))
    (setq org-id-extra-files (append org-agenda-text-search-extra-files))))

12.1.8. org-crypt

(with-delayed-execution
  (autoload-if-found '(org-encrypt-entry org-decrypt-entry org-crypt-use-before-save-magic) "org-crypt" nil t)

  (org-crypt-use-before-save-magic)

  (with-eval-after-load 'org-crypt
    (setq org-crypt-key nil)
    (setq org-tags-exclude-from-inheritance '("crypt"))))

12.1.9. org-table

(with-delayed-execution
  (autoload-if-found '(orgtbl-mode org-table-begin org-table-end) "org-table" nil t)

  (defun my/org-table-align-markdown ()
    "Replace \"+\" sign with \"|\" in org-table."
    (when (member major-mode '(markdown-mode))
      (save-excursion
        (save-restriction
          (narrow-to-region (org-table-begin) (org-table-end))
          (goto-char (point-min))
          (while (search-forward "-+-" nil t)
            (replace-match "-|-"))))))

  (advice-add 'org-table-align :before #'my/org-table-align-markdown))

12.1.10. org-journal

(eval-when-compile
  (el-clone :repo "bastibe/org-journal"))

(with-delayed-execution
  (message "Install org-journal...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-journal"))

  (with-eval-after-load 'org-journal
    (setq org-journal-dir (expand-file-name "journal" org-directory))
    (setq org-journal-start-on-weekday 7)
    (setq org-journal-prefix-key "C-c j")))

12.1.11. org-generate

(eval-when-compile
  (el-clone :repo "conao3/org-generate.el"))

(with-delayed-execution
  (message "Install org-generate...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-generate"))

  (autoload-if-found '(org-generate) "org-generate" nil t))

12.1.12. org-pomodoro

(eval-when-compile
  (el-clone :repo "marcinkoziej/org-pomodoro"))

(with-delayed-execution
  (message "Install org-pomodoro...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-pomodoro"))

  (autoload-if-found '(org-pomodoro) "org-pomodoro" nil t))

12.1.13. org-view-mode

(eval-when-compile
  (el-clone :repo "amno1/org-view-mode"))

(with-delayed-execution
  (message "Install org-view-mode...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-view-mode"))

  (autoload-if-found '(org-view-mode) "org-view-mode" nil t))

12.1.14. org-random-todo

(eval-when-compile
  (el-clone :repo "unhammer/org-random-todo"))

(with-delayed-execution
  (message "Install org-random-todo...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-random-todo"))

  (autoload-if-found '(org-random-todo org-random-todo-goto-current) "org-random-todo" nil t))

12.1.15. org-projectile

(eval-when-compile
  (el-clone :repo "IvanMalison/org-projectile"))

(with-delayed-execution
  (message "Install org-projectile...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-projectile"))

  (autoload-if-found '(org-projectile-todo-files
                       org-projectile-project-todo-completing-read)
                     "org-projectile" nil t)

  (global-set-key (kbd "C-c n p") #'org-projectile-project-todo-completing-read)

  (with-eval-after-load 'org
    (setq org-agenda-files (append org-agenda-files (org-projectile-todo-files)))))

12.1.16. org-dashboard

(eval-when-compile
  (el-clone :repo "bard/org-dashboard"))

(with-delayed-execution
  (message "Install org-dashboard...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-dashboard"))

  (autoload-if-found '(org-dashboard-display) "org-dashboard" nil t))

12.1.17. org-volume

(eval-when-compile
  (el-clone :repo "akirak/org-volume"))

(with-delayed-execution
  (message "Install org-volume...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-volume"))

  (autoload-if-found '(org-volume-update-entry-from-dblock) "org-volume" nil t))

12.1.18. org-ql

(eval-when-compile
  (el-clone :repo "alphapapa/org-ql"))

(with-delayed-execution
  (message "Install org-ql...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-ql"))
  (autoload-if-found '(org-ql-query org-ql-select) "org-ql" nil t))

12.2. Theme

12.2.1. org-faces

(with-eval-after-load 'org-faces
  (setq org-link '(t (:foreground "#ebe087" :underline t))))

12.2.2. org-superstar

(eval-when-compile
  (el-clone :repo "integral-dw/org-superstar-mode"))

(with-delayed-execution
  (message "Install org-superstar...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-superstar-mode"))

  (autoload-if-found '(org-superstar-mode) "org-superstar")

  (with-eval-after-load 'org
    (add-hook 'org-mode-hook #'org-superstar-mode))

  (with-eval-after-load 'org-superstar
    (setq org-superstar-headline-bullets-list '("◉" "○" "✸" "✿"))
    (setq org-superstar-leading-bullet " ")))

12.3. Content

12.3.1. toc-org

(eval-when-compile
  (el-clone :repo "snosov1/toc-org"))

(with-delayed-execution
  (message "Install toc-org...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/toc-org"))

  (autoload-if-found '(toc-org-mode) "toc-org" nil t)

  (with-eval-after-load 'org
    ;; hook
    (add-hook 'org-mode-hook #'toc-org-mode)))

12.4. Presentation

12.4.1. org-tree-slide

(eval-when-compile
  (el-clone :repo "takaxp/org-tree-slide"))

(with-delayed-execution
  (message "Install org-tree-slide...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-tree-slide"))

  (autoload-if-found '(org-tree-slide-mode org-tree-slide-skip-done-toggle) "org-tree-slide" nil t)

  (with-eval-after-load 'org-tree-slide
    (setq org-tree-slide-skip-outline-level 4)))

12.5. Org Link

12.5.1. org-link

(with-delayed-execution
  (message "Install ol...")

  (autoload-if-found '(org-store-link) "ol" nil t)

  (global-set-key (kbd "C-c l") #'org-store-link)

  (with-eval-after-load 'ol
    (setq org-link-file-path-type 'relative)))

12.5.2. org-link-beautify

(eval-when-compile
  (el-clone :repo "emacsmirror/org-link-beautify"))

(with-delayed-execution
  (message "Install org-link-beautify...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-link-beautify"))

  (autoload-if-found '(org-link-beautify-mode) "org-link-beautify" nil t)

  ;; (with-eval-after-load 'org
  ;;   (add-hook 'org-mode-hook #'org-link-beautify-mode))
  )

12.5.3. orgit

(eval-when-compile
  (el-clone :repo "magit/orgit"))

(with-delayed-execution
  (message "Install orgit...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/orgit"))

  (autoload-if-found '(orgit-store-link) "orgit" nil t)

  (with-eval-after-load 'magit
    (define-key magit-mode-map [remap org-store-link] #'orgit-store-link)))

12.6. Org Agenda

12.6.1. Basic

(with-delayed-execution
  (message "Install org-agenda...")
  (autoload-if-found '(org-agenda) "org-agenda" nil t)

  (global-set-key (kbd "C-c a") #'org-agenda)

  (with-eval-after-load 'org-agenda
    (setq org-agenda-span 'day)
    (setq org-agenda-start-on-weekday 1)
    (setq org-agenda-todo-ignore-with-date t)))

12.6.2. org-super-agenda

(eval-when-compile
  (el-clone :repo "alphapapa/org-super-agenda"))

(with-delayed-execution
  (message "Install org-super-agenda...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-super-agenda"))

  (autoload-if-found '(org-super-agenda-mode) "org-super-agenda" nil t)

  (org-super-agenda-mode)

  (with-eval-after-load 'org-super-agenda
    (setq org-super-agenda-groups '((:log t)
                                    (:auto-group t)
                                    (:name "Today List..." :scheduled today)
                                    (:name "Due Today List..." :deadline today)
                                    (:name "Overdue List..." :deadline past)
                                    (:name "Due Soon List" :deadline future)
                                    (:name "TODO List..." :todo "TODO")
                                    (:name "WAIT List..." :todo "WAIT")
                                    (:name "DONE List..." :todo "DONE")
                                    (:name "SOMEDAY List..." :todo "SOMEDAY")))))

12.6.3. org-hyperscheduler

(eval-when-compile
  (el-clone :repo "dmitrym0/org-hyperscheduler"))

(with-delayed-execution
  (message "Install org-hyperscheduler...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-hyperscheduler"))

  (autoload-if-found '(org-hyperscheduler-open) "org-hyperscheduler" nil t))

12.6.4. org-timeblock

(eval-when-compile
  (el-clone :repo "ichernyshovvv/org-timeblock"))

(with-delayed-execution
  (message "Install org-timeblock...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-timeblock"))
  (autoload-if-found '(org-timeblock-list org-timeblock-mode) "org-timeblock" nil t))

12.7. Org External Tools

12.7.1. org-redmine

(eval-when-compile
  (el-clone :repo "gongo/org-redmine"))

(with-delayed-execution
  (message "Install org-redmine...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-redmine"))
  (autoload-if-found '(org-redmine-get-issue) "org-redmine" nil t)

  (with-eval-after-load 'org-redmine
    (setq org-redmine-template-header "[#%i%] %s%")
    (setq org-redmine-template-property '(("project_name" . "%p_n%")))))

12.7.2. org-ai

(eval-when-compile
  (el-clone :repo "rksm/org-ai"))

(with-delayed-execution
  (message "Install org-ai...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-ai"))
  (autoload-if-found '(org-ai-mode) "org-ai" nil t)

  (with-eval-after-load 'org
    ;; config
    (add-to-list 'org-structure-template-alist '("A" . "ai"))

    ;; hook
    (add-hook 'org-mode-hook #'org-ai-mode))

  (with-eval-after-load 'org-ai
    ;; config
    (setq org-ai-default-chat-model "gpt-3.5-turbo")))

12.8. Org Babel

12.8.1. basic

(with-delayed-execution
  (message "Install ob-babel...")
  (autoload-if-found '(org-babel-do-load-languages) "org" nil t)

  (with-eval-after-load 'ob-core
    (setq org-confirm-babel-evaluate nil))

  (with-eval-after-load 'ob-eval
    (advice-add #'org-babel-eval-error-notify
                :around #'(lambda (old-func &rest args)
                            (when (not (string= (nth 1 args)
                                                "mysql: [Warning] Using a password on the command line interface can be insecure.\n"))
                              (apply old-func args)))))

  (org-babel-do-load-languages 'org-babel-load-languages
                               '((awk . t)
                                 (C . t)
                                 (R . t)
                                 (clojure . t)
                                 (emacs-lisp . t)
                                 (haskell . t)
                                 (java . t)
                                 (js . t)
                                 (lisp . t)
                                 (makefile . t)
                                 (perl . t)
                                 (plantuml . t)
                                 (python . t)
                                 (ruby . t)
                                 (scheme . t)
                                 (shell . t)
                                 (sql . t)
                                 (shell . t))))

12.8.2. ob-async

(eval-when-compile
  (el-clone :repo "astahlman/ob-async"))

(with-delayed-execution
  (message "Install ob-async...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-async"))

  (autoload-if-found '(ob-async-org-babel-execute-src-block) "ob-async" nil t)

  ;; (advice-add 'org-babel-execute-src-block :around #'ob-async-org-babel-execute-src-block)
  )

12.8.3. ob-fish

(eval-when-compile
  (el-clone :repo "takeokunn/ob-fish"))

(with-delayed-execution
  (message "Install ob-fish...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-fish"))

  (autoload-if-found '(org-babel-execute:fish) "ob-fish" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("fish" . fish))))

12.8.4. ob-rust

(eval-when-compile
  (el-clone :repo "micanzhang/ob-rust"))

(with-delayed-execution
  (message "Install ob-rust...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-rust"))

  (autoload-if-found '(org-babel-execute:rust) "ob-rust" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("rust" . rust))))

12.8.5. ob-go

(eval-when-compile
  (el-clone :repo "pope/ob-go"))

(with-delayed-execution
  (message "Install ob-go...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-go"))

  (autoload-if-found '(org-babel-execute:go) "ob-go" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("go" . go))))

12.8.6. ob-translate

(eval-when-compile
  (el-clone :repo "krisajenkins/ob-translate"))

(with-delayed-execution
  (message "Install ob-translate...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-translate"))

  (autoload-if-found '(ob-translate:google-translate) "ob-translate" nil t)

  (with-eval-after-load 'text-mode
    (define-derived-mode translate-mode text-mode "translate"))

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("translate" . translate))))

12.8.7. ob-typescript

(eval-when-compile
  (el-clone :repo "lurdan/ob-typescript"))

(with-delayed-execution
  (message "Install ob-typescript...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-typescript"))

  (autoload-if-found '(org-babel-execute:typescript) "ob-typescript" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("typescript" . typescript))))

12.8.8. ob-php

(eval-when-compile
  (el-clone :repo "Sasanidas/ob-php"))

(with-delayed-execution
  (message "Install ob-php...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-php"))

  (autoload-if-found '(org-babel-execute:php) "ob-php" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("php" . php))))

12.8.9. ob-phpstan

(eval-when-compile
  (el-clone :repo "takeokunn/ob-phpstan"))

(with-delayed-execution
  (message "Install ob-phpstan...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-phpstan"))

  (autoload-if-found '(org-babel-execute:phpstan) "ob-phpstan" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("phpstan" . phpstan))))

12.8.10. ob-http

(eval-when-compile
  (el-clone :repo "zweifisch/ob-http"))

(with-delayed-execution
  (message "Install ob-http...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-http"))

  (autoload-if-found '(org-babel-execute:http) "ob-http" nil t)
  (autoload-if-found '(ob-http-mode) "ob-http-mode" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("http" . ob-http))))

12.8.11. ob-mermaid

(eval-when-compile
  (el-clone :repo "arnm/ob-mermaid"))

(with-delayed-execution
  (message "Install ob-mermaid...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-mermaid"))

  (autoload-if-found '(org-babel-execute:mermaid) "ob-mermaid" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("mermaid" . mermaid))))

12.8.12. ob-graphql

(eval-when-compile
  (el-clone :repo "jdormit/ob-graphql"))

(with-delayed-execution
  (message "Install ob-graphql...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-graphql"))
  (autoload-if-found '(org-babel-execute:graphql) "ob-graphql" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("graphql" . graphql))))

12.8.13. ob-rust

(eval-when-compile
  (el-clone :repo "micanzhang/ob-rust"))

(with-delayed-execution
  (message "Install ob-rust...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-rust"))
  (autoload-if-found '(org-babel-execute:rust) "ob-rust" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("rust" . rust))))

12.8.14. ob-swift

(eval-when-compile
  (el-clone :repo "zweifisch/ob-swift"))

(with-delayed-execution
  (message "Install ob-swift...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-swift"))
  (autoload-if-found '(org-babel-execute:swift) "ob-swift" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("swift" . swift))))

12.8.15. ob-elixir

(eval-when-compile
  (el-clone :repo "zweifisch/ob-elixir"))

(with-delayed-execution
  (message "Install ob-elixir...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-elixir"))
  (autoload-if-found '(org-babel-execute:elixir) "ob-elixir" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("elixir" . elixir))))

12.8.16. ob-dart

(eval-when-compile
  (el-clone :repo "mzimmerm/ob-dart"))

(with-delayed-execution
  (message "Install ob-dart...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-dart"))
  (autoload-if-found '(org-babel-execute:dart) "ob-dart" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("dart" . dart))))

12.8.17. ob-fsharp

(eval-when-compile
  (el-clone :repo "juergenhoetzel/ob-fsharp"))

(with-delayed-execution
  (message "Install ob-fsharp...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-fsharp"))
  (autoload-if-found '(org-babel-execute:fsharp) "ob-fsharp" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("fsharp" . fsharp))))

12.8.18. ob-treesitter

(eval-when-compile
  (el-clone :repo "takeokunn/ob-treesitter"))

(with-delayed-execution
  (message "Install ob-treesitter...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-treesitter"))

  (autoload-if-found '(org-babel-execute:treesitter) "ob-treesitter" nil t)

  (with-eval-after-load 'prog-mode
    (define-derived-mode treesitter-mode prog-mode "treesitter"))

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("treesitter" . treesitter))))

12.8.19. ob-base64

(eval-when-compile
  (el-clone :repo "KeyWeeUsr/ob-base64"))

(with-delayed-execution
  (message "Install ob-base64...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ob-base64"))

  (autoload-if-found '(org-babel-execute:base64) "ob-base64" nil t)

  (with-eval-after-load 'org-src
    (add-to-list 'org-src-lang-modes '("base64" . base64))))

12.8.20. org-nix-shell

(eval-when-compile
  (el-clone :repo "AntonHakansson/org-nix-shell"))

(with-delayed-execution
  (message "Install org-nix-shell...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-nix-shell"))

  (autoload-if-found '(org-nix-shell-mode) "org-nix-shell" nil t)

  (with-eval-after-load 'org
    (add-hook 'org-mode-hook #'org-nix-shell-mode)))

12.9. Org Publish

12.9.1. ox-html

(with-eval-after-load 'ox-html
  (setq org-html-head-include-default-style nil)
  (setq org-html-head-include-scripts nil)
  (setq org-html-doctype "html5")
  (setq org-html-coding-system 'utf-8-unix))

12.9.2. ox-gfm

(eval-when-compile
  (el-clone :repo "larstvei/ox-gfm"))

(with-delayed-execution
  (message "Install ox-gfm...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ox-gfm"))

  (autoload-if-found '(org-gfm-export-as-markdown
                       org-gfm-convert-region-to-md
                       org-gfm-export-to-markdown
                       org-gfm-publish-to-gfm) "ox-gfm" nil t))

12.9.3. ox-zenn

(eval-when-compile
  (el-clone :repo "conao3/ox-zenn.el"))

(with-delayed-execution
  (message "Install ox-zenn...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ox-zenn"))

  (autoload-if-found '(org-zenn-export-as-markdown
                       org-zenn-export-to-markdown
                       org-zenn-publish-to-markdown
                       org-zenn-convert-region-to-md) "ox-zenn" nil t))

12.9.4. ox-hatena

(eval-when-compile
  (el-clone :repo "zonkyy/ox-hatena"))

(with-delayed-execution
  (message "Install ox-hatena...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ox-hatena"))

  (autoload-if-found '(org-hatena-export-as-hatena
                       org-hatena-export-to-hatena
                       org-hatena-export-to-hatena-and-open) "ox-hatena" nil t))

12.9.5. ox-qmd

(eval-when-compile
  (el-clone :repo "0x60df/ox-qmd"))

(with-delayed-execution
  (message "Install ox-qmd...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ox-qmd"))

  (autoload-if-found '(org-qmd-export-as-markdown
                       org-qmd-convert-region-to-md
                       org-qmd-export-to-markdown) "ox-qmd" nil t))

12.9.6. ox-hugo

(eval-when-compile
  (el-clone :repo "kaushalmodi/ox-hugo"))

(with-delayed-execution
  (message "Install ox-hugo...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ox-hugo"))

  (autoload-if-found '(org-hugo-export-as-md
                       org-hugo-export-to-md
                       org-hugo-export-wim-to-md
                       org-hugo-debug-info) "ox-hugo" nil t)

  (with-eval-after-load 'ox-hugo
    (setq org-hugo-auto-set-lastmod t)))

12.10. Org Roam

12.10.1. el-clone

(eval-when-compile
  (el-clone :repo "org-roam/org-roam"
            :load-paths `(,(locate-user-emacs-file "el-clone/org-roam/extensions"))))

12.10.2. basic

(with-delayed-execution
  (message "Install org-roam...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-roam"))
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-roam/extensions"))

  (autoload-if-found '(org-roam-graph) "org-roam" nil t)
  (global-set-key (kbd "C-c n g") #'org-roam-graph)

  (with-eval-after-load 'org-roam
    (setq org-roam-directory `,(concat (s-trim-right (shell-command-to-string "ghq root"))
                                       "/github.com/takeokunn/blog"))))

12.10.3. org-roam-mode

(with-delayed-execution
  (message "Install org-roam-mode...")

  (autoload-if-found '(org-roam-buffer-toggle) "org-roam-mode" nil t)

  (global-set-key (kbd "C-c n l") #'org-roam-buffer-toggle))

12.10.4. org-roam-node

(with-delayed-execution
  (message "Install org-roam-node...")
  (autoload-if-found '(org-roam-node-find org-roam-node-insert) "org-roam-node" nil t)

  (global-set-key (kbd "C-c n f") #'org-roam-node-find)
  (global-set-key (kbd "C-c n i") #'org-roam-node-insert)

  (with-eval-after-load 'org-roam-node
    (setq org-roam-completion-everywhere nil)))

12.10.5. org-roam-db

(with-delayed-execution
  (message "Install org-roam-db...")
  (autoload-if-found '(org-roam-db-autosync-enable) "org-roam-db" nil t)
  (org-roam-db-autosync-enable)
  (with-eval-after-load 'org-roam-db
    (setq org-roam-database-connector 'sqlite)
    (setq org-roam-db-gc-threshold (* 4 gc-cons-threshold))))

12.10.6. org-roam-capture

(with-delayed-execution
  (message "Install org-roam-capture...")
  (autoload-if-found '(org-roam-capture) "org-roam-capture" nil t)

  (global-set-key (kbd "C-c n c") #'org-roam-capture)

  (with-eval-after-load 'org-roam-capture
    (setq org-roam-capture-templates '(("f" "Fleeting(一時メモ)" plain "%?"
                                        :target (file+head "org/fleeting/%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
                                        :unnarrowed t)
                                       ("l" "Literature(文献)" plain "%?"
                                        :target (file+head "org/literature/%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
                                        :unnarrowed t)
                                       ("p" "Permanent(記事)" plain "%?"
                                        :target (file+head "org/permanent/%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
                                        :unnarrowed t)
                                       ("d" "Diary(日記)" plain "%?"
                                        :target (file+head "org/diary/%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
                                        :unnarrowed t)
                                       ("z" "Zenn" plain "%?"
                                        :target (file+head "org/zenn/%<%Y%m%d%H%M%S>.org" "#+TITLE: ${title}\n")
                                        :unnarrowed t)
                                       ("m" "Private" plain "%?"
                                        :target (file+head "org/private/%<%Y%m%d%H%M%S>.org.gpg" "#+TITLE: ${title}\n")
                                        :unnarrowed t)
                                       ("o" "Poem" plain "%?"
                                        :target (file+head "org/poem/%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n")
                                        :unnarrowed t)))))

12.10.7. org-roam-dailies

(with-delayed-execution
  (message "Install org-roam-dailies...")
  (autoload-if-found '(org-roam-dailies-map
                       org-roam-dailies-goto-today
                       org-roam-dailies-goto-yesterday
                       org-roam-dailies-goto-tomorrow
                       org-roam-dailies-capture-today
                       org-roam-dailies-goto-next-note
                       org-roam-dailies-goto-previous-note
                       org-roam-dailies-goto-date
                       org-roam-dailies-capture-date
                       org-roam-dailies-find-directory) "org-roam-dailies" nil t)

  (global-set-key (kbd "C-c n d") #'org-roam-dailies-map)
  (global-set-key (kbd "C-c n j") #'org-roam-dailies-goto-today)

  (with-eval-after-load 'org-roam-dailies
    ;; config
    (setq org-roam-dailies-directory "org/daily/")

    ;; keybind
    (define-key org-roam-dailies-map (kbd "d") #'org-roam-dailies-goto-today)
    (define-key org-roam-dailies-map (kbd "y") #'org-roam-dailies-goto-yesterday)
    (define-key org-roam-dailies-map (kbd "t") #'org-roam-dailies-goto-tomorrow)
    (define-key org-roam-dailies-map (kbd "n") #'org-roam-dailies-capture-today)
    (define-key org-roam-dailies-map (kbd "f") #'org-roam-dailies-goto-next-note)
    (define-key org-roam-dailies-map (kbd "b") #'org-roam-dailies-goto-previous-note)
    (define-key org-roam-dailies-map (kbd "c") #'org-roam-dailies-goto-date)
    (define-key org-roam-dailies-map (kbd "v") #'org-roam-dailies-capture-date)
    (define-key org-roam-dailies-map (kbd ".") #'org-roam-dailies-find-directory)))

12.10.8. org-roam-export

(with-delayed-execution
  (message "Install org-roam-export...")
  (autoload-if-found '(org-roam-export--org-html--reference) "org-roam-export" nil t)
  (advice-add 'org-html--reference :override #'org-roam-export--org-html--reference))

12.10.9. org-roam-graph

(with-delayed-execution
  (message "Install org-roam-graph...")
  (autoload-if-found '(org-roam-graph org-roam-graph--open) "org-roam-graph" nil t))

12.10.10. org-roam-overlay

(with-delayed-execution
  (message "Install org-roam-overlay...")
  (autoload-if-found '(org-roam-overlay-mode) "org-roam-overlay" nil t)
  (with-eval-after-load 'org-roam-mode
    (add-hook 'org-roam-mode-hook #'org-roam-overlay-mode)))

12.10.11. org-roam-protocol

(with-delayed-execution
  (message "Install org-roam-protocol...")
  (autoload-if-found '(org-roam-protocol-open-ref org-roam-protocol-open-node) "org-roam-protocol" nil t)
  (with-eval-after-load 'org-roam-protocol
    ;; alist
    (add-to-list 'org-protocol-protocol-alist '("org-roam-ref" :protocol "roam-ref" :function org-roam-protocol-open-ref))
    (add-to-list 'org-protocol-protocol-alist '("org-roam-node" :protocol "roam-node" :function org-roam-protocol-open-node))

    ;; config
    (setq org-roam-protocol-store-links t)))

12.10.12. consult-org-roam

(eval-when-compile
  (el-clone :repo "jgru/consult-org-roam"))

(with-delayed-execution
  (message "Install consult-org-roam...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/consult-org-roam"))

  (autoload-if-found '(consult-org-roam-mode) "consult-org-roam" nil t)

  (consult-org-roam-mode)

  ;; keybinds
  (global-set-key (kbd "C-c n e") #'consult-org-roam-file-find)
  (global-set-key (kbd "C-c n b") #'consult-org-roam-backlinks)
  (global-set-key (kbd "C-c n B") #'consult-org-roam-backlinks-recursive)
  (global-set-key (kbd "C-c n l") #'consult-org-roam-forward-links)
  (global-set-key (kbd "C-c n r") #'consult-org-roam-search)

  (with-eval-after-load 'consult-org-roam
    (setq consult-org-roam-grep-func #'consult-ripgrep)
    (setq consult-org-roam-buffer-narrow-key ?r)
    (setq consult-org-roam-buffer-after-buffers t)))

12.10.13. org-roam-ui

(eval-when-compile
  (el-clone :repo "org-roam/org-roam-ui"))

(with-delayed-execution
  (message "Install org-roam-ui...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-roam-ui"))

  (autoload-if-found '(org-roam-ui-mode) "org-roam-ui" nil t)

  (with-eval-after-load 'org-roam-mode
    (add-hook 'org-roam-mode-hook #'org-roam-ui-mode))

  (with-eval-after-load 'org-roam-ui
    (setq org-roam-ui-sync-theme t)
    (setq org-roam-ui-follow t)
    (setq org-roam-ui-update-on-save t)
    (setq org-roam-ui-open-on-start t)))

12.10.14. org-roam-timestamps

(eval-when-compile
  (el-clone :repo "tefkah/org-roam-timestamps"))

(with-delayed-execution
  (message "Install org-roam-timestamps...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-roam-timestamps"))

  (autoload-if-found '(org-roam-timestamps-mode) "org-roam-timestamps" nil t)

  (with-eval-after-load 'org-roam-mode
    (add-hook 'org-roam-mode #'org-roam-timestamps-mode))

  (with-eval-after-load 'org-roam-timestamps
    (setq org-roam-timestamps-remember-timestamps nil)))

12.10.15. org-roam-search-node-insert

(eval-when-compile
  (el-clone :repo "natask/org-roam-search"))

(with-delayed-execution
  (message "Install org-roam-search...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-roam-search")))

12.10.16. org-roam-ql

(eval-when-compile
  (el-clone :repo "ahmed-shariff/org-roam-ql"))

(with-delayed-execution
  (message "Install org-roam-ql...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/org-roam-ql"))
  (autoload-if-found '(org-roam-ql-nodes
                       org-roam-ql-search
                       org-roam-ql-defpred
                       org-roam-ql-agenda-buffer-from-roam-buffer
                       org-roam-ql-refresh-buffer
                       org-dblock-write:org-roam-ql) "org-roam-ql" nil t)
  (autoload-if-found '(org-roam-ql-ql-init) "org-roam-ql-ql" nil t)

  (org-roam-ql-ql-init))

13. EXWM

13.1. exwm

(eval-when-compile
  (el-clone :repo "ch11ng/exwm"))

13.2. exwm-edit

(eval-when-compile
  (el-clone :repo "agzam/exwm-edit"))

(when (string= system-type "gnu/linux")
  (with-delayed-execution
    (message "Install exwm-edit...")
    (add-to-list 'load-path (locate-user-emacs-file "el-clone/exwm-edit"))

    (autoload-if-found '(exwm-edit--compose-minibuffer) "exwm-edit" nil t)

    (exwm-input-set-key (kbd "C-c '") #'exwm-edit--compose-minibuffer)
    (exwm-input-set-key (kbd "C-c C-'") #'exwm-edit--compose-minibuffer)

    (with-eval-after-load 'exwm-edit
      (setq exwm-edit-bind-default-keys nil))))

13.3. exwm-modeline

(eval-when-compile
  (el-clone :repo "SqrtMinusOne/exwm-modeline"))

(when (string= system-type "gnu/linux")
  (with-delayed-execution
    (message "Install exwm-modeline...")
    (add-to-list 'load-path (locate-user-emacs-file "el-clone/exwm-modeline"))

    (autoload-if-found '(exwm-modeline-mode) "exwm-modeline")

    (with-eval-after-load 'exwm-core
      (add-hook 'exwm-mode-hook #'exwm-modeline-mode))

    (with-eval-after-load 'exwm-modeline
      (setq exwm-modeline-short t))))

14. AI

14.1. copilot.el

(eval-when-compile
  (el-clone :repo "zerolfx/copilot.el"))

(with-delayed-execution
  (message "Install copilot...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/copilot"))
  (autoload-if-found '(copilot-login
                       copilot-mode
                       global-copilot-mode) "copilot" nil t)

  (with-eval-after-load 'copilot
    ;; config
    (setq copilot-log-max 100000)

    ;; keymap
    (define-key copilot-mode-map (kbd "C-c # i") #'copilot-complete)
    (define-key copilot-mode-map (kbd "C-c # a") #'copilot-accept-completion)))

14.2. llm

(eval-when-compile
  (el-clone :repo "ahyatt/llm"))

(with-delayed-execution
  (message "Install llm...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/llm"))

  (autoload-if-found '(make-llm-ollama) "llm-ollama" nil t)

  (with-eval-after-load 'llm
    (setq llm-warn-on-nonfree nil)))

14.3. ellama

(eval-when-compile
  (el-clone :repo "s-kostyaev/ellama"))

(with-delayed-execution
  (message "Install ellama...")
  (add-to-list 'load-path (locate-user-emacs-file "el-clone/ellama"))
  (autoload-if-found '(ellama-chat
                       ellama-ask
                       ellama-ask-about
                       ellama-ask-line
                       ellama-complete
                       ellama-translate
                       ellama-define-word
                       ellama-summarize
                       ellama-code-review
                       ellama-change
                       ellama-enhance-grammar-spelling
                       ellama-enhance-wording
                       ellama-make-concise
                       ellama-change-code
                       ellama-enhance-code
                       ellama-complete-code
                       ellama-add-code
                       ellama-render
                       ellama-make-list
                       ellama-make-table
                       ellama-summarize-webpage
                       ellama-provider-select
                       ellama-code-complete
                       ellama-code-add
                       ellama-code-edit
                       ellama-code-improve
                       ellama-improve-wording
                       ellama-improve-grammar
                       ellama-improve-conciseness
                       ellama-make-format
                       ellama-ask-interactive)
                     "ellama" nil t)

  (with-eval-after-load 'ellama
    (setq ellama-language "Japanese")
    (setq ellama-providers "llama2:13b")
    (setq ellama-provider (progn
                            (make-llm-ollama :chat-model "llama2" :embedding-model "llama2")
                            (make-llm-ollama :chat-model "llama2:13b" :embedding-model "llama2:13b")))))

text:

ls ~/.ghq/github.com/takeokunn/private/**/*.org | xargs -IFILE ollama run llama2:13b $(cat FILE)
ollama run llama2 '2023年11月20日に何をしましたか?'

15. MyFunc

15.1. my/beginning-of-intendation

(defun my/beginning-of-intendation ()
  "move to beginning of line, or indentation"
  (interactive)
  (back-to-indentation))

15.2. my/copy-buffer

(defun my/copy-buffer ()
  (interactive)
  (save-excursion
    (mark-whole-buffer)
    (copy-region-as-kill (region-beginning) (region-end))))

(defalias 'copy-buffer 'my/copy-buffer)

15.3. my/ghq-get

(defun my/ghq-get ()
  (interactive)
  (let ((url (read-string "url > ")))
    (message
     (shell-command-to-string
      (mapconcat #'shell-quote-argument
                 (list "ghq" "get" url)
                 " ")))))

(defalias 'ghq-get 'my/ghq-get)

15.4. my/gh-browse

(defun my/gh-browse ()
  (interactive)
  (message
   (shell-command-to-string
    (mapconcat #'shell-quote-argument
               (list "gh" "browse")
               " "))))

(defalias 'gh-browse 'my/gh-browse)

15.5. my/indent-all

(defun my/indent-buffer ()
  (interactive)
  (save-excursion
    (mark-whole-buffer)
    (untabify (region-beginning) (region-end))
    (indent-region (region-beginning) (region-end))))

(defalias 'indent-buffer 'my/indent-buffer)

15.6. my/move-line

(defun my/move-line (arg)
  (interactive)
  (let ((col (current-column)))
    (unless (eq col 0)
      (move-to-column 0))
    (save-excursion
      (forward-line)
      (transpose-lines arg))
    (forward-line arg)))

(defun my/move-line-down ()
  (interactive)
  (my/move-line 1))

(defun my/move-line-up ()
  (interactive)
  (my/move-line -1))

(global-set-key (kbd "M-N") #'my/move-line-down)
(global-set-key (kbd "M-P") #'my/move-line-up)

15.7. my/reload-major-mode

(defun my/reload-major-mode ()
  "Reload current major mode."
  (interactive)
  (let ((current-mode major-mode))
    (fundamental-mode)
    (funcall current-mode)
    current-mode))

15.8. my/toggle-kill-emacs

(defvar my/kill-emacs-keybind-p t)

(defun my/toggle-kill-emacs ()
  (interactive)
  (if my/kill-emacs-keybind-p
      (progn
        (message "C-x C-c save-buffers-kill-emacs OFF")
        (setq my/kill-emacs-keybind-p nil)
        (global-set-key (kbd "C-x C-c") nil))
    (progn
      (message "C-x C-c save-buffers-kill-emacs ON")
      (setq my/kill-emacs-keybind-p t)
      (global-set-key (kbd "C-x C-c") 'save-buffers-kill-emacs))))

15.9. my/get-class-name-by-file-name

(defun my/get-class-name-by-file-name ()
  (interactive)
  (insert
   (file-name-nondirectory
    (file-name-sans-extension (or (buffer-file-name)
                                  (buffer-name (current-buffer)))))))

15.10. my/insert-clipboard

(defun my/insert-clipboard (arg)
  (interactive "sstring: ")
  (kill-new arg))

15.11. my/actionlint

(defun my/actionlint ()
  (interactive)
  (shell-command-to-string "actionlint"))

(defalias 'actionlint 'my/actionlint)

15.12. my/build-info

(defun my/build-info ()
  "Display build information in a buffer."
  (interactive)
  (switch-to-buffer (get-buffer-create "*Build info*"))
  (setq tab-width 4)
  (let ((buffer-read-only nil))
    (erase-buffer)
    (insert (format "GNU Emacs %s\nCommit:\t\t%s\nBranch:\t\t%s\n"
                    emacs-version
                    emacs-repository-version
                    emacs-repository-branch))
    (insert (format "System:\t\t%s\nDate:\t\t%s\n"
                    system-configuration
                    (format-time-string "%Y-%m-%d %T (%Z)" emacs-build-time)))
    (insert (format "Patch:\t\t%s ns-inline.patch\n"
                    (if (boundp 'mac-ime--cursor-type) "with" "without")))
    (insert (format "Features:\t%s\n" system-configuration-features))
    (view-mode)))

15.13. my/current-ip-address

(defun my/current-ip-address ()
  (interactive)
  (insert
   (shell-command-to-string "curl -s ifconfig.me")))

16. Footer

16.1. byte-compileする

;; (eval-when-compile
;;   (el-clone-byte-compile))

16.2. Magic File Name を有効にする

(setq file-name-handler-alist my/saved-file-name-handler-alist)

16.3. profilerを終了する

(when my/enable-profile
  (profiler-report)
  (profiler-stop))

Author: takeokunn

Created: 2024-03-02 Sat 16:13

Validate