Emacs Config

My not so Extremely Minimal Alt + Ctrl + Shift.
This post doesn’t strictly follow the most recent version.
That’s available on Github.
Prefer Built-in packages over 3rd Party ones.

Basics

Fix Scope

;; -*- coding: utf-8 lexical-binding: t; -*-

Custom.el

Prevent custom-set-variables and custom-set-faces wrote inside init.el

;; Remove Custom Section
(setq custom-file (concat user-emacs-directory "custom.el"))
(when (file-exists-p custom-file)
	(load custom-file))

Initialize Packages

Setup

(require 'use-package)
(use-package package
	:config
	(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
	(package-initialize)
	(unless package-archive-contents
	(package-refresh-contents)))

Emacs

Use Use-package for customizing Emacs and 3rd party packages.

(use-package emacs
	:custom
	(user-full-name "WooHyung Jeon")
	(user-mail-address "jeon@ptrtoj.com")
	(visible-bell t)
	(inhibit-startup-screen t)
	(inhibit-startup-message t)
	(inhibit-startup-echo-area-message t)
	(initial-major-mode 'fundamental-mode)
	(defalias 'yes-or-no-p 'y-or-n-p))

UI

Themes

Currently, using N Λ N O Theme. See below, 3rd Party Packages section.

(use-package custom
	:config
	;;(load-theme 'modus-operandi t)
	(load-theme 'leuven t))

Fonts

(use-package faces
	:config
	(set-face-attribute 'font-lock-comment-face nil :slant 'italic)
	(set-face-attribute 'font-lock-keyword-face nil :slant 'italic)
	(add-to-list 'default-frame-alist '(font . "Berkeley Mono")))

Disable Unnecessaries

Tool Bar

(use-package tool-bar
	:config
	(tool-bar-mode -1))

Tooltip

(use-package tooltip
	:config
	(tooltip-mode -1))
(use-package menu-bar
	:config
	(menu-bar-mode -1))

Whitespaces

(use-package whitespace
	:hook
	(before-save . whitespace-cleanup))

Simple

(use-package simple
	:config
	(column-number-mode 1)
	:hook
	(before-save . delete-trailing-whitespace))

Line Numbers

(use-package display-line-numbers
	:custom
	(display-line-numbers-type 'relative)
	:config
	(global-display-line-numbers-mode 1)
	(dolist (mode '(term-mode-hook
		shell-mode-hook
		eshell-mode-hook))
	(add-hook mode (lambda () (display-line-numbers-mode -1)))))

Fill Column

(use-package display-fill-column-indicator
	:config
	(global-display-fill-column-indicator-mode 1))

Highlight Line

(use-package hl-line
	:config
	(global-hl-line-mode 1))

Frame

Currently, not using.

(use-package frame
	:config
	;; Transparency
	(set-frame-parameter (selected-frame) 'alpha '(90 . 85))
	(add-to-list 'default-frame-alist '(alpha . ( 90 . 85)))
	;; Fullscreen when open Emacs
	(add-to-list 'default-frame-alist '(fullscreen . maximized)))

Files

(use-package files
	:custom
	(make-backup-files nil))

Recent Files

(use-package recentf
	:config
	(recentf-mode 1)
	:bind
	("C-x C-r" . recentf-open-files))

Auto Revert

(use-package autorevert
	:custom
	(global-auto-revert-non-file-buffers t))

Save history

(use-package savehist
	:config
	(savehist-mode 1))

Custom Key Bindings

which doesn’t belong anywhere.

(use-package bind-keys
	:bind
	;; Changed the same keybinding to 'auto-package-update-now'
	;; See, 'auto-package-update' section below
	;;("C-c p" . package-refresh-contents)
	("C-c k" . describe-personal-keybindings))

LSP

(use-package eglot
	:hook
	(prog-mode . eglot-ensure))

Parenthesis Paring

(use-package elec-pair
	:hook
	(prog-mode . electric-pair-mode)
	(org-mode . electric-pair-mode))

C Language Specific

in Emacs

(use-package cc-vars
	:custom
	(c-default-style "k&r")
	(c-basic-offset 4)
	:hook
	(c-mode . (lambda () (local-set-key (kbd "C-c C-c") 'compile))))

Eldoc

(use-package eldoc
	:diminish
	:hook
	(emacs-lisp-mode . turn-on-eldoc-mode))

Abbrev

(use-package abbrev
	:diminish)

3rd Party Packages

Auto Update

Automatically update Emacs packages with auto-package-update.

(use-package auto-package-update
	:ensure t
	:config
	(setq auto-package-update-prompt-before-update t)
	(setq auto-package-update-delete-old-versions t)
	:bind
	("C-c p" . auto-package-update-now))

Diminish

Hide minor modes with diminish.

(use-package diminish
	:ensure t)

Which Key

Display available keybindings with emacs-which-key.

(use-package which-key
	:ensure t
	:diminish
	:config
	(which-key-mode 1))

Fix path

Fix path problems occur in MacOS by exec-path-from-shell.

(use-package exec-path-from-shell
	:ensure t
	:config
	(when (memq window-system '(mac ns x))
	(exec-path-from-shell-initialize)))

Code Completion

Modular in-buffer completion framework for Emacs by company-mode.

(use-package company
	:ensure t
	:diminish
	:hook
	(prog-mode . company-mode)
	(org-mode . company-mode))

Markdown

Major mode for editing markdown formatted text by markdown-mode.

(use-package markdown-mode
	:ensure t)

Orgmode Table of Contents

Insert table of contents inside org documents with toc-org.

(use-package toc-org
	:ensure t
	:diminish
	:hook
	(org-mode . toc-org-mode))

Apprearance

Theme

A consistent theme for GNU Emacs by N Λ N O Theme.

(use-package nano-theme
	:ensure t
	:config
	(load-theme 'nano-light t))

Indent Guide

Show vertical lines to guide indentation by indent-guide.

(use-package indent-guide
	:ensure t
	:diminish
	:custom
	(indent-guide-delay 0.5)
	(indent-guide-char " ")
	:config
	(set-face-background 'indent-guide-face "#F0F0F0")
	(indent-guide-global-mode 1))