First steps to a lean config

This commit is contained in:
Mark van der Putten 2024-05-25 22:49:04 +02:00
commit 8da726a5fc
26 changed files with 195857 additions and 0 deletions

66
early-init.el Normal file
View File

@ -0,0 +1,66 @@
;;; early-init.el --- -*- lexical-binding: t -*-
;;
;; Filename: early-init.el
;; Description: Early initialization
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Sun Jun 9 17:58:05 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d init early-init
;; Compatibility: emacs-version >= 27
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Emacs27 introduces early-init.el, which is run before init.el,
;; before package and UI initialization happens.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; DeferGC
(setq gc-cons-threshold 100000000)
;; -DeferGC
;; UnsetPES
(setq package-enable-at-startup nil)
;; -UnsetPES
;; UnsetFNHA
(defvar file-name-handler-alist-original file-name-handler-alist)
(setq file-name-handler-alist nil)
;; -UnsetFNHA
;; UnsetSRF
(setq site-run-file nil)
;; -UnsetSRF
;; DisableUnnecessaryInterface
(menu-bar-mode -1)
(unless (and (display-graphic-p) (eq system-type 'darwin))
(push '(menu-bar-lines . 0) default-frame-alist))
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
;; -DisableUnnecessaryInterface
(provide 'early-init)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; early-init.el ends here

45
elisp/init-ace-window.el Normal file
View File

@ -0,0 +1,45 @@
;;; init-ace-window.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-ace-window.el
;; Description: Initialize Ace-Window
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Apr 23 10:00:42 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d ace-window
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes ace-window
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; AceWindowPac
(use-package ace-window
:bind ("C-x C-o" . ace-window))
;; -AceWindowPac
(provide 'init-ace-window)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-ace-window.el ends here

59
elisp/init-adoc.el Normal file
View File

@ -0,0 +1,59 @@
;;; init-adoc.el ---
;;
;; Filename: init-adoc.el
;; Description:
;; Author: Mark van der Putten
;; Maintainer:
;; Copyright (C) 2019 Mark van der Putten
;; Created: Wed Feb 14 10:37:30 2024 (+0100)
;; Version:
;; Package-Requires: ()
;; Last-Updated:
;; By:
;; Update #: 17
;; URL:
;; Doc URL:
;; Keywords:
;; Compatibility:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change Log:
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(use-package adoc-mode
:ensure t
:custom-face
(adoc-meta-hide-face ((t (:foreground "LightPink"))))
(adoc-list-face ((t (:foreground "cyan1"))))
:hook (adoc-mode . (lambda () (electric-indent-local-mode -1)))
)
(provide 'init-adoc)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-adoc.el ends here

56
elisp/init-avy.el Normal file
View File

@ -0,0 +1,56 @@
;;; init-avy.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-avy.el
;; Description: Initialize Avy
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 11:12:49 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d avy
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes avy
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-global-config))
;; AvyPac
(use-package avy
:defer t
:bind
(("C-z c" . avy-goto-char-timer)
("C-z l" . avy-goto-line))
:custom
(avy-timeout-seconds 0.3)
(avy-style 'pre)
:custom-face
(avy-lead-face ((t (:background "#51afef" :foreground "#870000" :weight bold)))));
;; -AvyPac
(provide 'init-avy)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-avy.el ends here

63
elisp/init-buffer.el Normal file
View File

@ -0,0 +1,63 @@
;;; init-buffer.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-buffer.el
;; Description: Initialize ibuffer and ibuffer-vc
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Feb 6 16:25:12 2020 (-0500)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This file initializes ibuffer and ibuffer-vc
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; IBufferPac
(use-package ibuffer
:ensure nil
:bind ("C-x C-b" . ibuffer)
:init
(use-package ibuffer-vc
:commands (ibuffer-vc-set-filter-groups-by-vc-root)
:custom
(ibuffer-vc-skip-if-remote 'nil))
:custom
(ibuffer-formats
'((mark modified read-only locked " "
(name 35 35 :left :elide)
" "
(size 9 -1 :right)
" "
(mode 16 16 :left :elide)
" " filename-and-process)
(mark " "
(name 16 -1)
" " filename))))
;; -IBufferPac
(provide 'init-buffer)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-buffer.el ends here

80
elisp/init-const.el Normal file
View File

@ -0,0 +1,80 @@
;;; init-const.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-const.el
;; Description: Initialize Constants
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Mar 18 14:20:54 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d constants
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes constants
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; UserInfo
(setq user-full-name "Mark van der Putten")
(setq user-mail-address "mark.van.der.putten@intemo.com")
;; -UserInfo
;; Consts
(defconst *sys/win32*
(eq system-type 'windows-nt)
"Are we running on a WinTel system?")
(defconst *sys/linux*
(eq system-type 'gnu/linux)
"Are we running on a GNU/Linux system?")
(defconst *sys/mac*
(eq system-type 'darwin)
"Are we running on a Mac system?")
(defconst python-p
(or (executable-find "python3")
(and (executable-find "python")
(> (length (shell-command-to-string "python --version | grep 'Python 3'")) 0)))
"Do we have python3?")
(defconst pip-p
(or (executable-find "pip3")
(and (executable-find "pip")
(> (length (shell-command-to-string "pip --version | grep 'python 3'")) 0)))
"Do we have pip3?")
(defconst clangd-p
(or (executable-find "clangd") ;; usually
(executable-find "/usr/local/opt/llvm/bin/clangd")) ;; macOS
"Do we have clangd?")
(defconst eaf-env-p
(and (display-graphic-p) python-p pip-p)
"Do we have EAF environment setup?")
;; -Consts
(provide 'init-const)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-const.el ends here

57
elisp/init-crux.el Normal file
View File

@ -0,0 +1,57 @@
;;; init-crux.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-crux.el
;; Description: Initialize Crux
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Dec 24 13:15:38 2019 (-0500)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d crux
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes Crux
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; CruxPac
(use-package crux
:bind
(("C-a" . crux-move-beginning-of-line)
("C-x 4 t" . crux-transpose-windows)
("C-x K" . crux-kill-other-buffers)
("C-k" . crux-smart-kill-line)
("C-S-k" . crux-kill-line-backwards)
)
:config
(crux-with-region-or-buffer indent-region)
(crux-with-region-or-buffer untabify)
(crux-with-region-or-point-to-eol kill-ring-save)
(defalias 'rename-file-and-buffer #'crux-rename-file-and-buffer)
)
;; -CruxPac
(provide 'init-crux)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-crux.el ends here

89
elisp/init-dired.el Normal file
View File

@ -0,0 +1,89 @@
;;; init-dired.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-dired.el
;; Description: Initialize Dired and Related Configurations
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 11:37:00 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d dired auto-save
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes dired, super-save, disk-usage
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; DiredPackage
(use-package dired
:ensure nil
:bind
(("C-x C-j" . dired-jump))
:custom
;; Always delete and copy recursively
(dired-listing-switches "-lah")
(dired-recursive-deletes 'always)
(dired-recursive-copies 'always)
;; Auto refresh Dired, but be quiet about it
(global-auto-revert-non-file-buffers t)
(auto-revert-verbose nil)
;; Quickly copy/move file in Dired
(dired-dwim-target t)
;; Move files to trash when deleting
(delete-by-moving-to-trash t)
;; Load the newest version of a file
(load-prefer-newer t)
;; Detect external file changes and auto refresh file
(auto-revert-use-notify nil)
(auto-revert-interval 3) ; Auto revert every 3 sec
:config
;; Enable global auto-revert
(global-auto-revert-mode t)
;; Reuse same dired buffer, to prevent numerous buffers while navigating in dired
(put 'dired-find-alternate-file 'disabled nil)
:hook
(dired-mode . (lambda ()
(local-set-key (kbd "<mouse-2>") #'dired-find-alternate-file)
(local-set-key (kbd "RET") #'dired-find-alternate-file)
(local-set-key (kbd "^")
(lambda () (interactive) (find-alternate-file ".."))))))
;; -DiredPackage
;; DiskUsage
(use-package disk-usage
:commands (disk-usage))
;; -DiskUsage
;; SaveAllBuffers
(defun save-all-buffers ()
"Instead of `save-buffer', save all opened buffers by calling `save-some-buffers' with ARG t."
(interactive)
(save-some-buffers t))
(global-set-key (kbd "C-x C-s") nil)
(global-set-key (kbd "C-x C-s") #'save-all-buffers)
;; -SaveAllBuffers
(provide 'init-dired)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-dired.el ends here

View File

@ -0,0 +1,45 @@
;;; init-discover-my-major.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-discover-my-major.el
;; Description: Initialize Discover-My-Major
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 15:38:29 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d discover-my-major
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes discover-my-major
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; DiscMyMajor
(use-package discover-my-major
:bind ("C-h C-m" . discover-my-major))
;; -DiscMyMajor
(provide 'init-discover-my-major)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-discover-my-major.el ends here

198
elisp/init-func.el Normal file
View File

@ -0,0 +1,198 @@
;;; init-func.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-func.el
;; Description: Initialize Functions
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Sun Jun 9 17:53:44 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This file initializes functions
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-global-config))
;; ResizeWidthHeight
;; Resizes the window width based on the input
(defun resize-window-width (w)
"Resizes the window width based on W."
(interactive (list (if (> (count-windows) 1)
(read-number "Set the current window width in [1~9]x10%: ")
(error "You need more than 1 window to execute this function!"))))
(message "%s" w)
(window-resize nil (- (truncate (* (/ w 10.0) (frame-width))) (window-total-width)) t))
;; Resizes the window height based on the input
(defun resize-window-height (h)
"Resizes the window height based on H."
(interactive (list (if (> (count-windows) 1)
(read-number "Set the current window height in [1~9]x10%: ")
(error "You need more than 1 window to execute this function!"))))
(message "%s" h)
(window-resize nil (- (truncate (* (/ h 10.0) (frame-height))) (window-total-height)) nil))
;; Setup shorcuts for window resize width and height
(global-set-key (kbd "C-z w") #'resize-window-width)
(global-set-key (kbd "C-z h") #'resize-window-height)
(defun resize-window (width delta)
"Resize the current window's size. If WIDTH is non-nil, resize width by some DELTA."
(if (> (count-windows) 1)
(window-resize nil delta width)
(error "You need more than 1 window to execute this function!")))
;; Setup shorcuts for window resize width and height
(defun window-width-increase ()
(interactive)
(resize-window t 5))
(defun window-width-decrease ()
(interactive)
(resize-window t -5))
(defun window-height-increase ()
(interactive)
(resize-window nil 5))
(defun window-height-decrease ()
(interactive)
(resize-window nil -5))
(global-set-key (kbd "M-W =") #'window-width-increase)
(global-set-key (kbd "M-W M-+") #'window-width-increase)
(global-set-key (kbd "M-W -") #'window-width-decrease)
(global-set-key (kbd "M-W M-_") #'window-width-decrease)
(global-set-key (kbd "M-E =") #'window-height-increase)
(global-set-key (kbd "M-E M-+") #'window-height-increase)
(global-set-key (kbd "M-E -") #'window-height-decrease)
(global-set-key (kbd "M-E M-_") #'window-height-decrease)
;; -ResizeWidthheight
;; EditConfig
(defun edit-configs ()
"Opens the README.org file."
(interactive)
(find-file "~/.emacs.d/init.org"))
(global-set-key (kbd "C-z e") #'edit-configs)
;; -EditConfig
;; OrgIncludeAuto
(defun save-and-update-includes ()
"Update the line numbers of #+INCLUDE:s in current buffer.
Only looks at INCLUDEs that have either :range-begin or :range-end.
This function does nothing if not in `org-mode', so you can safely
add it to `before-save-hook'."
(interactive)
(when (derived-mode-p 'org-mode)
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp
"^\\s-*#\\+INCLUDE: *\"\\([^\"]+\\)\".*:range-\\(begin\\|end\\)"
nil 'noerror)
(let* ((file (expand-file-name (match-string-no-properties 1)))
lines begin end)
(forward-line 0)
(when (looking-at "^.*:range-begin *\"\\([^\"]+\\)\"")
(setq begin (match-string-no-properties 1)))
(when (looking-at "^.*:range-end *\"\\([^\"]+\\)\"")
(setq end (match-string-no-properties 1)))
(setq lines (decide-line-range file begin end))
(when lines
(if (looking-at ".*:lines *\"\\([-0-9]+\\)\"")
(replace-match lines :fixedcase :literal nil 1)
(goto-char (line-end-position))
(insert " :lines \"" lines "\""))))))))
(add-hook 'before-save-hook #'save-and-update-includes)
(defun decide-line-range (file begin end)
"Visit FILE and decide which lines to include.
BEGIN and END are regexps which define the line range to use."
(let (l r)
(save-match-data
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(if (null begin)
(setq l "")
(search-forward-regexp begin)
(setq l (line-number-at-pos (match-beginning 0))))
(if (null end)
(setq r "")
(search-forward-regexp end)
(setq r (1+ (line-number-at-pos (match-end 0)))))
(format "%s-%s" (+ l 1) (- r 1)))))) ;; Exclude wrapper
;; -OrgIncludeAuto
;; BetterMiniBuffer
(defun abort-minibuffer-using-mouse ()
"Abort the minibuffer when using the mouse."
(when (and (>= (recursion-depth) 1) (active-minibuffer-window))
(abort-recursive-edit)))
(add-hook 'mouse-leave-buffer-hook 'abort-minibuffer-using-mouse)
;; keep the point out of the minibuffer
(setq-default minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
;; -BetterMiniBuffer
;; DisplayLineOverlay
(defun display-line-overlay+ (pos str &optional face)
"Display line at POS as STR with FACE.
FACE defaults to inheriting from default and highlight."
(let ((ol (save-excursion
(goto-char pos)
(make-overlay (line-beginning-position)
(line-end-position)))))
(overlay-put ol 'display str)
(overlay-put ol 'face
(or face '(:background null :inherit highlight)))
ol))
;; -DisplayLineOverlay
;; ReadLines
(defun read-lines (file-path)
"Return a list of lines of a file at FILE-PATH."
(with-temp-buffer (insert-file-contents file-path)
(split-string (buffer-string) "\n" t)))
;; -ReadLines
;; WhereAmI
(defun where-am-i ()
"An interactive function showing function `buffer-file-name' or `buffer-name'."
(interactive)
(message (kill-new (if (buffer-file-name) (buffer-file-name) (buffer-name)))))
;; -WhereAmI
(provide 'init-func)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-func.el ends here

206
elisp/init-global-config.el Normal file
View File

@ -0,0 +1,206 @@
;;; init-global-config.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-global-config.el
;; Description: Initialize Global Configurations
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 14:01:54 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This file initializes global configurations
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-const))
;; SudoEditPac
(use-package sudo-edit
:commands (sudo-edit))
;; -SudoEditPac
;; DefBindings
;; Unbind unneeded keys
(global-set-key (kbd "C-z") nil)
(global-set-key (kbd "M-z") nil)
(global-set-key (kbd "M-m") nil)
(global-set-key (kbd "C-x C-z") nil)
(global-set-key (kbd "M-/") nil)
;; Truncate lines
(global-set-key (kbd "C-x C-l") #'toggle-truncate-lines)
;; Adjust font size like web browsers
(global-set-key (kbd "C-=") #'text-scale-increase)
(global-set-key (kbd "C-+") #'text-scale-increase)
(global-set-key (kbd "C--") #'text-scale-decrease)
;; Move up/down paragraph
(global-set-key (kbd "M-n") #'forward-paragraph)
(global-set-key (kbd "M-p") #'backward-paragraph)
;; -DefBindings
;; UTF8Coding
(unless *sys/win32*
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(set-language-environment "UTF-8")
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq locale-coding-system 'utf-8))
;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
;; -UTF8Coding
;; EditExp
;; Remove useless whitespace before saving a file
(defun delete-trailing-whitespace-except-current-line ()
"An alternative to `delete-trailing-whitespace'.
The original function deletes trailing whitespace of the current line."
(interactive)
(let ((begin (line-beginning-position))
(end (line-end-position)))
(save-excursion
(when (< (point-min) (1- begin))
(save-restriction
(narrow-to-region (point-min) (1- begin))
(delete-trailing-whitespace)
(widen)))
(when (> (point-max) (+ end 2))
(save-restriction
(narrow-to-region (+ end 2) (point-max))
(delete-trailing-whitespace)
(widen))))))
(defun smart-delete-trailing-whitespace ()
"Invoke `delete-trailing-whitespace-except-current-line' on selected major modes only."
(unless (member major-mode '(diff-mode))
(delete-trailing-whitespace-except-current-line)))
(defun toggle-auto-trailing-ws-removal ()
"Toggle trailing whitespace removal."
(interactive)
(if (member #'smart-delete-trailing-whitespace before-save-hook)
(progn
(remove-hook 'before-save-hook #'smart-delete-trailing-whitespace)
(message "Disabled auto remove trailing whitespace."))
(add-hook 'before-save-hook #'smart-delete-trailing-whitespace)
(message "Enabled auto remove trailing whitespace.")))
;; Add to hook during startup
(add-hook 'before-save-hook #'smart-delete-trailing-whitespace)
;; Replace selection on insert
(delete-selection-mode 1)
;; Map Alt key to Meta
(setq x-alt-keysym 'meta)
;; -EditExp
;; History
(use-package recentf
:ensure nil
:hook (after-init . recentf-mode)
:custom
(recentf-auto-cleanup "05:00am")
(recentf-max-saved-items 200)
(recentf-exclude '((expand-file-name package-user-dir)
".cache"
".cask"
".elfeed"
"bookmarks"
"cache"
"ido.*"
"persp-confs"
"recentf"
"undo-tree-hist"
"url"
"COMMIT_EDITMSG\\'")))
;; When buffer is closed, saves the cursor location
(save-place-mode 1)
;; Set history-length longer
(setq-default history-length 500)
;; -History
;; SmallConfigs
;; Move the backup fies to user-emacs-directory/.backup
(setq backup-directory-alist `(("." . ,(expand-file-name ".backup" user-emacs-directory))))
;; Ask before killing emacs
(setq confirm-kill-emacs 'y-or-n-p)
;; Automatically kill all active processes when closing Emacs
(setq confirm-kill-processes nil)
;; Turn Off Cursor Alarms
(setq ring-bell-function 'ignore)
;; Show Keystrokes in Progress Instantly
(setq echo-keystrokes 0.1)
;; Don't Lock Files
(setq-default create-lockfiles nil)
;; Better Compilation
(setq-default compilation-always-kill t) ; kill compilation process before starting another
(setq-default compilation-ask-about-save nil) ; save all buffers on `compile'
(setq-default compilation-scroll-output t)
;; ad-handle-definition warnings are generated when functions are redefined with `defadvice',
;; they are not helpful.
(setq ad-redefinition-action 'accept)
;; Move Custom-Set-Variables to Different File
(setq custom-file (concat user-emacs-directory "custom-set-variables.el"))
(load custom-file 'noerror)
;; So Long mitigates slowness due to extremely long lines.
;; Currently available in Emacs master branch *only*!
(when (fboundp 'global-so-long-mode)
(global-so-long-mode))
;; Add a newline automatically at the end of the file upon save.
(setq require-final-newline t)
;; Enable `erase-buffer' function
(put 'erase-buffer 'disabled nil)
;; Default .args, .in, .out files to text-mode
(add-to-list 'auto-mode-alist '("\\.in\\'" . text-mode))
(add-to-list 'auto-mode-alist '("\\.out\\'" . text-mode))
(add-to-list 'auto-mode-alist '("\\.args\\'" . text-mode))
(add-to-list 'auto-mode-alist '("\\.bb\\'" . shell-script-mode))
(add-to-list 'auto-mode-alist '("\\.bbclass\\'" . shell-script-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd\\'" . markdown-mode))
;; -SmallConfigs
(provide 'init-global-config)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-global-config.el ends here

54
elisp/init-magit.el Normal file
View File

@ -0,0 +1,54 @@
;;; init-magit.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-magit.el
;; Description: Initialize Magit
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 08:40:27 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d magit
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes magit
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; MagitPac
(use-package magit
:if (executable-find "git")
:bind
(("C-x g" . magit-status)
(:map magit-status-mode-map
("M-RET" . magit-diff-visit-file-other-window)))
:config
(defun magit-log-follow-current-file ()
"A wrapper around `magit-log-buffer-file' with `--follow' argument."
(interactive)
(magit-log-buffer-file t)))
;; -MagitPac
(provide 'init-magit)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-magit.el ends here

187
elisp/init-org.el Normal file
View File

@ -0,0 +1,187 @@
;;; init-org.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-org.el
;; Description: Initialize Org, Toc-org, HTMLize, OX-GFM
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 11:09:30 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d org toc-org htmlize ox-gfm
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes org toc-org htmlize ox-gfm
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; OrgPac
(use-package org
:ensure nil
:defer t
:bind (("C-c l" . org-store-link)
("C-c a" . org-agenda)
("C-c c" . org-capture)
(:map org-mode-map (("C-c C-p" . eaf-org-export-to-pdf-and-open)
("C-c ;" . nil)
("C-c C-." . org-time-stamp-inactive)
)))
:custom
(org-directory "~/Documents/Org-mode/")
(org-default-notes-file (concat org-directory "/agenda/notes.org"))
(org-log-done 'time)
(calendar-latitude 43.65107) ;; Prerequisite: set it to your location, currently default: Toronto, Canada
(calendar-longitude -79.347015) ;; Usable for M-x `sunrise-sunset' or in `org-agenda'
(org-export-backends (quote (ascii html icalendar latex md odt)))
(org-use-speed-commands t)
(org-confirm-babel-evaluate 'nil)
(org-latex-listings-options '(("breaklines" "true")))
(org-latex-listings 'minted)
(org-latex-src-block-backend 'minted)
(org-export-with-LaTeX-fragments t)
(org-deadline-warning-days 7)
(org-todo-keywords
'((sequence "TODO(t)" "IN-PROGRESS(p)" "REVIEW(r)" "PAUSED" "|" "DONE(d)" "CANCELED(c@)")
(sequence "ISSUE(i)" "BUG(b)" "KNOWN(k)" "|" "FIXED(f)")))
(org-todo-keyword-faces '(("TODO" . "red")
("DONE" . "green")
("IN-PROGRESS" . "lightblue")
("REVIEW" . "magenta")
("PAUSED" . "magenta")
("CANCELED" . "gray")
("ISSUE" . "red")
("BUG" . "orange")
("KNOWN" . "yellow")
("FIXED" . "green")))
(org-agenda-window-setup 'other-window)
(org-startup-indented t)
(org-latex-pdf-process
'("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(add-to-list 'org-latex-classes
'("intemo-report"
"\\documentclass[a4paper,oneside]{intemo-org-report}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(add-to-list 'org-latex-classes
'("intemo-article"
"\\documentclass[a4paper,oneside]{intemo-org-article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\chapter*{%s}")
("\\subsection{%s}" . "\\section*{%s}")
("\\subsubsection{%s}" . "\\subsection*{%s}")
)
)
:custom-face
(org-agenda-current-time ((t (:foreground "spring green"))))
:config
(add-to-list 'org-latex-packages-alist '("" "listings"))
(unless (version< org-version "9.2")
(require 'org-tempo))
(setq org-agenda-files (list (concat org-directory "agenda/")))
(org-babel-do-load-languages
'org-babel-load-languages
'(;; other Babel languages
(C . t)
(python . t)
(plantuml . t)))
(defun org-export-toggle-syntax-highlight ()
"Setup variables to turn on syntax highlighting when calling `org-latex-export-to-pdf'."
(interactive)
(setq-local org-latex-listings 'minted)
(add-to-list 'org-latex-packages-alist '("newfloat" "minted")))
(defun org-table-insert-vertical-hline ()
"Insert a #+attr_latex to the current buffer, default the align to |c|c|c|, adjust if necessary."
(interactive)
(insert "#+attr_latex: :align |c|c|c|"))
;; Modify export direcotry
(defun org-export-output-file-name-modified (orig-fun extension &optional subtreep pub-dir)
(unless pub-dir
(setq pub-dir "org-exported")
(unless (file-directory-p pub-dir)
(make-directory pub-dir)))
(apply orig-fun extension subtreep pub-dir nil))
(advice-add 'org-export-output-file-name :around #'org-export-output-file-name-modified))
;; -OrgPac
;; OrgRoamPac
(use-package org-roam
:after org
:custom
(org-roam-node-display-template
(concat "${title:*} "
(propertize "${tags:10}" 'face 'org-tag)))
(org-roam-completion-everywhere t)
:bind
(("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n h" . org-id-get-create))
:bind-keymap
("C-c n d" . org-roam-dailies-map)
:config
(when (file-directory-p "~/Documents/Org-mode/brain")
(setq org-roam-directory (file-truename "~/Documents/Org-mode/brain")))
(require 'org-roam-dailies)
(org-roam-db-autosync-mode))
;; -OrgRoamPac
;; TocOrgPac
(use-package toc-org
:hook (org-mode . toc-org-mode))
;; -TocOrgPac
;; HTMLIZEPac
(use-package htmlize :defer t)
;; -HTMLIZEPac
;; OXGFMPac
(use-package ox-gfm :defer t)
;; -OXGFMPac
;; PlantUMLPac
(use-package plantuml-mode
:defer t
:custom
(org-plantuml-jar-path (expand-file-name "~/tools/plantuml/plantuml.jar")))
;; -PlantUMLPac
;; Org-ql
(use-package org-ql
:defer t
)
;; -Org-ql
(provide 'init-org)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-org.el ends here

98
elisp/init-package.el Normal file
View File

@ -0,0 +1,98 @@
;;; init-package.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-package.el
;; Description: Initialize Package Management for M-EMACS
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 10:53:00 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d packages use-package
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This file initializes packages from melpa using use-package macro
;; as well as auto-package-update, diminish, gnu-elpa-keyring-update
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; MelpaPackages
;; Select the folder to store packages
;; Comment / Uncomment to use desired sites
(setq package-user-dir (expand-file-name "elpa" user-emacs-directory)
package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("cselpa" . "https://elpa.thecybershadow.net/packages/")
;; ("melpa-cn" . "http://mirrors.cloud.tencent.com/elpa/melpa/")
;; ("gnu-cn" . "http://mirrors.cloud.tencent.com/elpa/gnu/")
))
;; -MelpaPackages
;; ConfigurePackageManager
(unless (bound-and-true-p package--initialized)
(setq package-enable-at-startup nil) ; To prevent initializing twice
(package-initialize))
;; set use-package-verbose to t for interpreted .emacs,
;; and to nil for byte-compiled .emacs.elc.
(eval-and-compile
(setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))))
;; -ConfigurePackageManager
;; ConfigureUsePackage
;; Install use-package if not installed
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-and-compile
(setq use-package-always-ensure t)
(setq use-package-expand-minimally t)
(setq use-package-compute-statistics t)
(setq use-package-enable-imenu-support t))
(eval-when-compile
(require 'use-package)
(require 'bind-key))
;; -ConfigureUsePackage
;; ;; AutoPackageUpdate
;; (use-package auto-package-update
;; :if (not (daemonp))
;; :custom
;; (auto-package-update-interval 7) ;; in days
;; (auto-package-update-prompt-before-update t)
;; (auto-package-update-delete-old-versions t)
;; (auto-package-update-hide-results t)
;; :config
;; (auto-package-update-maybe))
;; ;; -AutoPackageUpdate
;; DimPac
(use-package diminish)
;; -DimPac
(provide 'init-package)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-package.el ends here

91
elisp/init-search.el Normal file
View File

@ -0,0 +1,91 @@
;;; init-search.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-search.el
;; Description: Initialize Packages for Searching
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 11:01:43 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d color-rg rg
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes ivy swiper counsel color-rg
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-global-config))
;; IvyPac
(use-package ivy
:diminish
:init
(use-package amx :defer t)
(use-package counsel :diminish :config (counsel-mode 1))
(use-package swiper :defer t)
(ivy-mode 1)
:bind
(("C-s" . swiper-isearch)
("C-z s" . counsel-rg)
("C-z b" . counsel-buffer-or-recentf)
("C-z C-b" . counsel-ibuffer)
(:map ivy-minibuffer-map
("M-RET" . ivy-immediate-done))
(:map counsel-find-file-map
("C-~" . counsel-goto-local-home)))
:custom
(ivy-use-virtual-buffers t)
(ivy-height 10)
(ivy-on-del-error-function nil)
(ivy-magic-slash-non-match-action 'ivy-magic-slash-non-match-create)
(ivy-count-format "【%d/%d】")
(ivy-wrap t)
:config
(defun counsel-goto-local-home ()
"Go to the $HOME of the local machine."
(interactive)
(ivy--cd "~/")))
;; -IvyPac
;; ColorRGPac
(use-package color-rg
:load-path (lambda () (expand-file-name "site-elisp/color-rg" user-emacs-directory))
:if (executable-find "rg")
:bind ("C-M-s" . color-rg-search-input))
;; -ColorRGPac
;; FFIPPac
(use-package find-file-in-project
:if (executable-find "find")
:init
(when (executable-find "fd")
(setq ffip-use-rust-fd t))
:bind (("C-z o" . ffap)
("C-z p" . ffip)))
;; -FFIPPac
(provide 'init-search)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-search.el ends here

97
elisp/init-shell.el Normal file
View File

@ -0,0 +1,97 @@
;;; init-shell.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-shell.el
;; Description: Initialize Shell
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Mar 19 09:20:19 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d shell shell-here
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes shell-here, term-keys, multi-term, aweshell
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-const))
;; ShellHerePac
(use-package shell-here
:bind ("M-~" . shell-here)
:config
(when *sys/linux*
(setq explicit-shell-file-name "/bin/bash")))
;; -ShellHerePac
;; MultiTermPac
(use-package multi-term
:load-path (lambda () (expand-file-name "site-elisp/multi-term" user-emacs-directory))
:commands (multi-term)
:bind
(("M-$" . multi-term)
(:map dired-mode-map ("M-$" . multi-term)))
:custom
(multi-term-program (executable-find "bash"))
(term-bind-key-alist
'(("C-c C-c" . term-interrupt-subjob)
("C-c C-e" . term-send-esc)
("C-p" . previous-line)
("C-n" . next-line)
("C-m" . term-send-return)
("C-y" . term-paste)
("C-v" . scroll-up-command)
("M-v" . scroll-down-command)
("M-f" . term-send-forward-word)
("M-b" . term-send-backward-word)
("M-o" . term-send-backspace)
("M-p" . term-send-up)
("M-n" . term-send-down)
("M-M" . term-send-forward-kill-word)
("M-N" . term-send-backward-kill-word)
("<C-backspace>" . term-send-backward-kill-word)
("<M-backspace>" . term-send-backward-kill-word)
("M-r" . term-send-reverse-search-history)
("M-d" . term-send-delete-word)
("M-," . term-send-raw)
("M-." . comint-dynamic-complete))))
;; -MultiTermPac
;; TermKeysPac
(use-package term-keys
:if (not (display-graphic-p))
:config (term-keys-mode t))
;; -TermKeysPac
;; ExecPathFromShellPac
(use-package exec-path-from-shell
:if (memq window-system '(mac ns x))
:config
(exec-path-from-shell-initialize))
;; -ExecPathFromShellPac
(provide 'init-shell)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-shell.el ends here

117
elisp/init-syntax.el Normal file
View File

@ -0,0 +1,117 @@
;;; init-syntax.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-syntax.el
;; Description: Initialize Flycheck
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:08:22 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d flycheck flyspell
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes flycheck and flyspell
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; FlyCheckPac
(use-package flycheck
:defer t
:diminish
:hook (after-init . global-flycheck-mode)
:commands (flycheck-add-mode)
:custom
(flycheck-global-modes
'(not outline-mode diff-mode shell-mode eshell-mode term-mode))
(flycheck-emacs-lisp-load-path 'inherit)
(flycheck-indication-mode (if (display-graphic-p) 'right-fringe 'right-margin))
:init
(if (display-graphic-p)
(use-package flycheck-posframe
:custom-face
(flycheck-posframe-face ((t (:foreground ,(face-foreground 'success)))))
(flycheck-posframe-info-face ((t (:foreground ,(face-foreground 'success)))))
:hook (flycheck-mode . flycheck-posframe-mode)
:custom
(flycheck-posframe-position 'window-bottom-left-corner)
(flycheck-posframe-border-width 3)
(flycheck-posframe-inhibit-functions
'((lambda (&rest _) (bound-and-true-p company-backend)))))
(use-package flycheck-pos-tip
:defines flycheck-pos-tip-timeout
:hook (flycheck-mode . flycheck-pos-tip-mode)
:custom (flycheck-pos-tip-timeout 30)))
:config
(use-package flycheck-popup-tip
:hook (flycheck-mode . flycheck-popup-tip-mode))
(when (fboundp 'define-fringe-bitmap)
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
[16 48 112 240 112 48 16] nil nil 'center))
(when (executable-find "vale")
(use-package flycheck-vale
:config
(flycheck-vale-setup)
(flycheck-add-mode 'vale 'latex-mode))))
;; -FlyCheckPac
;; FlyspellPac
(use-package flyspell
:ensure nil
:bind (("C-c N" . (lambda ()
(interactive)
(ispell-change-dictionary "nl_NL")
(flyspell-buffer)))
("C-c E" . (lambda ()
(interactive)
(ispell-change-dictionary "en_US")
(flyspell-buffer))
))
:diminish
:if (executable-find "hunspell")
:hook (((text-mode outline-mode latex-mode org-mode markdown-mode) . flyspell-mode))
:custom
(flyspell-issue-message-flag nil)
(ispell-program-name "hunspell")
(ispell-dictionary "nl_NL")
:init
(setenv "LANG" "en_US.UTF-8")
(setenv "DICPATH" (concat (file-name-directory user-init-file) "spelling"))
(use-package flyspell-correct-ivy
:after ivy
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-ivy))
)
;; -FlyspellPac
(provide 'init-syntax)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-syntax.el ends here

80
elisp/init-theme.el Normal file
View File

@ -0,0 +1,80 @@
;;; init-theme.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-theme.el
;; Description: Initialize Doom Themes and Modeline
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:11:56 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d doom-themes doom-modeline
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes doom-themes and doom-modeline
;; This is NOT Doom, but doom-themes and doom-modeine
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-const))
(use-package zenburn-theme
:ensure t
:config
(load-theme 'zenburn t)
)
;; DoomThemes
;; (use-package doom-themes
;; :custom-face
;; (cursor ((t (:background "BlanchedAlmond"))))
;; :config
;; ;; flashing mode-line on errors
;; (doom-themes-visual-bell-config)
;; ;; Corrects (and improves) org-mode's native fontification.
;; (doom-themes-org-config)
;; (load-theme 'doom-one t)
;; (defun switch-theme ()
;; "An interactive funtion to switch themes."
;; (interactive)
;; (disable-theme (intern (car (mapcar #'symbol-name custom-enabled-themes))))
;; (call-interactively #'load-theme)))
;; ;; -DoomThemes
;; ;; DoomModeline
;; (use-package doom-modeline
;; :custom
;; ;; Don't compact font caches during GC. Windows Laggy Issue
;; (inhibit-compacting-font-caches t)
;; (doom-modeline-minor-modes t)
;; (doom-modeline-icon t)
;; (doom-modeline-major-mode-color-icon t)
;; (doom-modeline-height 15)
;; :config
;; (doom-modeline-mode))
;; ;; -DoomModeline
(provide 'init-theme)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-theme.el ends here

101
elisp/init-ui-config.el Normal file
View File

@ -0,0 +1,101 @@
;;; init-ui-config.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-ui-config.el
;; Description: Initialize UI Configurations
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 16:12:56 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d ui
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes prettify-symbols-mode and other UI configurations
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-const)
(require 'battery))
;; Highlight
(global-hl-line-mode 1)
;; -Highlight
;; ;; PreSym
;; (global-prettify-symbols-mode 1)
;; (defun add-pretty-lambda ()
;; "Make some word or string show as pretty Unicode symbols. See https://unicodelookup.com for more."
;; (setq prettify-symbols-alist
;; '(("lambda" . 955)
;; ("delta" . 120517)
;; ("epsilon" . 120518)
;; ("->" . 8594)
;; ("<=" . 8804)
;; (">=" . 8805))))
;; (add-hook 'prog-mode-hook 'add-pretty-lambda)
;; (add-hook 'org-mode-hook 'add-pretty-lambda)
;; ;; -PreSym
;; TitleBar
(setq-default frame-title-format '("M-EMACS - " user-login-name "@" system-name " - %b"))
;; -TitleBar
;; YorN
(fset 'yes-or-no-p 'y-or-n-p)
(setq use-dialog-box nil)
;; -YorN
;; StartupScreen
(setq inhibit-startup-screen t)
(setq initial-major-mode 'text-mode)
;; https://www.youtube.com/watch?v=NfjsLmya1PI
(setq initial-scratch-message "Present Day, Present Time...\n")
;; -StartupScreen
;; DisLineNum
;; Hook line numbers to only when files are opened, also use linum-mode for emacs-version< 26
(if (version< emacs-version "26")
(global-linum-mode)
(add-hook 'text-mode-hook #'display-line-numbers-mode)
(add-hook 'prog-mode-hook #'display-line-numbers-mode))
;; Display column numbers in modeline
(column-number-mode 1)
;; -DisLineNum
;; DisTimeBat
(display-time-mode 1)
(when (and battery-status-function
(not (string-match-p "N/A" (battery-format "%B" (funcall battery-status-function)))))
(display-battery-mode 1))
;; -DisTimeBat
;; PixelScrollPrecMode
(when (version<= "29.1" emacs-version)
(pixel-scroll-precision-mode 1))
;; -PixelScrollPrecMode
(provide 'init-ui-config)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-ui-config.el ends here

50
elisp/init-which-key.el Normal file
View File

@ -0,0 +1,50 @@
;;; init-which-key.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-which-key.el
;; Description: Initialize Which-key
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 15:06:27 2019 (-0400)
;; Version: 3.0
;; URL: URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d which-key
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes which-key
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; WhichKeyPac
(use-package which-key
:diminish
:custom
(which-key-separator " ")
(which-key-prefix-prefix "+")
:config
(which-key-mode))
;; -WhichKeyPac
(provide 'init-which-key)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-which-key.el ends here

64
elisp/init-yasnippet.el Normal file
View File

@ -0,0 +1,64 @@
;;; init-yasnippet.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-yasnippet.el
;; Description: Initialize YASnippet
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Apr 23 23:08:17 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d yasnippet
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes YASnippet
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; YASnippetPac
(use-package yasnippet
:diminish yas-minor-mode
:init
(use-package yasnippet-snippets :after yasnippet)
:hook ((prog-mode LaTeX-mode org-mode markdown-mode) . yas-minor-mode)
:bind
(:map yas-minor-mode-map ("C-c C-n" . yas-expand-from-trigger-key))
(:map yas-keymap
(("TAB" . smarter-yas-expand-next-field)
([(tab)] . smarter-yas-expand-next-field)))
:config
(yas-reload-all)
(defun smarter-yas-expand-next-field ()
"Try to `yas-expand' then `yas-next-field' at current cursor position."
(interactive)
(let ((old-point (point))
(old-tick (buffer-chars-modified-tick)))
(yas-expand)
(when (and (eq old-point (point))
(eq old-tick (buffer-chars-modified-tick)))
(ignore-errors (yas-next-field))))))
;; -YASnippetPac
(provide 'init-yasnippet)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-yasnippet.el ends here

242
init.el Normal file
View File

@ -0,0 +1,242 @@
;;; init.el --- -*- lexical-binding: t -*-
;;
;; Filename: init.el
;; Description: Initialize M-EMACS
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 10:15:28 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d init
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This is the init.el file for M-EMACS
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(defun remove-electric-indent-mode ()
(setq electric-indent-inhibit t))
;; BetterGC
(defvar better-gc-cons-threshold 134217728 ; 128mb
"The default value to use for `gc-cons-threshold'.
If you experience freezing, decrease this. If you experience stuttering, increase this.")
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold better-gc-cons-threshold)
(setq file-name-handler-alist file-name-handler-alist-original)
(makunbound 'file-name-handler-alist-original)))
;; -BetterGC
;; AutoGC
(add-hook 'emacs-startup-hook
(lambda ()
(if (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function
(lambda ()
(unless (frame-focus-state)
(garbage-collect))))
(add-hook 'after-focus-change-function 'garbage-collect))
(defun gc-minibuffer-setup-hook ()
(setq gc-cons-threshold (* better-gc-cons-threshold 2)))
(defun gc-minibuffer-exit-hook ()
(garbage-collect)
(setq gc-cons-threshold better-gc-cons-threshold))
(add-hook 'minibuffer-setup-hook #'gc-minibuffer-setup-hook)
(add-hook 'minibuffer-exit-hook #'gc-minibuffer-exit-hook)))
;; -AutoGC
;; LoadPath
(defun update-to-load-path (folder)
"Update FOLDER and its subdirectories to `load-path'."
(let ((base folder))
(unless (member base load-path)
(add-to-list 'load-path base))
(dolist (f (directory-files base))
(let ((name (concat base "/" f)))
(when (and (file-directory-p name)
(not (equal f ".."))
(not (equal f ".")))
(unless (member base load-path)
(add-to-list 'load-path name)))))))
(update-to-load-path (expand-file-name "elisp" user-emacs-directory))
;; -LoadPath
;; ;; Constants
(require 'init-const)
;; ;; Packages
;; ;; Package Management
(require 'init-package)
;; ;; Global Functionalities
(require 'init-global-config)
(require 'init-func)
(require 'init-search)
(require 'init-crux)
(require 'init-avy)
;; (require 'init-winner)
(require 'init-which-key)
;; (require 'init-popup-kill-ring)
;; (require 'init-undo-tree)
(require 'init-discover-my-major)
(require 'init-ace-window)
(require 'init-shell)
(require 'init-dired)
(require 'init-buffer)
;; ;; UI Enhancements
(require 'init-ui-config)
(require 'init-theme)
;; (require 'init-dashboard)
;; (require 'init-fonts)
;; (require 'init-scroll)
;; ;; General Programming
(require 'init-magit)
;; (require 'init-projectile)
(require 'init-yasnippet)
(require 'init-syntax)
;; (require 'init-dumb-jump)
;; (require 'init-parens)
;; (require 'init-indent)
;; (require 'init-quickrun)
;; (require 'init-format)
;; (require 'init-comment)
;; (require 'init-edit)
;; (require 'init-header)
;; (require 'init-ein)
;; (require 'init-lsp)
;; (require 'init-company)
;; ;; Programming
;; (require 'init-java)
;; (require 'init-cc)
;; (require 'init-python)
;; (require 'init-haskell)
;; (require 'init-ess)
;; (require 'init-latex)
;; (require 'init-buildsystem)
;; ;; Web Development
;; (require 'init-webdev)
;; ;; Office
(require 'init-org)
;; (require 'init-pdf)
(require 'init-adoc)
;; ;; Internet
;; ;; (require 'init-eaf)
;; (require 'init-erc)
;; ;; (require 'init-mu4e)
;; (require 'init-tramp)
;; (require 'init-leetcode)
;; (require 'init-debbugs)
;; (require 'init-hackernews)
;; (require 'init-eww)
;; ;; Miscellaneous
;; (require 'init-chinese)
;; (require 'init-games)
;; (require 'init-epaint)
;; (require 'init-zone)
;; InitPrivate
;; Load init-private.el if it exists
(when (file-exists-p (expand-file-name "init-private.el" user-emacs-directory))
(load-file (expand-file-name "init-private.el" user-emacs-directory)))
;; -InitPrivate
(provide 'init)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init.el ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(diminish auto-package-update)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

205
spelling/en_US.aff Normal file
View File

@ -0,0 +1,205 @@
SET UTF-8
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
ICONV 1
ICONV '
NOSUGGEST !
# ordinal numbers
COMPOUNDMIN 1
# only in compounds: 1th, 2th, 3th
ONLYINCOMPOUND c
# compound rules:
# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
COMPOUNDRULE 2
COMPOUNDRULE n*1t
COMPOUNDRULE n*mp
WORDCHARS 0123456789
PFX A Y 1
PFX A 0 re .
PFX I Y 1
PFX I 0 in .
PFX U Y 1
PFX U 0 un .
PFX C Y 1
PFX C 0 de .
PFX E Y 1
PFX E 0 dis .
PFX F Y 1
PFX F 0 con .
PFX K Y 1
PFX K 0 pro .
SFX V N 2
SFX V e ive e
SFX V 0 ive [^e]
SFX N Y 3
SFX N e ion e
SFX N y ication y
SFX N 0 en [^ey]
SFX X Y 3
SFX X e ions e
SFX X y ications y
SFX X 0 ens [^ey]
SFX H N 2
SFX H y ieth y
SFX H 0 th [^y]
SFX Y Y 1
SFX Y 0 ly .
SFX G Y 2
SFX G e ing e
SFX G 0 ing [^e]
SFX J Y 2
SFX J e ings e
SFX J 0 ings [^e]
SFX D Y 4
SFX D 0 d e
SFX D y ied [^aeiou]y
SFX D 0 ed [^ey]
SFX D 0 ed [aeiou]y
SFX T N 4
SFX T 0 st e
SFX T y iest [^aeiou]y
SFX T 0 est [aeiou]y
SFX T 0 est [^ey]
SFX R Y 4
SFX R 0 r e
SFX R y ier [^aeiou]y
SFX R 0 er [aeiou]y
SFX R 0 er [^ey]
SFX Z Y 4
SFX Z 0 rs e
SFX Z y iers [^aeiou]y
SFX Z 0 ers [aeiou]y
SFX Z 0 ers [^ey]
SFX S Y 4
SFX S y ies [^aeiou]y
SFX S 0 s [aeiou]y
SFX S 0 es [sxzh]
SFX S 0 s [^sxzhy]
SFX P Y 3
SFX P y iness [^aeiou]y
SFX P 0 ness [aeiou]y
SFX P 0 ness [^y]
SFX M Y 1
SFX M 0 's .
SFX B Y 3
SFX B 0 able [^aeiou]
SFX B 0 able ee
SFX B e able [^aeiou]e
SFX L Y 1
SFX L 0 ment .
REP 90
REP a ei
REP ei a
REP a ey
REP ey a
REP ai ie
REP ie ai
REP alot a_lot
REP are air
REP are ear
REP are eir
REP air are
REP air ere
REP ere air
REP ere ear
REP ere eir
REP ear are
REP ear air
REP ear ere
REP eir are
REP eir ere
REP ch te
REP te ch
REP ch ti
REP ti ch
REP ch tu
REP tu ch
REP ch s
REP s ch
REP ch k
REP k ch
REP f ph
REP ph f
REP gh f
REP f gh
REP i igh
REP igh i
REP i uy
REP uy i
REP i ee
REP ee i
REP j di
REP di j
REP j gg
REP gg j
REP j ge
REP ge j
REP s ti
REP ti s
REP s ci
REP ci s
REP k cc
REP cc k
REP k qu
REP qu k
REP kw qu
REP o eau
REP eau o
REP o ew
REP ew o
REP oo ew
REP ew oo
REP ew ui
REP ui ew
REP oo ui
REP ui oo
REP ew u
REP u ew
REP oo u
REP u oo
REP u oe
REP oe u
REP u ieu
REP ieu u
REP ue ew
REP ew ue
REP uff ough
REP oo ieu
REP ieu oo
REP ier ear
REP ear ier
REP ear air
REP air ear
REP w qu
REP qu w
REP z ss
REP ss z
REP shun tion
REP shun sion
REP shun cion
REP size cise

49569
spelling/en_US.dic Normal file

File diff suppressed because it is too large Load Diff

1418
spelling/nl_NL.aff Normal file

File diff suppressed because it is too large Load Diff

142520
spelling/nl_NL.dic Normal file

File diff suppressed because it is too large Load Diff