dotfiles/.config/emacs/emacs.org
2023-01-23 22:36:07 +09:00

59 KiB
Executable File
Raw Blame History

Emacs Configuration

Basic Configuration

Emacs Configuration for emacs 29.50

Early Init

  ;;; early-init.el -*- lexical-binding: t; -*-
  ;; garbage collection
  (setq gc-cons-threshold (* 50 1024 1024)) ;; 50MB
  ;; prefers newest version of a file
  (customize-set-variable 'load-prefer-newer t)

  ;;; Native compilation settings
  (when (featurep 'native-compile)
    ;; Silence compiler warnings as they can be pretty disruptive
    (setq native-comp-async-report-warnings-errors nil)

    ;; Make native compilation happens asynchronously
    (setq native-comp-deferred-compilation t))

  (setq inhibit-startup-message t)
  (setq frame-resize-pixelwise t)
  (scroll-bar-mode -1)
  (tool-bar-mode -1)
  (tooltip-mode -1)
  (set-fringe-mode 10)
  (menu-bar-mode -1)
  ;;(blink-cursor-mode 0)

  ;; initial load with blue theme
  (load-theme 'deeper-blue)

  (customize-set-variable 'initial-major-mode 'fundamental-mode)

Init

Startup hook

;;; init.el -*- lexical-binding: t; -*-
(add-hook 'emacs-startup-hook
          (lambda ()
            (message "Emacs loaded in %s"
                     (emacs-init-time))))

Package Function

  (defvar bootstrap-version)
  (defvar comp-deferred-compilation-deny-list ()) ; workaround, otherwise straight shits itself
  (let ((bootstrap-file
         (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
        (bootstrap-version 5))
    (unless (file-exists-p bootstrap-file)
      (with-current-buffer
          (url-retrieve-synchronously
           "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
           'silent 'inhibit-cookies)
        (goto-char (point-max))
        (eval-print-last-sexp)))
    (load bootstrap-file nil 'nomessage))
  (package-initialize)
  (unless package-archive-contents
    (package-refresh-contents))
  (straight-use-package '(use-package :build t))
  (setq use-package-always-ensure t)

  (unless (file-exists-p package-user-dir)
    (mkdir package-user-dir t))
  ;;; init.el ends here

Add other modules

(add-to-list 'load-path (expand-file-name "modules/" user-emacs-directory))

Edit options

Whitespace clean
(add-hook 'before-save-hook #'whitespace-cleanup)
Tabs
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)

협업에 있어서 코드에 tabs 크기를 명시하는 것도 방법일듯.

Modeline Indentation example
  • Emacs

    /* -*- Mode: rust; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
  • Vim

    # Embeded VIM Configurations
    # vim: filetype=sh noet sw=4 ts=4 fdm=marker
  • Visual Studio Code install extension modeline.

    // vim: set ft=js ts=4 sw=4 et:
    // vim :ts=4 :sw=4 :et :ft=js
    // -*- mode: js; indent-tabs-mode: nil; tab-width: 4 -*-
    // code: language=rust insertSpaces=false tabSize=4
    

Backup options

(setq backup-directory-alist `(("." . ,(expand-file-name "backups/" user-emacs-directory))))
(setq-default custom-file (expand-file-name ".custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
  (load custom-file))
(setq delete-by-moving-to-trash t
      trash-directory "~/.local/share/Trash/files/")
(setq undo-limit 100000000
      auto-save-default t)

Other options

  (set-default-coding-systems 'utf-8)
  (set-language-environment "utf-8")
  (prefer-coding-system 'utf-8)
  (customize-set-variable 'large-file-warning-threshold 100000000) ;; 100MB

  (defconst ON-LINUX (eq system-type 'gnu/linux))
  (defconst ON-MAC (eq system-type 'darwin))
  (defconst ON-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))

  (setq gc-cons-threshold (* 2 1024 1024)) ; decreasing the threshold to 2MB

  (defvar my-config-file (expand-file-name "config.el" user-emacs-directory))
  (load my-config-file nil 'nomessage)

  (setq use-short-answer t)

  (setq global-auto-revert-non-file-buffers t)
  (global-auto-revert-mode t)

  (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
  (add-to-list 'default-frame-alist '(fullscreen . maximized))
  (unless (display-graphic-p)
    (xterm-mouse-mode))

Modules Selection module

  ;;; config.el -*- lexical-binding: t; -*-
  (setq user-full-name "JaeYoo-Im"
        user-mail-address "cpu3792@gmail.com")

  (setq default-input-method "korean-hangul")

  ;; when programming _
  (modify-syntax-entry ?_ "w")
  (setq visible-bell t)

  (add-hook 'emacs-startup-hook
            (lambda ()
              (custom-set-faces
               `(default ((t (:font "Fira Code 11"))))
               `(fixed-pitch ((t (:inherit (default)))))
               `(fixed-pitch-serif ((t (:inherit (default)))))
               `(variable-pitch ((t (:font "Ubuntu 11")))))))

  (require 'custom-ui)
  (require 'custom-keybindings)
  (require 'custom-default)
  (require 'custom-completion)
  (require 'custom-projects)
  (require 'custom-latex)
  (require 'custom-org)
  ;;(require 'custom-workspaces)
  (require 'custom-languages)
  (require 'custom-extra)

  ;;; config.el ends here

Module Lists

Default

emacs built-in package config

Ediff
;; Don't let ediff break EXWM, keep it in one frame
(setq ediff-diff-options "-w"
      ediff-split-window-function 'split-window-horizontally
      ediff-window-setup-function 'ediff-setup-windows-plain)
Eshell
  (when (eq system-type 'windows-nt)
    (setq explicit-shell-file-name "powershell.exe")
    (setq explicit-powershell.exe-args '()))
  (defun ju/get-prompt-path ()
    (let* ((current-path (eshell/pwd))
           (git-output (shell-command-to-string "git rev-parse --show-toplevel"))
           (has-path (not (string-match "^fatal" git-output))))
      (if (not has-path)
          (abbreviate-file-name current-path)
       (string-remove-prefix (file-name-directory git-output) current-path))))

  (defun ju/eshell-prompt ()
    (let ((current-branch (magit-get-current-branch)))
      (concat
       "\n"
       (propertize (system-name) 'face `(:foreground "#62aeed"))
       (propertize " ॐ " 'face `(:foreground "white"))
       (propertize (ju/get-prompt-path) 'face `(:foreground "#82cfd3"))
       (when current-branch
         (concat
          (propertize " • " 'face `(:foreground "white"))
          (propertize (concat " " current-branch) 'face `(:foreground "#c475f0"))))
       (propertize " • " 'face `(:foreground "white"))
       (propertize (format-time-string "%I:%M:%S %p") 'face `(:foreground "#5a5b7f"))
       (if (= (user-uid) 0)
           (propertize "\n#" 'face `(:foreground "red2"))
         (propertize "\nλ" 'face `(:foreground "#aece4a")))
       (propertize " " 'face `(:foreground "white")))))

  (defun ju/configure-eshell ()
    ;; Save command history when commands are entered
    (add-hook 'eshell-pre-command-hook 'eshell-save-some-history)

    ;; Truncate buffer for performance
    (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)

    ;; Bind some useful keys for evil-mode
    (evil-define-key '(normal insert visual) eshell-mode-map (kbd "C-r") 'counsel-esh-history)
    (evil-define-key '(normal insert visual) eshell-mode-map (kbd "<home>") 'eshell-bol)
    (evil-normalize-keymaps)

    (setq eshell-prompt-function      'ju/eshell-prompt
          eshell-prompt-regexp        "^λ "
          eshell-history-size         10000
          eshell-buffer-maximum-lines 10000
          eshell-hist-ignoredups t
          eshell-scroll-to-bottom-on-input t))
  (add-hook 'eshell-first-time-mode-hook #'ju/configure-eshell)
  (setq eshell-prompt-function
        (lambda ()
          (concat (abbreviate-file-name (eshell/pwd))
                  (if (= (user-uid) 0) " # " " λ ")))
        eshell-prompt-regexp "^[^#λ\n]* [#λ] ")
Dired
  (use-package dired
    :ensure nil
    :straight nil
    :commands (dired dired-jump)
    :bind (("C-x C-j" . dired-jump))
    :custom ((dired-listing-switches "-agho --group-directories-first"))
    :config
    (evil-collection-define-key 'normal 'dired-mode-map
      "h" 'dired-single-up-directory
      "l" 'dired-single-buffer))
  (use-package dired-single
    :straight (:build t)
    :defer t
    :commands (dired dired-jump))
  (use-package diredfl  ;; colorful dired
    :straight (:build t)
    :defer t
    :hook dired-mode)
  (use-package dired-git-info
    :straight (:build t)
    :defer t
    :config
    (evil-collection-define-key 'normal 'dired-mode-map
      ")" 'dired-git-info-mode))
  (use-package diff-hl
    :straight (:build t)
    :defer t
    :hook ((dired-mode . diff-hl-dired-mode-unless-remote)
           (magit-post-refresh . diff-hl-magit-post-refresh))
    :config
    (diff-hl-margin-mode))
  (use-package dired-rsync
    :straight (:build t)
    :defer t
    :bind (:map dired-mode-map
                ("C-c C-r" . dired-rsync)))
  (use-package all-the-icons-dired
    :straight (:build t)
    :defer t
    :hook dired-mode)
  (use-package dired-hide-dotfiles
    :straight (:build t)
    :defer t
    :hook (dired-mode)
    :config
    (evil-collection-define-key 'normal 'dired-mode-map
      "H" 'dired-hide-dotfiles-mode))

  ;; HACK:Fixes #1929: icons break file renaming in Emacs 27+, because the icon
  ;;      is considered part of the filename, so we disable icons while we're in
  ;;      wdired-mode.
  ;;(when EMACS27+
  (defvar +wdired-icons-enabled -1)

  ;; TODO: check emacs29 updates
  ;;(csetq dired-mouse-drag-files                   t
  ;;       mouse-drag-and-drop-region-cross-program t)

  (use-package peep-dired
    :straight (:build t)
    :defer t
    :hook (peep-dired . evil-normalize-keymaps)
    :config
    (evil-define-key 'normal peep-dired-mode-map
      (kbd "j") 'peep-dired-next-file
      (kbd "k") 'peep-dired-prev-file))
Provide Modules
  (provide 'custom-default)
  ;;; custom-default.el ends here

UI

Line number
  (column-number-mode)
  (global-display-line-numbers-mode t)
  ;; Disable line numbers for some modes
  (dolist (mode '(org-mode-hook
                  nov-mode-hook
                  dashboard-mode-hook
                  dired-mode-hook
                  eshell-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 0))))
Doom themes
  (use-package doom-themes
    :straight (:build t)
    :defer t
    :init
    (disable-theme 'deeper-blue)
    (if (display-graphic-p)
        (load-theme 'doom-palenight t)
      (load-theme 'doom-gruvbox t)))
Rainbow Delimiters
  (use-package rainbow-delimiters
    :straight (:build t)
    :defer t
    :hook (prog-mode . rainbow-delimiters-mode))
Setting Transparency
  (set-frame-parameter nil 'alpha-background 0.9)
  (add-to-list 'default-frame-alist '(alpha-background . 0.9))
  (defun toggle-transparency ()
    "toggle transparency."
    (interactive)
    (let ((alpha-transparency 1.0))
      (if (eq (frame-parameter nil 'alpha-background) alpha-transparency)
          (set-frame-parameter nil 'alpha-background 0.9)
        (set-frame-parameter nil 'alpha-background alpha-transparency))))
  (defun my/transparency-round (val)
    "Round VAL to the nearest tenth of an integer."
    (/ (round (* 10 val)) 10.0))

  (defun my/increase-frame-alpha-background ()
    "Increase current frames alpha background."
    (interactive)
    (set-frame-parameter nil
                         'alpha-background
                         (my/transparency-round
                          (min 1.0
                               (+ (frame-parameter nil 'alpha-background) 0.1))))
    (message "%s" (frame-parameter nil 'alpha-background)))

  (defun my/decrease-frame-alpha-background ()
    "Decrease current frames alpha background."
    (interactive)
    (set-frame-parameter nil
                         'alpha-background
                         (my/transparency-round
                          (max 0.0
                               (- (frame-parameter nil 'alpha-background) 0.1))))
    (message "%s" (frame-parameter nil 'alpha-background)))
  (global-set-key (kbd "C-c t") 'toggle-transparency)
Modeline
  (use-package doom-modeline
    :straight (:build t)
    :defer t
    :init (doom-modeline-mode 1)
    :config
    (setq doom-modeline-height 15
          doom-modeline-env-version t
          doom-modeline-persp-name t
          doom-modeline-persp-icon t
          doom-modeline-display-default-persp-name t
          doom-modeline-indent-info t))
Visual Fill Column
  (defun write-room-enable ()
    "Write Room Enable"
    (interactive)
    (setq visual-fill-column-width 100
          visual-fill-column-center-text t)
    (visual-line-mode t)
    (visual-fill-column-mode t))

  (use-package visual-fill-column
    :straight (:build t)
    :defer t
    :hook ((org-mode markdown-mode nov-mode) . write-room-enable))
All The Icons
  (use-package all-the-icons
    :straight t)
Dashboard
  (use-package dashboard
    :straight (:build t)
    :ensure t
    :after all-the-icons
    :config
    (setq dashboard-set-heading-icons t)
    (setq dashboard-set-file-icons t)
    ;;(setq dashboard-banner-logo-title "Emacs is more than a text editor!")
    ;;(setq dashboard-startup-banner 'logo)
    (setq dashboard-center-content t)
    (setq dashboard-week-agenda t)
    (setq dashboard-set-footer t)
    (setq dashboard-page-separator "\n\n")
    ;;(setq dashboard-page-separator "\n\f\n")
    (setq dashboard-agenda-time-string-format "%d/%m/%Y %A %H:%M")
    (setq dashboard-projects-backend 'project-el)
    (setq dashboard-items '((recents . 10)
                            (agenda . 5)
                            (bookmarks . 5)
                            ;;(if (version< emacs-version "29")
                            (projects . 5)
                            (registers . 5)))
    (setq dashboard-set-navigator t)

    (setq dashboard-navigator-buttons
          `(;; line1
            ((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
              "Github"
              "Browse my Github"
              (lambda (&rest _) (browse-url "https://github.com/JaeUs3792/")))
             (,(all-the-icons-octicon "home" :height 1.1 :v-adjust 0.0)
              "Homepage"
              "Browse my Homepage"
              (lambda (&rest _) (browse-url "https://jaeus.net")))
             (,(all-the-icons-octicon "zap" :height 1.1 :v-adjust 0.0)
              "Refresh"
              "Refresh Packages"
              (lambda (&rest _) (package-refresh-contents)) warning))))

    (dashboard-setup-startup-hook)
    (dashboard-modify-heading-icons '((recents . "file-text")
                                      (bookmarks . "book")))
    (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))))
Others
  (defun my/self-screenshot (&optional type)
    "Save a screenshot of type TYPE of the current Emacs frame.
        As shown by the function `', type can weild the value `svg',
        `png', `pdf'.

        This function will output in /tmp a file beginning with \"Emacs\"
        and ending with the extension of the requested TYPE."
    (interactive)
    (let* ((type (if type type
                   (intern (completing-read "Screenshot Type: "
                                            '(png svg pdf postscript)))))
           (extension (pcase type
                        ('png        ".png")
                        ('svg        ".svg")
                        ('pdf        ".pdf")
                        ('postscript ".ps")
                        (otherwise (error "Cannot export screenshot of type %s" otherwise))))
           (filename (make-temp-file "Emacs-" nil extension))
           (data     (x-export-frames nil type)))
      (with-temp-file filename
        (insert data))
      (kill-new filename)
      (rename-file filename (expand-file-name (file-name-nondirectory filename) "~"))
      (message filename)))
Provide Modules
(provide 'custom-ui)
;;; custom-ui.el ends here

Key Bindings

Global Key
  ;; Make ESC quit prompts
  (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
  ;; this annoying binding.
  (global-unset-key (kbd "C-j"))
  (global-unset-key (kbd "C-k"))
  (global-unset-key (kbd "S-SPC"))    ;; use only S-\
Which keys

When you begin a keybind, whichkey will show you all keybinds you can follow the first one with in order to form a full keywords.

  (use-package which-key
    :straight (:build t)
    :defer t
    :init (which-key-mode)
    :diminish which-key-mode
    :config
    (setq which-key-idle-delay 0.5))
General

for managing keybindings.

  (use-package general
    :straight (:build t)
    :init
    (general-auto-unbind-keys)
    :config
    (general-evil-setup t)
    (general-create-definer ju/leader-key-def
      :keymaps '(normal insert visual emacs)
      :prefix "SPC"
      :global-prefix "C-SPC"))

  (ju/leader-key-def
    "." 'find-file
    ;; Buffer
    "b" '(:ignore t :which-key "buffer handling")
    "b i" '(ibuffer :which-key "IBuffer")
    "b r" '(revert-buffer :which-key "Revert Buffer")
    "b k" '(kill-current-buffer :which-key "Kill current buffer")
    "b n" '(next-buffer :which-key "Next buffer")
    "b p" '(previous-buffer :which-key "Previous buffer")
    "b B" '(ibuffer-list-buffers :which-key "IBuffer List Buffers")
    "b K" '(kill-buffer :which-key "IBuffer Kill Buffers")
    ;; Eshell
    "e" '(:ignore t :which-key "eshell")
    "e h" '(counsel-esh-history :which-key "Kill history")
    "e s" '(eshell :which-key "run eshell")
    "e e" '(elfeed :which-key "elfeed")
    ;; Counsel
    "f" '(:ignore t :which-key "file op.")
    "f r" '(consult-recent-file :which-key "Recent files")
    ;; Shortcut
    "f o" '(:ignore t :which-key "dOt files")
    "f o d" '((lambda () (interactive) (find-file "~/.config/emacs/desktop.org")) :which-key "open exwm config")
    "f o p" '((lambda () (interactive) (find-file "~/org/example/emacs_my_previous.org")) :which-key "open exwm config")
    "f o e" '((lambda () (interactive) (find-file "~/org/example/emacs_another.org")) :which-key "open exwm config")
    "f o c" '((lambda () (interactive) (find-file "~/.config/emacs/emacs.org")) :which-key "open emacs config")
    ;; Insert something
    "i" '(:ignore t :which-key "insert something.")
    ;; Project-el
    "p" '(:ignore t :which-key "project")
    "p ." '(project-switch-project :which-key "switch project")
    "p p" '(project-switch-project :which-key "switch project")
    "p c" '(project-compile :which-key "compile")
    "p f" '(project-find-file :which-key "find-file")
    "p k" '(project-kill-buffers :which-key "kill buffers")
    "p s" '(project-shell :which-key "shell")
    "p e" '(project-eshell :which-key "eshell")
    "p d" '(project-dired :which-key "dired")
    "p g" '(project-find-regexp :which-key "find-regexp")
    ;; Extra
    "t" '(:ignore t :which-key "extra")
    "t a" '(toggle-transparency :which-key "Toggle Transparency")
    "t t" '(toggle-truncate-lines :which-key "Toggle truncate lines"))
Evil Mode
  (use-package evil
    :straight (:build t)
    :after general
    :init
    (setq evil-want-integration t
          evil-want-keybinding nil
          evil-want-C-u-scroll t
          evil-want-C-i-jump nil)
    ;;(setq evil-respect-visual-line-mode nil) ; t : on the screen, nil : by cr characters
    (require 'evil-vars)
    (evil-set-undo-system 'undo-tree)
    ;;(evil-set-undo-system 'undo-redo)

    ;; Make evil search more like vim (makes emacs slow)
    ;;(evil-select-search-module 'evil-search-module 'evil-search)

    :config
    (evil-mode 1)
    (setq evil-want-fine-undo t) ; more granular undo with evil
    (evil-set-initial-state 'messages-buffer-mode 'normal)
    (evil-set-initial-state 'dashboard-mode 'normal)
    ;; eshell no evil
    (dolist (mode '(eshell-mode))
      (add-to-list 'evil-emacs-state-modes mode)))

  (use-package evil-collection
    :after evil
    :straight (:build t)
    :config
    (evil-collection-init))

  (use-package evil-nerd-commenter
    :after evil
    :straight (:build t)
    :config
    ;; evil nerd commenter
    (define-key evil-normal-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)
    (define-key evil-visual-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines))

  (use-package evil-numbers
    :after evil
    :straight (:build t)
    :config
    ;; evil numbers
    ;; unfortunately C-x is emacs common key binding.
    (define-key evil-normal-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
    (define-key evil-normal-state-map (kbd "g -") 'evil-numbers/dec-at-pt)
    (define-key evil-visual-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
    (define-key evil-visual-state-map (kbd "g -") 'evil-numbers/dec-at-pt))
Undo Tree
  (use-package undo-tree
    :straight (:build t)
    :defer t
    :custom
    (undo-tree-history-directory-alist
     `(("." . ,(expand-file-name (file-name-as-directory "undo-tree-hist")
                                 user-emacs-directory))))
    :init
    (global-undo-tree-mode)
    :config
    (setq undo-tree-visualizer-diff       t
          undo-tree-visualizer-timestamps t
          undo-tree-auto-save-history     t
          undo-tree-enable-undo-in-region t
          undo-limit        (* 800 1024)
          undo-strong-limit (* 12 1024 1024)
          undo-outer-limit  (* 128 1024 1024)))
Hydra
  (use-package hydra
    :straight (:build t)
    :defer t)
  (defhydra hydra-text-scale (:timeout 4)
    "scale text"
    ("t" text-scale-increase "in")
    ("s" text-scale-decrease "out")
    ("q" nil "finished" :exit t))
  (defhydra hydra-writeroom-scale (:timeout 4)
    "scale whiteroom"
    ("t" writeroom-increase-width "enlarge")
    ("S" writeroom-decrease-width "shrink")
    ("r" writeroom-adjust-width "adjust")
    ("q" nil "finished" :exit t))
  (defhydra hydra-modify-alpha ()
    ("s" my/decrease-frame-alpha-background "decrease alpha")
    ("t" my/increase-frame-alpha-background "increase alpha")
    ("q" nil "finished" :exit t))
  (ju/leader-key-def
    ;; Hydra
    "h" '(:ignore t :which-key "hydra")
    "h t" '(hydra-text-scale/body :which-key "scale text")
    "h w" '(hydra-writeroom-scale/body :which-key "scale whiteroom")
    "h a" '(hydra-modify-alpha/body :which-key "modify alpha background"))
Provide Modules
(provide 'custom-keybindings)
;;; custom-keybindings.el ends here

Completion

config from crafted-emacs https://github.com/SystemCrafters/crafted-emacs

Vertico
  (use-package vertico
    :straight (:build t)
    :bind (:map vertico-map
                ("C-j" . vertico-next)
                ("C-k" . vertico-previous))
    :custom
    (vertico-cycle t)
    :init
    (vertico-mode))
Prescient

simple but effective sorting and filtering for emacs.

  (use-package vertico-prescient
    :straight (:build t)
    :defer t
    :config
    (vertico-prescient-mode))
Marginalia

annotations placed at the margin of the minibuffer

  (use-package vertico-prescient
    :straight (:build t)
    :defer t
    :custom (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
    :config (marginalia-mode 1))
Consult
  (use-package consult
    :straight (:build t)
    :demand t
    :bind (:map minibuffer-local-map
                ("C-r" . consult-history))
    :custom
    (completion-in-region-function #'consult-completion-in-region)
    :config
    (global-set-key (kbd "C-s") 'consult-line)
    (global-set-key (kbd "C-M-j") 'consult-buffer))
Orderless

orderless completion

  (use-package orderless
    :straight (:build t)
    :defer t
    :custom
    (completion-styles '(orderless basic))
    (completion-category-overrides '((file (style basic partial-completion)))))
Embark / Embark Consult

Quick Action in minibuffer

  (use-package embark
    :straight (:build t)
    :defer t
    :bind (("C-." . embark-act))
    :config
    (with-eval-after-load 'embark-consult
      (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
    (global-set-key [remap describe-bindings] #'embark-bindings)
    ;; Use Embark to show bindings in a key prefix with `C-h`
    (setq prefix-help-command #'embark-prefix-help-command))

  (use-package embark-consult
    :straight (:build t)
    :defer t
    :after embark)
Corfu / Cape
      ;;; Corfu
  (use-package corfu
    :straight (:build t)
    :custom
    (corfu-cycle t)                ;; Enable cycling for `corfu-next/previous'
    (corfu-auto t)                 ;; Enable auto completion
    (corfu-auto-prefix 2)
    (corfu-auto-delay 0.0)
    (corfu-echo-documentation 0.25)
    ;; (corfu-separator ?\s)          ;; Orderless field separator
    ;; (corfu-quit-at-boundary nil)   ;; Never quit at completion boundary
    ;; (corfu-quit-no-match nil)      ;; Never quit, even if there is no match
    ;; (corfu-preview-current nil)    ;; Disable current candidate preview
    ;; (corfu-preselect 'prompt)      ;; Preselect the prompt
    ;; (corfu-on-exact-match nil)     ;; Configure handling of exact matches
    ;; (corfu-scroll-margin 5)        ;; Use scroll margin
    :init
    (global-corfu-mode))

  ;; load extension
  (add-to-list 'load-path
               (expand-file-name "straight/build/corfu/extensions"
                                 straight-base-dir))
  (require 'corfu-popupinfo)
  (corfu-popupinfo-mode 1)
  (eldoc-add-command #'corfu-insert)
  (define-key corfu-map (kbd "M-p") #'corfu-popupinfo-scroll-down)
  (define-key corfu-map (kbd "M-n") #'corfu-popupinfo-scroll-up)
  (define-key corfu-map (kbd "M-d") #'corfu-popupinfo-toggle)

  ;;; Cape
  ;; Setup Cape for better completion-at-point support and more
  (use-package cape
    :straight (:build t)
    :config
    ;; Add useful defaults completion sources from cape
    (add-to-list 'completion-at-point-functions #'cape-file)
    (add-to-list 'completion-at-point-functions #'cape-dabbrev)
    (add-to-list 'completion-at-point-functions #'cape-ispell)
    ;; Silence the pcomplete capf, no errors or messages!
    ;; Important for corfu
    (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
    ;; Ensure that pcomplete does not write to the buffer
    ;; and behaves as a pure `completion-at-point-function'.
    (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
    (add-hook 'eshell-mode-hook
              (lambda () (setq-local corfu-quit-at-boundary t
                                     corfu-quit-no-match t
                                     corfu-auto nil)
                (corfu-mode))))
  (unless (display-graphic-p)
    (require 'corfu-terminal)
    (corfu-terminal-mode +1))
Provide Modules
(provide 'custom-completion)
;;; custom-completion.el ends here

Org Mode

Normal Function
configure org
  (setq org-directory "~/org") ; use for relative file location
  (use-package org
    :straight (:build t)
    :defer t
    :config
    (add-hook 'org-mode-hook #'org-indent-mode)
    (setq org-todo-keywords
          '((sequence "TODO(t)" "HOLD(h)" "|" "KILL(k)" "DONE(d)")))
    (setq org-ellipsis                       " ⤵"
          org-hide-emphasis-markers          t
          org-image-actual-width             600
          org-redisplay-inline-images        t
          org-display-inline-images          t
          org-startup-with-inline-images     "inlineimages"
          org-src-fontify-natively           t
          org-fontify-quote-and-verse-blocks t
          org-agenda-start-with-log-mode     t
          org-startup-indented               t
          org-startup-align-all-tables       t
          org-log-done                       'time
          org-log-into-drawer                "LOGBOOK"
          org-clock-into-drawer              "CLOCKING"
          org-lowest-priority                68)
    ;;(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.8))

    (setq org-use-sub-superscripts '{})
    ;; Do not ask when run code block
    (setq org-confirm-babel-evaluate nil)

    (custom-set-faces
     '(org-level-1 ((t (:height 1.7  :weight ultra-bold :foreground "#81a2be"))))         ;; :foreground "#81a2be"
     '(org-level-2 ((t (:height 1.6  :weight extra-bold :foreground "#b294bb"))))         ;; :foreground "#b294bb"
     '(org-level-3 ((t (:height 1.5  :weight bold :foreground "#b5bd68"))))               ;; :foreground "#b5bd68"
     '(org-level-4 ((t (:height 1.4  :weight semi-bold :foreground "#e6c547"))))          ;; :foreground "#e6c547"
     '(org-level-5 ((t (:height 1.3  :weight normal :foreground "#cc6666"))))             ;; :foreground "#cc6666"
     '(org-level-6 ((t (:height 1.2  :weight normal :foreground "#70c0ba"))))             ;; :foreground "#70c0ba"
     '(org-level-7 ((t (:height 1.1  :weight normal :foreground "#b77ee0"))))             ;; :foreground "#b77ee0"
     '(org-level-8 ((t (:height 1.0  :weight normal :foreground "#9ec400"))))
     '(org-document-title ((t (:height 2.0  :weight ultra-bold :foreground "#9ec400")))))
    ;; org latex preview scaled.
    (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.5))
    ;; odt -> docx
    (setq org-odt-preferred-output-format "docx" ;; opt -> docx
          org-export-with-sub-superscripts '{}   ;; ODT export to docx
          org-latex-compiler "xelatex"))
  (use-package org-contrib
    :straight (:build t)
    :after org
    :defer t)
Org fancy Priorities
  (use-package org-fancy-priorities
    :straight (:build t)
    :defer t
    :after (org all-the-icons)
    :hook (org-mode org-agenda-mode)
    :config
  (setq org-fancy-priorities-list `(,(all-the-icons-faicon "flag"     :height 1.1 :v-adjust 0.0)
                                    ,(all-the-icons-faicon "arrow-up" :height 1.1 :v-adjust 0.0)
                                    ,(all-the-icons-faicon "square"   :height 1.1 :v-adjust 0.0)
                                    ,(all-the-icons-faicon "ban"      :height 1.1 :v-adjust 0.0))))
Org superstar
  (use-package org-superstar
    :straight (:build t)
    :ensure t
    :hook (org-mode)
    :config
    (setq org-superstar-item-bullet-alist
          '((?+ . ?➢)
            (?* . ?✰)
            (?- . ?➸))))
Valign
12345678
일이삼사
  (use-package valign
    :straight (:build t)
    :defer t
    :custom
    (valign-fancy-bar t))
Emphasize text

bold : bold italic : italic unerline : unerline verbatim : verbatim code : code strike-through : strike-through

Org Appear
  (use-package org-appear
    :straight (:build t)
    :defer t
    :hook (org-mode)
    :config
    (setq org-appear-autoemphasis   t
          org-appear-autolinks      t
          org-appear-autoentities   t
          org-appear-autosubmarkers t))
Org fragtog
  (use-package org-fragtog
    :straight (:build t)
    :defer t
    :hook (org-mode))
Attachment
Org attach screenshot (linux)

to use org-screenshot-take

  (use-package org-attach-screenshot
    :straight (:build t)
    :defer t)
Org download

download image link

  (use-package org-download
    :straight (:build t))
ob-latex-as-png
  (use-package ob-latex-as-png
    :straight (:build t))
Example 1
\usepackage{neuralnetwork}
% in
\begin{neuralnetwork}[height=4]
  \newcommand{\x}[2]{$x_#2$}
  \newcommand{\y}[2]{$y_#2$}
  \newcommand{\hfirst}[2]{\small $h^{(1)}_#2$}
  \newcommand{\hsecond}[2]{\small $h^{(2)}_#2$}
  \newcommand{\mylinktext}[4] {
    % from layer=#1, from node=#2
    % to layer=#3, to node=#4
  \ifnum1=#1\relax
     \ifnum3=#4\relax $w^{#1}_{#4,#2}$ \fi
  \else \fi
  }
  % Then assign it:
  \setdefaultlinklabel{\mylinktext}
  \inputlayer[count=3, bias=false, title=Input\\layer, text=\x]
  \hiddenlayer[count=4, bias=false, title=Hidden\\layer 1, text=\hfirst] \linklayers
  \hiddenlayer[count=3, bias=false, title=Hidden\\layer 2, text=\hsecond] \linklayers
  \outputlayer[count=2, title=Output\\layer, text=\y] \linklayers
\end{neuralnetwork}

/JaeUs/dotfiles/media/commit/477b19e69f25793f08e22740ce16b3b8a392a9fe/.config/emacs/neural-networks.png

Example 2
   \smartdiagram[bubble diagram]{Emacs,Org-mode, \LaTeX, Pretty Images, HTML}
Example 3
\input GoudyIn.fd \input Acorn.fd
\def\light#1{\huge \usefont{U}{Acorn}{xl}{n} #1}
\def\thick#1{\fontsize{50}{60}\selectfont \usefont{U}{GoudyIn}{xl}{n} #1}
% \fontsize{X}{Y} ⇒ Write with point size X, using Y point size between lines

\pagecolor{brown}

\begin{picture}(124,60)
\put(0,0){\thick{ORG}}
\put(18,42){\light{JaeUs}}
\put(0,55){\rotatebox{-45}{\scriptsize \LaTeX}}
\put(109,43){\rotatebox{45}{\scriptsize \texttt{HTML}}}
\end{picture}

/JaeUs/dotfiles/media/commit/477b19e69f25793f08e22740ce16b3b8a392a9fe/.config/emacs/using-picture-environment.png

def-functions
  (defun my/org-remove-link-and-trash-linked-file ()
    "Remove `org-mode' link at point and trash linked file."
    (interactive)
    (let* ((link (org-element-context))
           (path (org-element-property :path link)))
      (move-file-to-trash path)
      (delete-region (org-element-property :begin link)
                     (org-element-property :end link))))
  (defun my/powershell (script)
    "executes the given script within a powershell and returns its return value"
    (call-process "powershell.exe" nil nil nil
                  "-Command" (concat "& {" script "}")))
  (defun my/as-windows-path (unix-path)
    "Takes a unix path and returns a matching WSL path"
    ;; substring removes the trailing \n
    (substring
     (shell-command-to-string
      (concat "wslpath -w " unix-path)) 0 -1))
  (defun my/org-paste-image-win2wsl ()
    "Paste an image into a time stamped unique-named file in the
          same directory as the org-buffer and insert a link to this file."
    (interactive)
    (let* ((target-file
            (concat
             (make-temp-name
              (concat org-directory
                      "/images/"
                      (f-filename buffer-file-name)
                      "_"
                      (format-time-string "%Y%m%d_%H%M%S_"))) ".png"))
           (wsl-path
            (concat (my/as-windows-path(file-name-directory target-file))
                    "/"
                    (file-name-nondirectory target-file)))
           (ps-script
            (concat "(Get-Clipboard -Format image).Save('" wsl-path "')")))

      (my/powershell ps-script)

      (if (file-exists-p target-file)
          (progn (insert (concat "[[" target-file "]]"))
                 (org-display-inline-images))
        (user-error
         "Error pasting the image, make sure you have an image in the clipboard!"))
      ))
Exporter
Hugo

my-blog jaeus.net

  (use-package ox-hugo
    :straight (:build t)
    :after ox)
TODO Engrave-faces

latex export code block

  ;;(usr-package-install 'engrave-faces)
  ;;(require 'engrave-faces)
  ;;(require 'engrave-faces-latex)
  ;;(setq org-latex-src-block-backend 'engraved)
Additional Functions
Org Journal
  (use-package org-journal
    :straight (:build t)
    :defer t
    :config
    (setq org-journal-dir (expand-file-name "journal/" org-directory))
    (setq org-journal-file-type 'weekly))
Org Roam
  • TODO: Project todos
  (use-package org-roam
    :straight (:build t)
    :ensure t
    :custom
    (org-roam-directory "~/org/roam")
    (org-roam-completion-everywhere t)
    :config
    (org-roam-db-autosync-mode))
  ;;(my/org-roam-refresh-agenda-list)

  ;; Org roam ui
  (use-package org-roam-ui
    :straight (:build t)
    :defer t
    :config
    (setq org-roam-ui-sync-theme t
          org-roam-ui-follow t
          org-roam-ui-update-on-save t
          org-roam-ui-open-on-start nil))
  ;;:desc "org roam refresh agenda list"
  ;;"oar" 'my/org-roam-refresh-agenda-list
  ;;:desc "org roam find tag:project"
  ;;"nrp" 'my/org-roam-find-project
  ;;:desc "org roam find with ripgrep (preview)"
  ;;"nrg" 'my/org-roam-rg-search)
Org Agenda
(setq org-agenda-files (list "~/org/agenda/agenda.org"))
Org Super Agenda
  (use-package org-super-agenda
    :straight (:build t)
    :defer t
    :init
    (org-super-agenda-mode 1)
    :config
    (setq org-agenda-custom-commands
          '(("z" "Org mode super agenda"
             ((alltodo "" ((org-agenda-overriding-header "")
                           (org-super-agenda-groups
                            '((:name "Important"
                                     :tag "Important"
                                     :priority "A"
                                     :order 6)
                              (:name "Due Today"
                                     :deadline today
                                     :order 2)
                              (:name "Due Soon"
                                     :deadline future
                                     :order 8)
                              (:name "Overdue"
                                     :deadline past
                                     :order 7)
                              (:name "Projects"
                                     :tag "Project"
                                     :order 14)
                              (:name "To read"
                                     :tag "Read"
                                     :order 30)
                              (:name "Waiting"
                                     :todo "WAIT"
                                     :order 20)
                              (:name "Holding"
                                     :todo "HOLD"
                                     :order 21)
                              (:name "trivial"
                                     :priority<= "C"
                                     :tag ("Trivial" "Unimportant")
                                     :order 90)
                              (:discard (:tag ("Chore" "Routine" "Daily"))))))))))))
Tools
ob-async

asynchronous execution of org-babel src blocks

  (use-package ob-async
    :straight (:build t)
    :defer t)

some language should add

(setq ob-async-no-async-languages-alist '("ipython"))
Org PDF tools

get link from pdf,

    (use-package org-pdftools
      :straight (:build t)
      :defer t
      :hook (org-mode . org-pdftools-setup-link))
Keybindings
  (ju/leader-key-def
    ;; Org mode
    "o" '(:ignore t :which-key "Org mode")
    "o a" '(:ignore t :which-key "Org Agenda")
    "o a a" '(org-agenda :which-key "open org agenda")
    "o a r" '(my/org-roam-refresh-agenda-list :which-key "Org agenda refresh list")
    "o a c" '((lambda () (interactive) (find-file (expand-file-name "agenda/agenda.org" org-directory))) :which-key "org agenda file")
    "o c" '(cfw:open-org-calendar :which-key "org calendar"))
  (ju/leader-key-def
    "n j" '(:ignore t :which-key "Org Journal")
    "n j j" '(org-journal-new-entry :which-key "new Entry")
    "n j J" '(org-journal-new-scheduled-entry :which-key "New Scheduled entry")
    "n j s" '(org-journal-search :which-key "Journal Search"))
  (ju/leader-key-def
    "n r" '(:ignore t :which-key "Org Roam")
    "n r u" 'org-roam-ui-open
    "n r l" 'org-roam-buffer-toggle
    "n r f" 'org-roam-node-find
    "n r i" 'org-roam-node-insert
    "n r I" 'org-roam-node-insert-immediate
    "n r p" 'my/org-roam-find-project)
Provide Modules
  (provide 'custom-org)
  ;;; custom-org.el ends here

Projects

MAGIT
  (use-package magit
    :straight (:build t)
    :defer t
    :commands (magit-status magit-get-current-branch)
    :custom
    (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
    :config
    (setq magit-clone-default-directory "~/Project/"))
  (ju/leader-key-def
    ;; Magit
    "g" '(:ignore t :which-key "magit")
    "g g" '(magit :which-key "magit"))
Gitgutter
  (use-package git-gutter
    :straight (:build t)
    :defer t
    :init (global-git-gutter-mode)
    :config
    (setq git-gutter:update-interval 2))
Forge

Git forge

Highlight TODOs
TODO: test
  (use-package hl-todo
    :straight (:build t)
    :defer t
    :init (global-hl-todo-mode 1)
    :config
    (setq hl-todo-keyword-faces
          `(;; For things that need to be done, just not today.
            ("TODO" warning bold)
            ;; For problems that will become bigger problems later if not
            ;; fixed ASAP.
            ("FIXME" error bold)
            ;; For tidbits that are unconventional and not intended uses of the
            ;; constituent parts, and may break in a future update.
            ("HACK" font-lock-constant-face bold)
            ;; For things that were done hastily and/or hasn't been thoroughly
            ;; tested. It may not even be necessary!
            ("REVIEW" font-lock-keyword-face bold)
            ;; For especially important gotchas with a given implementation,
            ;; directed at another user other than the author.
            ("NOTE" success bold)
            ;; For things that just gotta go and will soon be gone.
            ("DEPRECATED" font-lock-doc-face bold)
            ;; For a known bug that needs a workaround
            ("BUG" error bold)
            ;; For warning about a problematic or misguiding code
            ("XXX" font-lock-constant-face bold))))
Magit TODOs
  (use-package magit-todos
    :straight (:build t)
    :defer t
    :after (magit hl-todo)
    :hook (magit-mode))
Provide Modules
  (provide 'custom-projects)
  ;;; custom-projects.el ends here

Workspaces

Tabspace
  ;;(use-package tabspaces
  ;;  :disabled
  ;;  ;; use this next line only if you also use straight, otherwise ignore it.
  ;;  :straight (:type git :host github :repo "mclear-tools/tabspaces")
  ;;  :hook (after-init . tabspaces-mode) ;; use this only if you want the minor-mode loaded at startup.
  ;;  :commands (tabspaces-switch-or-create-workspace
  ;;             tabspaces-open-or-create-project-and-workspace)
  ;;  :custom
  ;;  (tabspaces-use-filtered-buffers-as-default t)
  ;;  (tabspaces-default-tab "Default")
  ;;  (tabspaces-remove-to-default t)
  ;;  (tabspaces-include-buffers '("*scratch*"))
  ;;  ;; sessions
  ;;  (tabspaces-session t)
  ;;  (tabspaces-session-auto-restore t)
  ;;  :config
  ;;  (ju/leader-key-def
  ;;    "TAB" '(tabspaces-command-map :which-key "tabspaces-command-map")))
Perspective
  ;;(use-package perspective
  ;;  :disabled
  ;;  :demand t
  ;;  :bind (("C-M-j" . consult-buffer)
  ;;         ("C-M-k" . persp-switch)
  ;;         ("C-M-n" . persp-next)
  ;;         ("C-x k" . persp-kill-buffer*))
  ;;  :custom
  ;;  (persp-initial-frame-name "Main")
  ;;  (persp-mode-prefix-key (kbd "C-c p"))
  ;;  :config
  ;;  (ju/leader-key-def
  ;;    "TAB" '(perspective-map :which-key "perspective"))
  ;;  ;; Running `persp-mode' multiple times resets the perspective list...
  ;;  (unless (equal persp-mode t)
  ;;    (persp-mode)))
  ;;(provide 'custom-workspaces)
    ;;; custom-workspaces.el ends here

Latex

AUCTEX

writing and formatting tex file in Emacs.

  (use-package auctex
    :straight (:build t)
    :defer t
    :custom
    (TeX-auto-save t)
    (TeX-parse-self t)
    ;; to use pdfview with auctex
    (TeX-view-program-selection '((output-pdf "PDF Tools")))
    (TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)))
    (TeX-source-correlate-start-server t)
    ;; electric pairs in auctex
    (TeX-electric-sub-and-superscript t)
    (LaTeX-electric-left-right-brace t)
    (TeX-electric-math (cons "$" "$"))
    :config
    (setq-default TeX-master nil)
    ;; compile to pdf
    (tex-pdf-mode)
    ;; correlate the source and the output
    (TeX-source-correlate-mode)
    ;; set a correct indentation in a few additional environments
    (add-to-list 'LaTeX-indent-environment-list '("lstlisting" current-indentation))
    (add-to-list 'LaTeX-indent-environment-list '("tikzcd" LaTeX-indent-tabular))
    (add-to-list 'LaTeX-indent-environment-list '("tikzpicture" current-indentation))
    ;; add a few macros and environment as verbatim
    (add-to-list 'LaTeX-verbatim-environments "lstlisting")
    (add-to-list 'LaTeX-verbatim-environments "Verbatim")
    (add-to-list 'LaTeX-verbatim-macros-with-braces "lstinline")
    (add-to-list 'LaTeX-verbatim-macros-with-delims "lstinline")

    ;; open all buffers with the math mode and auto-fill mode
    (add-hook 'LaTeX-mode-hook #'auto-fill-mode)
    (add-hook 'LaTeX-mode-hook #'LaTeX-math-mode)

    ;; add support for references
    (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
    (customize-set-variable 'reftex-plug-into-AUCTeX t)

    ;; to have the buffer refresh after compilation
    (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
Cdlatex

speed-up insertion of environments and math templates.

  (use-package cdlatex
    :straight (:build t)
    :hook
    ((org-mode . org-cdlatex-mode)
     (LaTex-mode . cdlatex-mode))
    :config
    (setq cdlatex-use-dollar-to-ensure-math nil))
Preview pane
  (use-package latex-preview-pane
    :straight (:build t)
    :ensure t)
Provide Modules
  (provide 'custom-latex)
  ;;; custom-latex.el ends here

Extra

Helpful
  (use-package helpful
    :straight (:build t)
    :defer t
    :custom
    (counsel-describe-function-function #'helpful-callable)
    (counsel-describe-variable-function #'helpful-variable))
  ;;:commands (helpful-callable helpful-variable helpful-command helpful-key)
  (global-set-key [remap describe-function] #'describe-function)
  (global-set-key [remap describe-command] #'helpful-command)
  (global-set-key [remap describe-variable] #'describe-variable)
  (global-set-key [remap describe-key] #'helpful-key)
Avy
  (use-package avy
    :straight (:build t)
    :defer t
    :config
    (setq avy-all-windows t))
  (ju/leader-key-def
    "v" '(:ignore t :which-key "Avy")
    "vc" '(avy-goto-char :which-key "Avy Goto Char")
    "vw" '(avy-goto-word-0 :which-key "Avy Goto Word")
    "vl" '(avy-goto-line :which-key "Avy Goto Line"))
Snippet
  (use-package yasnippet
    :straight (:build t)
    :defer t
    :hook (prog-mode . yas-minor-mode)
    :config
  (defvar yas-snippet-dirs nil)
  (add-to-list 'yas-snippet-dirs "~/.config/emacs/snippets")
  (yas-global-mode 1))
  (ju/leader-key-def
    "i s" '(yas-insert-snippet :which-key "snippet"))
Emojify
  (use-package emojify
    :straight (:build t)
    :defer t
    :init (global-emojify-mode 1))
  (ju/leader-key-def
    "i e" '(emojify-insert-emoji :which-key "emoji"))
PDF Tool

enhanced PDF viewer on emacs

  (use-package pdf-tools
    :defer t
    :config
    (pdf-tools-install :no-query)
    (setq-default pdf-view-display-size 'fit-width))
PDF view restore
  (use-package pdf-view-restore
    :straight (:build t)
    :defer t
    :hook (pdf-view-mode . pdf-view-restore-mode)
    :config
    (setq pdf-view-restore-filename (expand-file-name ".tmp/pdf-view-restore"
                                                      user-emacs-directory)))
Nov
  (use-package nov
    :straight (:build t)
    :defer t
    :config
    (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
Openwith
  (use-package openwith
    :straight (:build t)
    :defer t
    :config
    (openwith-mode t)
    (setq larget-file-warning-threshold nil)
    (setq openwith-associations
          (list (list (openwith-make-extension-regexp
                       '("mpg" "mpeg" "mp3" "mp4" "m4v"
                         "avi" "wmv" "wav" "mov" "flv"
                         "ogm" "ogg" "mkv"))
                      "mpv"
                      '(file)))
          (list (openwith-make-extension-regexp
                 '("pdf"))
                "zathura"
                '(file))))
  ;;(list (openwith-make-extension-regexp
  ;;       '("html" "htm"))
  ;;      "qutebrowser"
  ;;      '(file))))
Calfw

calendar

  (use-package calfw
    :straight (:build t)
    :defer t)
ELFEED
  (use-package elfeed
    :straight (:build t)
    :defer t)
  (use-package elfeed-goodies
    :straight (:build t)
    :defer t)
  (use-package elfeed-org
    :straight (:build t)
    :defer t
    :config
    (elfeed-org)
    (setq rmh-elfeed-org-files (list (expand-file-name "elfeed.org" user-emacs-directory))))
Provide Modules
  (provide 'custom-extra)
  ;;; custom-extra.el ends here

Languages

Treesitter
  ;;(if (version< emacs-version "29")
  ;;(use-package tree-sitter
  ;;  :straight (:build t)
  ;;  :defer t
  ;;  :init (global-tree-sitter-mode))
  ;;(use-package tree-sitter-langs
  ;;  :straight (:build t)
  ;;  :defer t
  ;;  :after tree-sitter))
eglot
  (if (version< emacs-version "29")
      (use-package eglot
        :straight (:build t)
        :defer t))
Rust
  (use-package rust-mode
    :straight (:build t)
    :defer t)
Python
  (use-package jupyter
    :straight (:build t))
CMAKE
  ;;(use-package cmake-mode
  ;;  :straight (:build t)
  ;;  :defer t)
Haskell
  (use-package haskell-mode
    :straight (:build t)
    :defer t)
Markdown
  (use-package markdown-mode
    :straight (:build t)
    :defer t
    :config
    (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
    (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
    (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
    (setq markdown-command "multimarkdown"))
PKGBUILD
  (use-package pkgbuild-mode
    :straight (:build t)
    :defer t)
Systemd
  (use-package systemd
    :straight (:build t)
    :defer t)
Toml
  (use-package toml-mode
    :straight (:build t)
    :defer t
    :config
    (add-to-list 'auto-mode-alist '("/\\(Cargo.lock\\|\\.cargo/config\\)\\'" . toml-mode)))
Gnuplot
  (use-package gnuplot
    :straight (:build t)
    :defer t)
Graphviz dot Mode

org mode graph drawing with graphviz

  (use-package graphviz-dot-mode
    :straight (:build t)
    :defer t)
Verilog Indent

LSP -> veriloter

  (custom-set-variables
   '(verilog-indent-level 4)
   '(verilog-indent-level-module 0)
   '(verilog-indent-level-declaration 0)
   '(verilog-indent-level-behavioral 0)
   '(verilog-indent-level-directive 0)
   '(verilog-cexp-indent 0)
   '(verilog-case-indent 4)

   '(verilog-auto-newline nil))
Default
  (with-eval-after-load 'org
    (org-babel-do-load-languages
     'org-babel-load-languages
     '((emacs-lisp . t)
       (python . t)
       (jupyter . t)
       (dot . t)
       (latex . t)))
    (org-babel-jupyter-override-src-block "python")
    (push '("conf-unix" . conf-unix) org-src-lang-modes)
    ;; This is needed as of Org 9.2
    (require 'org-tempo)

    (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
    (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
    (add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
    (add-to-list 'org-structure-template-alist '("cc" . "src c"))
    (add-to-list 'org-structure-template-alist '("cp" . "src c++"))
    (add-to-list 'org-structure-template-alist '("rs" . "src rust"))
    (add-to-list 'org-structure-template-alist '("py" . "src python"))
    (add-to-list 'org-structure-template-alist '("oc" . "src octave"))
    (add-to-list 'org-structure-template-alist '("vl" . "src verilog"))
    (add-to-list 'org-structure-template-alist '("vh" . "src vhdl"))
    (org-reload))
Provide modules
  (provide 'custom-languages)
  ;;; custom-languages.el ends here