[emacs] Start switching to M-Emacs.

This commit is contained in:
Mikaël Capelle 2019-12-29 22:22:51 +01:00 committed by Mikaël Capelle
parent 67141d8dc5
commit f3a1c670d9
78 changed files with 9306 additions and 445 deletions

68
.emacs.d/early-init.el Normal file
View File

@ -0,0 +1,68 @@
;;; 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: 2.0.0
;; Last-Updated: Tue Sep 17 01:13:45 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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

View File

@ -0,0 +1,47 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Aug 8 16:02:47 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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

View File

@ -0,0 +1,65 @@
;;; init-all-the-icons.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-all-the-icons.el
;; Description: Initialize All-The-Icons
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:06:08 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 11:47:45 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d all-the-icons
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes all-the-icons, all-the-icons-dired, all-the-icons-ivy
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; ATIPac
(use-package all-the-icons :if *sys/gui*)
;; -ATIPac
;; ATIDiredPac
(use-package all-the-icons-dired
:after all-the-icons
:if *sys/gui*
:diminish
:custom-face
(all-the-icons-dired-dir-face ((t `(:foreground ,(face-background 'default)))))
:hook (dired-mode . all-the-icons-dired-mode)
:config
;; Workaround for all-the-icons bug until PR merged https://github.com/domtronn/all-the-icons.el/pull/150
(when (require 'all-the-icons nil 'noerror)
(setq all-the-icons-mode-icon-alist
(delete '(erc-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0 :face all-the-icons-white) all-the-icons-mode-icon-alist))
(add-to-list 'all-the-icons-mode-icon-alist '(erc-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0))))
;; -ATIDiredPac
(provide 'init-all-the-icons)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-all-the-icons.el ends here

View File

@ -0,0 +1,58 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Nov 7 05:55:40 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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

82
.emacs.d/elisp/init-cc.el Normal file
View File

@ -0,0 +1,82 @@
;;; init-cc.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-cc.el
;; Description: Initialize C family languages
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:58:29 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Dec 26 02:07:34 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d c c++ go ccls
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initialize ccls modern-cpp-font-lock go-mode
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; CCLSPac
(use-package ccls
:defer t
:if (not *sys/win32*)
:hook ((c-mode c++-mode objc-mode) .
(lambda () (require 'ccls) (lsp)))
:custom
(ccls-executable (executable-find "ccls")) ; Add ccls to path if you haven't done so
(ccls-sem-highlight-method 'font-lock)
(ccls-enable-skipped-ranges nil)
:config
(lsp-register-client
(make-lsp-client
:new-connection (lsp-tramp-connection (cons ccls-executable ccls-args))
:major-modes '(c-mode c++-mode cuda-mode objc-mode)
:server-id 'ccls-remote
:multi-root nil
:remote? t
:notification-handlers
(lsp-ht ("$ccls/publishSkippedRanges" #'ccls--publish-skipped-ranges)
("$ccls/publishSemanticHighlight" #'ccls--publish-semantic-highlight))
:initialization-options (lambda () ccls-initialization-options)
:library-folders-fn nil)))
;; -CCLSPac
;; CPPFontLockPac
(use-package modern-cpp-font-lock
:diminish t
:init (modern-c++-font-lock-global-mode t))
;; -CPPFontLockPac
;; GoPac
(use-package go-mode
:mode "\\.go\\'"
:hook (before-save . gofmt-before-save))
;; -GoPac
(provide 'init-cc)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-cc.el ends here

View File

@ -0,0 +1,49 @@
;;; init-comment.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-comment.el
;; Description: Initialize Evil-Nerd-Commenter
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Apr 5 00:21:58 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Wed Oct 16 16:44:25 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d evil-nerd-commenter
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes evil-nerd-commenter
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; EvilNerdCommenPac
(use-package evil-nerd-commenter
:bind
(("C-c M-;" . c-toggle-comment-style)
("M-;" . evilnc-comment-or-uncomment-lines)))
;; -EvilNerdCommenPac
(provide 'init-comment)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-comment.el ends here

View File

@ -0,0 +1,223 @@
;;; init-company.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-company.el
;; Description: Initialize Company
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:02:00 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Fri Dec 27 22:11:06 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d company company-tabnine
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes company
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; ComPac
(use-package company
:diminish company-mode
:hook ((prog-mode LaTeX-mode latex-mode ess-r-mode) . company-mode)
:bind
(:map company-active-map
([tab] . smarter-yas-expand-next-field-complete)
("TAB" . smarter-yas-expand-next-field-complete))
:custom
(company-minimum-prefix-length 1)
(company-tooltip-align-annotations t)
(company-begin-commands '(self-insert-command))
(company-require-match 'never)
;; Don't use company in the following modes
(company-global-modes '(not shell-mode eaf-mode))
;; Trigger completion immediately.
(company-idle-delay 0.1)
;; Number the candidates (use M-1, M-2 etc to select completions).
(company-show-numbers t)
:config
(unless *clangd* (delete 'company-clang company-backends))
(global-company-mode 1)
(defun smarter-yas-expand-next-field-complete ()
"Try to `yas-expand' and `yas-next-field' at current cursor position.
If failed try to complete the common part with `company-complete-common'"
(interactive)
(if yas-minor-mode
(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))
(when (and (eq old-point (point))
(eq old-tick (buffer-chars-modified-tick)))
(company-complete-common))))
(company-complete-common))))
;; -ComPac
;; CompanyLSPPac
(use-package company-lsp
:defer t
:custom (company-lsp-cache-candidates 'auto))
;; -CompanyLSPPac
;; CompanyTabNinePac
(use-package company-tabnine
:defer 1
:custom
(company-tabnine-max-num-results 9)
:bind
(("M-q" . company-other-backend)
("C-z t" . company-tabnine))
:hook
(lsp-after-open . (lambda ()
(setq company-tabnine-max-num-results 3)
(add-to-list 'company-transformers 'company//sort-by-tabnine t)
(add-to-list 'company-backends '(company-lsp :with company-tabnine :separate))))
(kill-emacs . company-tabnine-kill-process)
:config
;; Enable TabNine on default
(add-to-list 'company-backends #'company-tabnine)
;; Integrate company-tabnine with lsp-mode
(defun company//sort-by-tabnine (candidates)
(if (or (functionp company-backend)
(not (and (listp company-backend) (memq 'company-tabnine company-backend))))
candidates
(let ((candidates-table (make-hash-table :test #'equal))
candidates-lsp
candidates-tabnine)
(dolist (candidate candidates)
(if (eq (get-text-property 0 'company-backend candidate)
'company-tabnine)
(unless (gethash candidate candidates-table)
(push candidate candidates-tabnine))
(push candidate candidates-lsp)
(puthash candidate t candidates-table)))
(setq candidates-lsp (nreverse candidates-lsp))
(setq candidates-tabnine (nreverse candidates-tabnine))
(nconc (seq-take candidates-tabnine 3)
(seq-take candidates-lsp 6))))))
;; -CompanyTabNinePac
;; CompanyBoxPac
(use-package company-box
:diminish
:functions (my-company-box--make-line
my-company-box-icons--elisp)
:commands (company-box--get-color
company-box--resolve-colors
company-box--add-icon
company-box--apply-color
company-box--make-line
company-box-icons--elisp)
:hook (company-mode . company-box-mode)
:custom
(company-box-backends-colors nil)
(company-box-show-single-candidate t)
(company-box-max-candidates 50)
(company-box-doc-delay 0.3)
:config
;; Support `company-common'
(defun my-company-box--make-line (candidate)
(-let* (((candidate annotation len-c len-a backend) candidate)
(color (company-box--get-color backend))
((c-color a-color i-color s-color) (company-box--resolve-colors color))
(icon-string (and company-box--with-icons-p (company-box--add-icon candidate)))
(candidate-string (concat (propertize (or company-common "") 'face 'company-tooltip-common)
(substring (propertize candidate 'face 'company-box-candidate) (length company-common) nil)))
(align-string (when annotation
(concat " " (and company-tooltip-align-annotations
(propertize " " 'display `(space :align-to (- right-fringe ,(or len-a 0) 1)))))))
(space company-box--space)
(icon-p company-box-enable-icon)
(annotation-string (and annotation (propertize annotation 'face 'company-box-annotation)))
(line (concat (unless (or (and (= space 2) icon-p) (= space 0))
(propertize " " 'display `(space :width ,(if (or (= space 1) (not icon-p)) 1 0.75))))
(company-box--apply-color icon-string i-color)
(company-box--apply-color candidate-string c-color)
align-string
(company-box--apply-color annotation-string a-color)))
(len (length line)))
(add-text-properties 0 len (list 'company-box--len (+ len-c len-a)
'company-box--color s-color)
line)
line))
(advice-add #'company-box--make-line :override #'my-company-box--make-line)
;; Prettify icons
(defun my-company-box-icons--elisp (candidate)
(when (derived-mode-p 'emacs-lisp-mode)
(let ((sym (intern candidate)))
(cond ((fboundp sym) 'Function)
((featurep sym) 'Module)
((facep sym) 'Color)
((boundp sym) 'Variable)
((symbolp sym) 'Text)
(t . nil)))))
(advice-add #'company-box-icons--elisp :override #'my-company-box-icons--elisp)
(when (and *sys/gui*
(require 'all-the-icons nil t))
(declare-function all-the-icons-faicon 'all-the-icons)
(declare-function all-the-icons-material 'all-the-icons)
(declare-function all-the-icons-octicon 'all-the-icons)
(setq company-box-icons-all-the-icons
`((Unknown . ,(all-the-icons-material "find_in_page" :height 0.85 :v-adjust -0.2))
(Text . ,(all-the-icons-faicon "text-width" :height 0.8 :v-adjust -0.05))
(Method . ,(all-the-icons-faicon "cube" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-purple))
(Function . ,(all-the-icons-faicon "cube" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-purple))
(Constructor . ,(all-the-icons-faicon "cube" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-purple))
(Field . ,(all-the-icons-octicon "tag" :height 0.8 :v-adjust 0 :face 'all-the-icons-lblue))
(Variable . ,(all-the-icons-octicon "tag" :height 0.8 :v-adjust 0 :face 'all-the-icons-lblue))
(Class . ,(all-the-icons-material "settings_input_component" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-orange))
(Interface . ,(all-the-icons-material "share" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
(Module . ,(all-the-icons-material "view_module" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
(Property . ,(all-the-icons-faicon "wrench" :height 0.8 :v-adjust -0.05))
(Unit . ,(all-the-icons-material "settings_system_daydream" :height 0.85 :v-adjust -0.2))
(Value . ,(all-the-icons-material "format_align_right" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
(Enum . ,(all-the-icons-material "storage" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-orange))
(Keyword . ,(all-the-icons-material "filter_center_focus" :height 0.85 :v-adjust -0.2))
(Snippet . ,(all-the-icons-material "format_align_center" :height 0.85 :v-adjust -0.2))
(Color . ,(all-the-icons-material "palette" :height 0.85 :v-adjust -0.2))
(File . ,(all-the-icons-faicon "file-o" :height 0.85 :v-adjust -0.05))
(Reference . ,(all-the-icons-material "collections_bookmark" :height 0.85 :v-adjust -0.2))
(Folder . ,(all-the-icons-faicon "folder-open" :height 0.85 :v-adjust -0.05))
(EnumMember . ,(all-the-icons-material "format_align_right" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
(Constant . ,(all-the-icons-faicon "square-o" :height 0.85 :v-adjust -0.05))
(Struct . ,(all-the-icons-material "settings_input_component" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-orange))
(Event . ,(all-the-icons-faicon "bolt" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-orange))
(Operator . ,(all-the-icons-material "control_point" :height 0.85 :v-adjust -0.2))
(TypeParameter . ,(all-the-icons-faicon "arrows" :height 0.8 :v-adjust -0.05))
(Template . ,(all-the-icons-material "format_align_center" :height 0.85 :v-adjust -0.2)))
company-box-icons-alist 'company-box-icons-all-the-icons)))
;; -CompanyBoxPac
(provide 'init-company)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-company.el ends here

View File

@ -0,0 +1,112 @@
;;; 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: 2.0.0
;; Last-Updated: Mon Dec 9 20:49:39 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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 "Mikaël Capelle")
(setq user-mail-address "capelle.mikael@gmail.com")
;; -UserInfo
;; Consts
(defconst *sys/gui*
(display-graphic-p)
"Are we running on a GUI Emacs?")
(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 *sys/root*
(string-equal "root" (getenv "USER"))
"Are you a ROOT user?")
(defconst *rg*
(executable-find "rg")
"Do we have ripgrep?")
(defconst *python*
(executable-find "python")
"Do we have python?")
(defconst *python3*
(executable-find "python3")
"Do we have python3?")
(defconst *tr*
(executable-find "tr")
"Do we have tr?")
(defconst *mvn*
(executable-find "mvn")
"Do we have Maven?")
(defconst *clangd*
(or (executable-find "clangd") ;; usually
(executable-find "/usr/local/opt/llvm/bin/clangd")) ;; macOS
"Do we have clangd?")
(defconst *gcc*
(executable-find "gcc")
"Do we have gcc?")
(defconst *git*
(executable-find "git")
"Do we have git?")
(defconst *pdflatex*
(executable-find "pdflatex")
"Do we have pdflatex?")
(defconst *eaf-env*
(and *sys/linux* *sys/gui* *python3*
(executable-find "pip")
(not (equal (shell-command-to-string "pip freeze | grep '^PyQt\\|PyQtWebEngine'") "")))
"Check basic requirements for EAF to run.")
;; -Consts
(provide 'init-const)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-const.el ends here

View File

@ -0,0 +1,56 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Dec 26 22:02:32 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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))
: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

View File

@ -0,0 +1,90 @@
;;; init-dashboard.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-dashboard.el
;; Description: Initialize Dashboard
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:21:46 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Mon Dec 23 18:19:44 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d dashboard
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes dashboard
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; DashboardPac
(use-package dashboard
:demand
:diminish (dashboard-mode page-break-lines-mode)
:bind ("C-z d" . open-dashboard)
:custom
(dashboard-banner-logo-title "Close the world. Open the nExt.")
(dashboard-startup-banner (expand-file-name "images/KEC_Dark_BK_Small.png" user-emacs-directory))
(dashboard-items '((recents . 7)
(bookmarks . 7)
(agenda . 5)))
(initial-buffer-choice (lambda () (get-buffer dashboard-buffer-name)))
(dashboard-set-heading-icons t)
(dashboard-set-navigator t)
(dashboard-navigator-buttons
(if (featurep 'all-the-icons)
`(((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust -0.05)
"M-EMACS" "Browse M-EMACS Homepage"
(lambda (&rest _) (browse-url "https://github.com/MatthewZMD/.emacs.d")))
(,(all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1)
"Configuration" "" (lambda (&rest _) (edit-configs)))))
`((("" "M-EMACS" "Browse M-EMACS Homepage"
(lambda (&rest _) (browse-url "https://github.com/MatthewZMD/.emacs.d")))
("" "Configuration" "" (lambda (&rest _) (edit-configs)))))))
:custom-face
(dashboard-banner-logo-title ((t (:family "Love LetterTW" :height 123))))
:config
(dashboard-modify-heading-icons '((recents . "file-text")
(bookmarks . "book")))
(dashboard-setup-startup-hook)
;; Open Dashboard function
(defun open-dashboard ()
"Open the *dashboard* buffer and jump to the first widget."
(interactive)
(if (get-buffer dashboard-buffer-name)
(kill-buffer dashboard-buffer-name))
(dashboard-insert-startupify-lists)
(switch-to-buffer dashboard-buffer-name)
(goto-char (point-min))
(delete-other-windows)))
;; -DashboardPac
;; PBLPac
(use-package page-break-lines
:diminish
:init (global-page-break-lines-mode))
;; -PBLPac
(provide 'init-dashboard)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-dashboard.el ends here

View File

@ -0,0 +1,102 @@
;;; 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: 2.0.0
;; Last-Updated: Wed Dec 25 02:33:09 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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)
("C-x j" . dired-jump-other-window))
:custom
;; Always delete and copy recursively
(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
;; SuperSave
(use-package super-save
:diminish
:custom
(super-save-auto-save-when-idle t)
(auto-save-default nil)
(make-backup-files nil)
:config
(super-save-mode 1))
;; -SuperSave
;; 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,47 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Aug 8 16:05:23 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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

View File

@ -0,0 +1,52 @@
;;; init-dumb-jump.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-dumb-jump.el
;; Description: Initialize Dumb Jump
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:11:21 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Sat Aug 24 22:07:00 2019 (+0000)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes dumb-jump
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; DumbJump
(use-package dumb-jump
:bind
(:map prog-mode-map
(("C-c C-o" . dumb-jump-go-other-window)
("C-c C-j" . dumb-jump-go)
("C-c C-i" . dumb-jump-go-prompt)))
:custom (dumb-jump-selector 'ivy))
;; -DumbJump
(provide 'init-dumb-jump)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-dumb-jump.el ends here

View File

@ -0,0 +1,67 @@
;;; init-eaf.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-eaf.el
;; Description: Initialize Emacs Application Framework
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Jun 4 00:26:09 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Fri Dec 27 22:07:41 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d pdf-tools
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes Emacs Application Framework
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; EAFPac
(use-package eaf
:load-path (lambda () (expand-file-name "site-elisp/emacs-application-framework" user-emacs-directory))
:if *eaf-env*
:custom
(eaf-find-alternate-file-in-dired t)
(browse-url-browser-function 'eaf-open-browser) ;; Make EAF Browser my default browser
:config
(defalias 'browse-web #'eaf-open-browser)
;; I already bind "RET", "<mouse-2>", "^" to `dired-find-alternate-file' in `init-dired.el'.
;; Comment this line out of you don't want to use EAF to open available files in dired.
;; (global-set-key [remap dired-find-alternate-file] #'eaf-file-open-in-dired)
(eaf-bind-key scroll_up "RET" eaf-pdf-viewer-keybinding)
(eaf-bind-key scroll_down_page "DEL" eaf-pdf-viewer-keybinding)
(eaf-bind-key scroll_down_page "u" eaf-pdf-viewer-keybinding)
(eaf-bind-key scroll_up_page "d" eaf-pdf-viewer-keybinding)
(eaf-bind-key scroll_to_end "M->" eaf-pdf-viewer-keybinding)
(eaf-bind-key scroll_to_home "M-<" eaf-pdf-viewer-keybinding)
(eaf-bind-key quit-window "q" eaf-pdf-viewer-keybinding)
(eaf-bind-key take_photo "p" eaf-camera-keybinding))
;; -EAFPac
(provide 'init-eaf)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-eaf.el ends here

View File

@ -0,0 +1,73 @@
;;; init-edit.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-edit.el
;; Description: Initialize Editing Configuration
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 28 13:25:24 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 11:50:24 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d iedit
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes iedit, awesome-pair, delete-block
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; IEditPac
(use-package iedit
:bind ("C-z ," . iedit-mode)
:diminish)
;; -IEditPac
;; AwesomePairPac
(use-package awesome-pair
:load-path (lambda () (expand-file-name "site-elisp/awesome-pair" user-emacs-directory))
:bind
(:map prog-mode-map
(("M-D" . awesome-pair-kill)
("SPC" . awesome-pair-space)
("=" . awesome-pair-equal)
("M-F" . awesome-pair-jump-right)
("M-B" . awesome-pair-jump-left)))
:hook (prog-mode . awesome-pair-mode))
;; -AwesomePairPac
;; DeleteBlockPac
(use-package delete-block
:load-path (lambda () (expand-file-name "site-elisp/delete-block" user-emacs-directory))
:bind
(("M-d" . delete-block-forward)
("C-<backspace>" . delete-block-backward)
("M-<backspace>" . delete-block-backward)
("M-DEL" . delete-block-backward)))
;; -DeleteBlockPac
(provide 'init-edit)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-edit.el ends here

View File

@ -0,0 +1,48 @@
;;; init-ein.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-ein.el
;; Description: Initialize Emacs IPython Notebook Client
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 21 14:04:50 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:05:40 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d ein jupyter
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes Jupyter (formerly IPython) client for 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:
;; EINPac
(use-package ein
:disabled
:defer t)
;; -EINPac
(provide 'init-ein)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-ein.el ends here

View File

@ -0,0 +1,58 @@
;;; init-epaint.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-epaint.el
;; Description: Initialize epaint
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Sep 16 15:47:34 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Mon Sep 16 16:17:43 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d epaint
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes epaint
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; EPaintPac
(use-package epaint
:if *sys/gui*
:load-path (lambda () (expand-file-name "site-elisp/epaint" user-emacs-directory))
:commands (epaint)
:init
(with-eval-after-load (quote epaint-context)
(unless (boundp (quote cl-struct-epaint-drawable))
(defvar cl-struct-epaint-drawable (quote epaint-drawable)))
(unless (boundp (quote cl-struct-epaint-gc))
(defvar cl-struct-epaint-gc (quote epaint-gc)))))
;; -EPaintPac
(provide 'init-epaint)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-epaint.el ends here

140
.emacs.d/elisp/init-erc.el Normal file
View File

@ -0,0 +1,140 @@
;;; init-erc.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-erc.el
;; Description: Initialize ERC
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Jul 30 22:15:50 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Wed Dec 4 01:57:57 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d erc irc
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes erc
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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)
(require 'init-func))
;; ERCPac
(use-package erc
:ensure nil
:init
(use-package erc-hl-nicks :defer t)
(use-package erc-image :defer t)
:custom-face
(erc-notice-face ((t (:foreground "#ababab"))))
:custom
(erc-autojoin-channels-alist '(("freenode.net" "#emacs")))
(erc-track-exclude-types '("NICK" "PART" "MODE" "324" "329" "332" "333" "353" "477"))
(erc-hide-list '("JOIN" "PART" "QUIT"))
(erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
(erc-server-coding-system '(utf-8 . utf-8))
(erc-interpret-mirc-color t)
(erc-kill-buffer-on-part t)
(erc-kill-queries-on-quit t)
(erc-kill-server-buffer-on-quit t)
(erc-autojoin-timing 'ident)
(erc-fill-function 'erc-fill-static)
(erc-fill-static-center 15)
(erc-lurker-threshold-time 43200)
(erc-server-reconnect-attempts 5)
(erc-server-reconnect-timeout 3)
(erc-prompt-for-password nil)
(erc-prompt-for-nickserv-password nil)
:config
;; Prerequisite: Configure this to your IRC nickname
(defvar erc-nick ""
"The nickname used to login into ERC")
(add-to-list 'erc-modules 'notifications)
(erc-track-mode t)
(erc-services-mode 1)
(defun erc-start-or-switch ()
"Start ERC or switch to ERC buffer if it has started already."
(interactive)
(if (get-buffer "irc.freenode.net:6697")
(erc-track-switch-buffer 1)
(erc-tls :server "irc.freenode.net" :port 6697 :nick erc-nick)))
(defun erc-count-users ()
"Displays the number of users and ops connected on the current channel."
(interactive)
(if (get-buffer "irc.freenode.net:6697")
(let ((channel (erc-default-target)))
(if (and channel (erc-channel-p channel))
(let ((hash-table (with-current-buffer (erc-server-buffer)
erc-server-users))
(users 0)
(ops 0))
(maphash (lambda (k v)
(when (member (current-buffer)
(erc-server-user-buffers v))
(cl-incf users))
(when (erc-channel-user-op-p k)
(cl-incf ops)))
hash-table)
(message "%d users (%s ops) are online on %s" users ops channel))
(user-error "The current buffer is not a channel")))
(user-error "You must first be connected on IRC")))
(defun erc-get-ops ()
"Displays the names of ops users on the current channel."
(interactive)
(if (get-buffer "irc.freenode.net:6697")
(let ((channel (erc-default-target)))
(if (and channel (erc-channel-p channel))
(let (ops)
(maphash (lambda (nick cdata)
(if (and (cdr cdata)
(erc-channel-user-op (cdr cdata)))
(setq ops (cons nick ops))))
erc-channel-users)
(if ops
(message "The online ops users are: %s" (mapconcat 'identity ops " "))
(message "There are no ops users online on %s" channel)))
(user-error "The current buffer is not a channel")))
(user-error "You must first be connected on IRC")))
(defun erc-notify (nickname message)
"Displays a notification message for ERC."
(let* ((channel (buffer-name))
(nick (erc-hl-nicks-trim-irc-nick nickname))
(title (if (string-match-p (concat "^" nickname) channel)
nick
(concat nick " (" channel ")")))
(msg (s-trim (s-collapse-whitespace message))))
(alert (concat nick ": " msg) :title title)))
:bind
("M-z i" . erc-start-or-switch)
:hook
(ercn-notify . erc-notify))
;; -ERCPac
(provide 'init-erc)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-erc.el ends here

View File

@ -0,0 +1,50 @@
;;; init-ess.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-ess.el
;; Description: Initialize ESS
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Sep 3 21:28:26 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Wed Sep 4 00:27:58 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d ess
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initialies ESS
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; ESSPac
(use-package ess
:defer t
:commands R
:config
(load "ess-autoloads"))
;; -ESSPac
(provide 'init-ess)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-ess.el ends here

View File

@ -0,0 +1,58 @@
;;; init-eww.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-eww.el
;; Description: Configure Eww
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 11:13:42 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 12:18:07 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d eww
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes eww
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; EWWPac
(use-package eww
:ensure nil
:commands (eww)
:hook (eww-mode . (lambda ()
"Rename EWW's buffer so sites open in new page."
(rename-buffer "eww" t)))
:config
;; I am using EAF-Browser instead of EWW
(unless *eaf-env*
(setq browse-url-browser-function 'eww-browse-url))) ; Hit & to browse url with system browser
;; -EWWPac
(provide 'init-eww)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-eww.el ends here

View File

@ -0,0 +1,64 @@
;;; init-flycheck.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-flycheck.el
;; Description: Initialize Flycheck
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:08:22 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:05:47 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d flycheck
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes flycheck
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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
:hook (prog-mode . flycheck-mode)
:custom
(flycheck-emacs-lisp-load-path 'inherit)
:config
(add-hook 'flycheck-after-syntax-check-hook 'flycheck-autolist-hook)
(flycheck-add-mode 'javascript-eslint 'js-mode)
(flycheck-add-mode 'typescript-tslint 'rjsx-mode))
;; -FlyCheckPac
(use-package flycheck-pos-tip
:after (flycheck)
:config
(add-hook 'flycheck-mode-hook 'flycheck-pos-tip-mode))
(use-package flycheck-color-mode-line
:after (flycheck)
:config
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
(provide 'init-flycheck)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-flycheck.el ends here

View File

@ -0,0 +1,82 @@
;;; init-fonts.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-fonts.el
;; Description: Initialize Fonts
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:32:54 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Sat Dec 28 16:01:14 2019 (+0100)
;; By: Mikaël Capelle
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d fonts
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes fonts
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; FontsList
;; Input Mono, Monaco Style, Line Height 1.3 download
;; from http://input.fontbureau.com/
(defvar font-list '(
("Input" . 11)
("SF Mono" . 12)
("Consolas" . 12) ("Love LetterTW" . 12.5))
"List of fonts and sizes. The first one available will be used.")
;; -FontsList
;; FontFun
(defun change-font ()
"Documentation."
(interactive)
(let* (available-fonts font-name font-size font-setting)
(dolist (font font-list (setq available-fonts (nreverse available-fonts)))
(when (member (car font) (font-family-list))
(push font available-fonts)))
(if (not available-fonts)
(message "No fonts from the chosen set are available")
(if (called-interactively-p 'interactive)
(let* ((chosen
(assoc-string
(completing-read "What font to use? " available-fonts nil t)
available-fonts)))
(setq font-name (car chosen)
font-size (read-number "Font size: " (cdr chosen))))
(setq font-name (caar available-fonts)
font-size (cdar available-fonts)))
(setq font-setting (format "%s-%d" font-name font-size))
(set-frame-font font-setting nil t)
(add-to-list 'default-frame-alist (cons 'font font-setting)))))
(when *sys/gui*
(change-font))
;; -FontFun
(provide 'init-fonts)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-fonts.el ends here

View File

@ -0,0 +1,47 @@
;;; init-format.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-format.el
;; Description: Initialize Formatter
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:27:40 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:05:52 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d format-all
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes format-all
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; FormatAllPac
(use-package format-all
:bind ("C-c C-f" . format-all-buffer))
;; -FormatAllPac
(provide 'init-format)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-format.el ends here

184
.emacs.d/elisp/init-func.el Normal file
View File

@ -0,0 +1,184 @@
;;; 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: 2.0.0
;; Last-Updated: Fri Dec 27 01:02:58 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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
(global-set-key (kbd "M-W =") (lambda () (interactive) (resize-window t 5)))
(global-set-key (kbd "M-W M-+") (lambda () (interactive) (resize-window t 5)))
(global-set-key (kbd "M-W -") (lambda () (interactive) (resize-window t -5)))
(global-set-key (kbd "M-W M-_") (lambda () (interactive) (resize-window t -5)))
(global-set-key (kbd "M-H =") (lambda () (interactive) (resize-window nil 5)))
(global-set-key (kbd "M-H M-+") (lambda () (interactive) (resize-window nil 5)))
(global-set-key (kbd "M-H -") (lambda () (interactive) (resize-window nil -5)))
(global-set-key (kbd "M-H M-_") (lambda () (interactive) (resize-window nil -5)))
;; -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 (filePath)
"Return a list of lines of a file at FILEPATH."
(with-temp-buffer (insert-file-contents filePath)
(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

View File

@ -0,0 +1,68 @@
;;; init-games.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-games.el
;; Description: Initialize Games
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 11:16:53 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Dec 26 02:55:21 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d tetris speed-type 2048
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes tetris, speed-type, 2048
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; TetrisConfig
(use-package tetris
:ensure nil
:commands (tetris)
:bind
(:map tetris-mode-map
("C-p" . tetris-rotate-prev)
("C-n" . tetris-rotate-down)
("C-b" . tetris-move-left)
("C-f" . tetris-move-right)
("C-SPC" . tetris-move-bottom))
:config
(defadvice tetris-end-game (around zap-scores activate)
(save-window-excursion ad-do-it)))
;; -TetrisConfig
;; SpeedTypePac
(use-package speed-type
:commands (speed-type-text))
;; -SpeedTypePac
;; 2048Pac
(use-package 2048-game
:commands (2048-game))
;; -2048Pac
(provide 'init-games)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-games.el ends here

View File

@ -0,0 +1,176 @@
;;; 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: 2.0.0
;; Last-Updated: Wed Dec 25 03:02:50 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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 "C-x C-z") nil)
(global-set-key (kbd "M-/") nil)
;; Use iBuffer instead of Buffer List
(global-set-key (kbd "C-x C-b") #'ibuffer)
;; 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-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 *sys/gui*
(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 ()
"Sometimes `delete-trailing-whitespace' becomes very annoying.
It deletes trailing whitespace current line. Therefore I use this alternative."
(interactive)
(let ((begin (line-beginning-position))
(end (line-end-position)))
(save-excursion
(when (< (point-min) begin)
(save-restriction
(narrow-to-region (point-min) (1- begin))
(delete-trailing-whitespace)
(widen)))
(when (> (point-max) end)
(save-restriction
(narrow-to-region (+ end 2) (point-max))
(delete-trailing-whitespace)
(widen))))))
(add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line)
;; 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
;; 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)
;; 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))
;; -SmallConfigs
(provide 'init-global-config)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-global-config.el ends here

View File

@ -0,0 +1,54 @@
;;; init-header.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-header.el
;; Description: Initialize Header2
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:32:02 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 11:54:28 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d header2
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes header2
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; Header2Pac
(use-package header2
:load-path (lambda () (expand-file-name "site-elisp/header2" user-emacs-directory))
:custom
(header-copyright-notice (concat "Copyright (C) 2019 " (user-full-name) "\n"))
:hook (emacs-lisp-mode . auto-make-header)
:config
(add-to-list 'write-file-functions 'auto-update-file-header)
(autoload 'auto-make-header "header2")
(autoload 'auto-update-file-header "header2"))
;; -Header2Pac
(provide 'init-header)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-header.el ends here

View File

@ -0,0 +1,75 @@
;;; init-indent.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-indent.el
;; Description: Initialize Indentation
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:29:56 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 3 21:41:41 2019 (-0500)
;; By: User Account1
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d highlight-indent-guides indentation
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes highlight-indent-guides
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; HighLightIndentPac
(use-package highlight-indent-guides
:if *sys/gui*
:diminish
:hook ((prog-mode web-mode nxml-mode) . highlight-indent-guides-mode)
:custom
(highlight-indent-guides-method 'character)
(highlight-indent-guides-responsive 'top)
(highlight-indent-guides-delay 0)
(highlight-indent-guides-auto-character-face-perc 7))
;; -HighLightIndentPac
;; IndentConfig
(setq-default indent-tabs-mode nil)
(setq-default indent-line-function 'insert-tab)
(setq-default tab-width 4)
(setq-default c-basic-offset 4)
(setq-default js-switch-indent-offset 4)
(c-set-offset 'comment-intro 0)
(c-set-offset 'innamespace 0)
(c-set-offset 'case-label '+)
(c-set-offset 'access-label 0)
(c-set-offset (quote cpp-macro) 0 nil)
(add-hook 'after-change-major-mode-hook
(lambda () (if (equal electric-indent-mode 't)
(when (derived-mode-p 'text-mode)
(electric-indent-mode -1))
(electric-indent-mode 1))))
;; -IndentConfig
(provide 'init-indent)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-indent.el ends here

View File

@ -0,0 +1,56 @@
;;; init-java.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-java.el
;; Description: Initialize lsp-java java-one-click-run
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Jul 4 21:26:24 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:06:55 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d lsp-java java-one-click-run
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes lsp-java and java-one-click-run
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; LSPJavaPac
(use-package lsp-java
:after lsp-mode
:if *mvn*
:config
(use-package request :defer t)
:custom
(lsp-java-server-install-dir (expand-file-name "~/.emacs.d/eclipse.jdt.ls/server/"))
(lsp-java-workspace-dir (expand-file-name "~/.emacs.d/eclipse.jdt.ls/workspace/")))
;; -LSPJavaPac
(provide 'init-java)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-java.el ends here

View File

@ -0,0 +1,79 @@
;;; init-latex.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-latex.el
;; Description: Initialize AUCTex
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Wed Sep 4 16:35:00 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 12:00:08 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d auctex
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes AUCTex
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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 'init-global-config)
(require 'init-func))
;; AUCTeXPac
(use-package tex
:ensure auctex
:defer t
:custom
(TeX-auto-save t)
(TeX-parse-self t)
(TeX-master nil)
;; to use pdfview with auctex
(TeX-view-program-selection '((output-pdf "pdf-tools"))
TeX-source-correlate-start-server t)
(TeX-view-program-list '(("pdf-tools" "TeX-pdf-tools-sync-view")))
(TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
:hook
(LaTeX-mode . (lambda ()
(turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(reftex-isearch-minor-mode)
(setq TeX-PDF-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-source-correlate-start-server t)))
:config
(when (version< emacs-version "26")
(add-hook LaTeX-mode-hook #'display-line-numbers-mode)))
;; -AUCTeXPac
;; OrgLatexPac
(use-package org-edit-latex
:defer t
:after org)
;; -OrgLatexPac
(provide 'init-latex)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-latex.el ends here

View File

@ -0,0 +1,57 @@
;;; init-leetcode.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-leetcode.el
;; Description: Initialize LeetCode Client
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Apr 11 22:28:41 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Sat Sep 7 00:52:17 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d leetcode
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes a LeetCode client
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; LeetCodePac
(use-package leetcode
:load-path (lambda () (expand-file-name "site-elisp/leetcode.el" user-emacs-directory))
:commands (leetcode)
:init
(use-package graphql :defer t)
(use-package aio :defer t)
:custom
(url-debug t)
(leetcode-prefer-language "python3"))
;; -LeetCodePac
(provide 'init-leetcode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-leetcode.el ends here

114
.emacs.d/elisp/init-lsp.el Normal file
View File

@ -0,0 +1,114 @@
;;; init-lsp.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-lsp.el
;; Description: Initialize LSP
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:42:09 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Dec 26 01:56:25 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d lsp
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes lsp-mode and dap-mode
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; LSPPac
(use-package lsp-mode
:defer t
:commands lsp
:custom
(lsp-auto-guess-root nil)
(lsp-prefer-flymake nil) ; Use flycheck instead of flymake
(lsp-file-watch-threshold 2000)
(read-process-output-max (* 1024 1024))
:bind (:map lsp-mode-map ("C-c C-f" . lsp-format-buffer))
:hook ((java-mode python-mode go-mode
js-mode js2-mode typescript-mode web-mode
c-mode c++-mode objc-mode) . lsp))
;; -LSPPac
;; LSPUI
(use-package lsp-ui
:after lsp-mode
:diminish
:commands lsp-ui-mode
:custom-face
(lsp-ui-doc-background ((t (:background nil))))
(lsp-ui-doc-header ((t (:inherit (font-lock-string-face italic)))))
:bind (:map lsp-ui-mode-map
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
([remap xref-find-references] . lsp-ui-peek-find-references)
("C-c u" . lsp-ui-imenu))
:custom
(lsp-ui-doc-enable t)
(lsp-ui-doc-header t)
(lsp-ui-doc-include-signature t)
(lsp-ui-doc-position 'top)
(lsp-ui-doc-border (face-foreground 'default))
(lsp-ui-sideline-enable nil)
(lsp-ui-sideline-ignore-duplicate t)
(lsp-ui-sideline-show-code-actions nil)
:config
;; Use lsp-ui-doc-webkit only in GUI
(if *sys/gui*
(setq lsp-ui-doc-use-webkit t))
;; WORKAROUND Hide mode-line of the lsp-ui-imenu buffer
;; https://github.com/emacs-lsp/lsp-ui/issues/243
(defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
(setq mode-line-format nil)))
;; -LSPUI
;; DAPPac
(use-package dap-mode
:diminish
:bind
(:map dap-mode-map
(("<f12>" . dap-debug)
("<f8>" . dap-continue)
("<f9>" . dap-next)
("<M-f11>" . dap-step-in)
("C-M-<f11>" . dap-step-out)
("<f7>" . dap-breakpoint-toggle)))
:hook ((after-init . dap-mode)
(dap-mode . dap-ui-mode)
(python-mode . (lambda () (require 'dap-python)))
(ruby-mode . (lambda () (require 'dap-ruby)))
(go-mode . (lambda () (require 'dap-go)))
(java-mode . (lambda () (require 'dap-java)))
((c-mode c++-mode objc-mode swift) . (lambda () (require 'dap-lldb)))
(php-mode . (lambda () (require 'dap-php)))
(elixir-mode . (lambda () (require 'dap-elixir)))
((js-mode js2-mode typescript-mode) . (lambda () (require 'dap-chrome)))))
;; -DAPPac
(provide 'init-lsp)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-lsp.el ends here

View File

@ -0,0 +1,51 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Aug 8 16:07:17 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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:
(eval-when-compile
(require 'init-const))
;; MagitPac
(use-package magit
:if *git*
:bind ("C-x g" . magit-status))
;; -MagitPac
(provide 'init-magit)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-magit.el ends here

130
.emacs.d/elisp/init-mu4e.el Normal file
View File

@ -0,0 +1,130 @@
;;; init-mu4e.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-mu4e.el
;; Description: Initialize mu4e
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Dec 2 15:17:14 2019 (-0500)
;; Version: 2.0.0
;; Package-Requires: (mu4e)
;; Last-Updated:
;; By:
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d mu mu4e
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes mu4e for Email clients in 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:
;; Mu4ePac
(use-package mu4e
:ensure nil
:commands (mu4e)
:init
(use-package mu4e-alert
:defer t
:config
(when (executable-find "notify-send")
(mu4e-alert-set-default-style 'libnotify))
:hook
((after-init . mu4e-alert-enable-notifications)
(after-init . mu4e-alert-enable-mode-line-display)))
(use-package mu4e-overview :defer t)
:bind ("M-z m" . mu4e)
:custom
(mu4e-maildir (expand-file-name "~/Maildir"))
(mu4e-get-mail-command "mbsync -c ~/.emacs.d/mu4e/.mbsyncrc -a")
(mu4e-view-prefer-html t)
(mu4e-update-interval 180)
(mu4e-headers-auto-update t)
(mu4e-compose-signature-auto-include nil)
(mu4e-compose-format-flowed t)
(mu4e-view-show-images t)
(mu4e-sent-messages-behavior 'delete)
(mu4e-change-filenames-when-moving t) ; work better for mbsync
(mu4e-attachment-dir "~/Downloads")
(message-kill-buffer-on-exit t)
(mu4e-compose-dont-reply-to-self t)
(mu4e-view-show-addresses t)
(mu4e-confirm-quit nil)
(mu4e-use-fancy-chars t)
:hook
((mu4e-view-mode . visual-line-mode)
(mu4e-compose-mode . (lambda ()
(visual-line-mode)
(use-hard-newlines -1)
(flyspell-mode)))
(mu4e-view-mode . (lambda() ;; try to emulate some of the eww key-bindings
(local-set-key (kbd "<tab>") 'shr-next-link)
(local-set-key (kbd "<backtab>") 'shr-previous-link)))
(mu4e-headers-mode . (lambda ()
(interactive)
(setq mu4e-headers-fields
`((:human-date . 25) ;; alternatively, use :date
(:flags . 6)
(:from . 22)
(:thread-subject . ,(- (window-body-width) 70)) ;; alternatively, use :subject
(:size . 7))))))
:config
(add-to-list 'mu4e-view-actions
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
(setq mu4e-contexts
(list
(make-mu4e-context
:name "gmail"
:enter-func (lambda () (mu4e-message "Entering context gmail"))
:leave-func (lambda () (mu4e-message "Leaving context gmail"))
:match-func
(lambda (msg)
(when msg
(mu4e-message-contact-field-matches
msg '(:from :to :cc :bcc) user-mail-address))) ; Set to your email address
:vars '((mu4e-refile-folder "/gmail/Archive")
(mu4e-sent-folder . "/gmail/[email].Sent Mail")
(mu4e-drafts-folder . "/gmail/[email].Drafts")
(mu4e-trash-folder . "/gmail/[email].Trash")
(mu4e-compose-signature . user-full-name)
(mu4e-compose-format-flowed . t)
(smtpmail-queue-dir . "~/Maildir/gmail/queue/cur")
(message-send-mail-function . smtpmail-send-it)
(smtpmail-smtp-user . "matthewzmd") ; Set to your username
(smtpmail-starttls-credentials . (("smtp.gmail.com" 587 nil nil)))
(smtpmail-auth-credentials . (expand-file-name "~/.authinfo.gpg"))
(smtpmail-default-smtp-server . "smtp.gmail.com")
(smtpmail-smtp-server . "smtp.gmail.com")
(smtpmail-smtp-service . 587)
(smtpmail-debug-info . t)
(smtpmail-debug-verbose . t)
(mu4e-maildir-shortcuts . ( ("/gmail/INBOX" . ?i)
("/gmail/[email].Sent Mail" . ?s)
("/gmail/[email].Trash" . ?t)
("/gmail/[email].All Mail" . ?a)
("/gmail/[email].Starred" . ?r)
("/gmail/[email].Drafts" . ?d))))))))
;; -Mu4ePac
(provide 'init-mu4e)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-mu4e.el ends here

114
.emacs.d/elisp/init-org.el Normal file
View File

@ -0,0 +1,114 @@
;;; 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: 2.0.0
;; Last-Updated: Tue Dec 24 14:05:45 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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)
("C-c b" . org-switch)
(:map org-mode-map ("C-c C-p" . org-export-as-pdf-and-open))
:custom
(org-log-done 'time)
(org-export-backends (quote (ascii html icalendar latex md odt)))
(org-use-speed-commands t)
(org-confirm-babel-evaluate 'nil)
(org-todo-keywords
'((sequence "TODO" "IN-PROGRESS" "REVIEW" "|" "DONE")))
(org-agenda-window-setup 'other-window)
:config
(unless (version< org-version "9.2")
(require 'org-tempo))
(when (file-directory-p "~/org/agenda/")
(setq org-agenda-files (list "~/org/agenda/")))
(defun org-export-turn-on-syntax-highlight ()
"Setup variables to turn on syntax highlighting when calling `org-latex-export-to-pdf'."
(interactive)
(setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shelnl-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")))
(defun org-export-as-pdf-and-open ()
"Run `org-latex-export-to-pdf', delete the tex file and open pdf in a new buffer."
(interactive)
(save-buffer)
(let* ((pdf-path (org-latex-export-to-pdf))
(pdf-name (file-name-nondirectory pdf-path)))
(if (try-completion pdf-name (mapcar #'buffer-name (buffer-list)))
(progn
(kill-matching-buffers (concat "^" pdf-name) t t)
(find-file-other-window pdf-name))
(find-file-other-window pdf-name))
(delete-file (concat (substring pdf-path 0 (string-match "[^\.]*\/?$" pdf-path)) "tex")))))
;; -OrgPac
;; 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"))
:config
(org-babel-do-load-languages
'org-babel-load-languages
'(;; other Babel languages
(plantuml . t))))
;; -PlantUMLPac
(provide 'init-org)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-org.el ends here

View File

@ -0,0 +1,100 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Dec 26 03:37:58 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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" . "http://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

View File

@ -0,0 +1,116 @@
;;; init-parens.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-parens.el
;; Description: Initialize Parenthesis
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:17:13 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 11:48:49 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d parenthesis smartparens delete-block
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes parenthesis smartparens delete-block
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; SmartParensPac
(use-package smartparens
:hook (prog-mode . smartparens-mode)
:diminish smartparens-mode
:bind
(:map smartparens-mode-map
("C-M-f" . sp-forward-sexp)
("C-M-b" . sp-backward-sexp)
("C-M-a" . sp-backward-down-sexp)
("C-M-e" . sp-up-sexp)
("C-M-w" . sp-copy-sexp)
("C-M-k" . sp-change-enclosing)
("M-k" . sp-kill-sexp)
("C-M-<backspace>" . sp-splice-sexp-killing-backward)
("C-S-<backspace>" . sp-splice-sexp-killing-around)
("C-]" . sp-select-next-thing-exchange))
:custom
(sp-escape-quotes-after-insert nil)
:config
;; Stop pairing single quotes in elisp
(sp-local-pair 'emacs-lisp-mode "'" nil :actions nil)
(sp-local-pair 'org-mode "[" nil :actions nil)
;; Smartparens is broken in `cc-mode' as of Emacs 27. See
;; https://github.com/Fuco1/smartparens/issues/963
(unless (version< emacs-version "27")
(dolist (fun '(c-electric-paren c-electric-brace))
(add-to-list 'sp--special-self-insert-commands fun))))
;; -SmartParensPac
;; MatchParens
;; Show matching parenthesis
(show-paren-mode 1)
;; we will call `blink-matching-open` ourselves...
(remove-hook 'post-self-insert-hook
#'blink-paren-post-self-insert-function)
;; this still needs to be set for `blink-matching-open` to work
(setq blink-matching-paren 'show)
(let ((ov nil)) ; keep track of the overlay
(advice-add
#'show-paren-function
:after
(defun show-paren--off-screen+ (&rest _args)
"Display matching line for off-screen paren."
(when (overlayp ov)
(delete-overlay ov))
;; check if it's appropriate to show match info,
;; see `blink-paren-post-self-insert-function'
(when (and (overlay-buffer show-paren--overlay)
(not (or cursor-in-echo-area
executing-kbd-macro
noninteractive
(minibufferp)
this-command))
(and (not (bobp))
(memq (char-syntax (char-before)) '(?\) ?\$)))
(= 1 (logand 1 (- (point)
(save-excursion
(forward-char -1)
(skip-syntax-backward "/\\")
(point))))))
;; rebind `minibuffer-message' called by
;; `blink-matching-open' to handle the overlay display
(cl-letf (((symbol-function #'minibuffer-message)
(lambda (msg &rest args)
(let ((msg (apply #'format-message msg args)))
(setq ov (display-line-overlay+
(window-start) msg))))))
(blink-matching-open))))))
;; -MatchParens
(provide 'init-parens)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-parens.el ends here

View File

@ -0,0 +1,60 @@
;;; init-pdf.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-pdf.el
;; Description: Initialize pdf-tools
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Tue Jun 4 00:26:09 2019 (-0400)
;; Version: 1.0.0
;; Last-Updated: Tue Dec 24 12:11:20 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d pdf-tools
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes pdf-tools
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; PDFToolsPac
(use-package pdf-tools-install
:ensure pdf-tools
:if (and *sys/gui* (not *sys/win32*))
:mode "\\.pdf\\'"
:commands (pdf-loader-install)
:custom
(TeX-view-program-selection '((output-pdf "pdf-tools")))
(TeX-view-program-list '(("pdf-tools" "TeX-pdf-tools-sync-view")))
:hook
(pdf-view-mode . (lambda () (display-line-numbers-mode -1)))
:config
(pdf-loader-install))
;; -PDFToolsPac
(provide 'init-pdf)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-pdf.el ends here

View File

@ -0,0 +1,47 @@
;;; init-popup-kill-ring.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-popup-kill-ring.el
;; Description: Initialize Popup-Kill-Ring
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 15:15:40 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:07:32 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d popup-kill-ring
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes popup-kill-ring
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; PopKillRing
(use-package popup-kill-ring
:bind ("M-y" . popup-kill-ring))
;; -PopKillRing
(provide 'init-popup-kill-ring)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-popup-kill-ring.el ends here

View File

@ -0,0 +1,60 @@
;;; init-projectile.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-projectile.el
;; Description: Initialize Projectile
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 09:10:23 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:07:35 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d projectile
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes projectile
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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))
;; ProjPac
(use-package projectile
:bind
("C-c p" . projectile-command-map)
("C-z o" . projectile-find-file)
("C-z p" . projectile-add-known-project)
:custom
(projectile-completion-system 'ivy)
:config
(projectile-mode 1)
(when (and *sys/win32* *tr*)
(setq projectile-indexing-method 'alien))
(add-to-list 'projectile-globally-ignored-directories "node_modules"))
;; -ProjPac
(provide 'init-projectile)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-projectile.el ends here

View File

@ -0,0 +1,69 @@
;;; init-pyim.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-pyim.el
;; Description: Initialize Pyim
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Jun 20 00:36:05 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Dec 26 21:54:20 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d init
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes pyim
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; PyimPac
(use-package pyim
:init
(use-package posframe :defer t)
:custom
(default-input-method "pyim")
(pyim-default-scheme 'quanpin)
(pyim-page-tooltip 'posframe)
(pyim-page-length 9)
:config
(pyim-isearch-mode 1)
(setq-default pyim-english-input-switch-functions
'(pyim-probe-isearch-mode
pyim-probe-org-structure-template))
(setq-default pyim-punctuation-half-width-functions
'(pyim-probe-punctuation-line-beginning
pyim-probe-punctuation-after-punctuation))
:bind
("M-j" . pyim-convert-string-at-point)) ; M-j 强制将光标前的拼音字符串转换为中文。
;; -PyimPac
;; PyimBaseDictPac
(use-package pyim-basedict
:after pyim
:config (pyim-basedict-enable))
;; -PyimBaseDictPac
(provide 'init-pyim)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-pyim.el ends here

View File

@ -0,0 +1,91 @@
;;; init-python.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-python.el
;; Description: Initialize Python
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Jun 10 18:58:02 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Sun Dec 29 20:39:58 2019 (+0100)
;; By: Mikaël Capelle
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: lsp-python-ms
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes lsp-python-ms
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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-flycheck)
(require 'init-const))
;; PythonConfig
;; (use-package python-mode
;; :ensure nil
;; :after flycheck
;; :mode "\\.py\\'"
;; :custom
;; (python-indent-offset 4)
;; (flycheck-python-pycompile-executable "python3")
;; (python-shell-interpreter "python3"))
;; ;; -PythonConfig
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
(use-package flycheck-mypy
:after flycheck
:config
(flycheck-add-next-checker 'python-flake8 'python-mypy))
(use-package elpy
:after flycheck
:mode "\\.py\\"
:custom
(flycheck-python-flake8-executable "python")
(python-indent-offset 4)
(python-shell-interpreter "ipython")
(python-shell-interpreter-args "-i --simple-prompt")
:config
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode)
(add-to-list 'python-shell-completion-native-disabled-interpreters
"jupyter")
:init
(setq elpy-rpc-backend "jedi")
;; (setq elpy-rpc-python-command "I:\\Languages\\Python\\Python37\\python.exe")
(elpy-enable))
(add-hook 'python-mode-hook 'hs-minor-mode)
;; LSPPythonPac
;; (use-package lsp-python-ms
;; :after lsp-mode python
;; :if (or *python3* *python*)
;; :custom
;; (lsp-python-executable-cmd "python3"))
;; ;; -LSPPythonPac
(provide 'init-python)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-python.el ends here

View File

@ -0,0 +1,49 @@
;;; init-quickrun.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-quickrun.el
;; Description: Initialize quickrun
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Sun Jul 7 16:32:16 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:07:44 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d init
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes quickrun
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; QuickrunPac
(use-package quickrun
:bind
(("<f5>" . quickrun)
("M-<f5>" . quickrun-shell)))
;; -QuickrunPac
(provide 'init-quickrun)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-quickrun.el ends here

View File

@ -0,0 +1,58 @@
;;; init-scroll.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-scroll.el
;; Description: Initialize Smooth Scroll
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 08:30:08 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:07:50 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d smooth-scroll
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes smooth scroll
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; SmoothScroll
;; Vertical Scroll
(setq scroll-step 1)
(setq scroll-margin 1)
(setq scroll-conservatively 101)
(setq scroll-up-aggressively 0.01)
(setq scroll-down-aggressively 0.01)
(setq auto-window-vscroll nil)
(setq fast-but-imprecise-scrolling nil)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
(setq mouse-wheel-progressive-speed nil)
;; Horizontal Scroll
(setq hscroll-step 1)
(setq hscroll-margin 1)
;; -SmoothScroll
(provide 'init-scroll)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-scroll.el ends here

View File

@ -0,0 +1,114 @@
;;; 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: 2.0.0
;; Last-Updated: Sun Nov 10 14:31:56 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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 snails
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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)
(require 'init-const))
;; 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
("C-r" . ivy-previous-line-or-history)
("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 *rg*
:bind ("C-M-s" . color-rg-search-input))
;; -ColorRGPac
;; SnailsPac
(use-package snails
:load-path (lambda () (expand-file-name "site-elisp/snails/" user-emacs-directory))
:if *sys/gui*
:custom-face
(snails-content-buffer-face ((t (:background "#111" :height 110))))
(snails-input-buffer-face ((t (:background "#222" :foreground "gold" :height 110))))
(snails-header-line-face ((t (:inherit font-lock-function-name-face :underline t :height 1.1))))
:config
(use-package exec-path-from-shell
:if (featurep 'cocoa) :defer t)
;; Functions for specific backends
(defun snails-current-project ()
(interactive)
(snails '(snails-backend-projectile snails-backend-rg snails-backend-fd)))
(defun snails-active-recent-buffers ()
(interactive)
(snails '(snails-backend-buffer snails-backend-recentf)))
(defun snails-everywhere ()
(interactive)
(snails '(snails-backend-everything snails-backend-mdfind)))
:bind
(("M-s s" . snails)
("M-s g" . snails-current-project)
("M-s b" . snails-active-recent-buffers)
("M-s e" . snails-everywhere)))
;; -SnailsPac
(provide 'init-search)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-ag.el ends here

View File

@ -0,0 +1,79 @@
;;; 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: 2.0.0
;; Last-Updated: Tue Oct 8 00:20:32 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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))
;; AweshellPac
(use-package aweshell
:load-path (lambda () (expand-file-name "site-elisp/aweshell" user-emacs-directory))
:commands (aweshell-new aweshell-dedicated-open)
:bind
(("M-#" . aweshell-dedicated-open)
(:map eshell-mode-map ("M-#" . aweshell-dedicated-close))))
;; -AweshellPac
;; 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")))
;; -MultiTermPac
;; TermKeysPac
(use-package term-keys
:if (not *sys/gui*)
:config (term-keys-mode t))
;; -TermKeysPac
(provide 'init-shell)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-shell.el ends here

View File

@ -0,0 +1,70 @@
;;; 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: 2.0.0
;; Last-Updated: Fri Aug 23 10:49:38 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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))
;; 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))
;; -DoomThemes
;; DoomModeline
(use-package doom-modeline
:hook (after-init . doom-modeline-mode)
: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))
;; -DoomModeline
(provide 'init-theme)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-theme.el ends here

View File

@ -0,0 +1,62 @@
;;; init-tramp.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-tramp.el
;; Description: Initialize Tramp
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Aug 9 21:48:32 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Wed Oct 16 16:05:51 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d tramp
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes Tramp
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; TrampPac
(use-package tramp
:ensure nil
:defer 1
:config
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
;; TRAMP gcloud ssh
(add-to-list 'tramp-methods
'("gssh"
(tramp-login-program "gcloud compute ssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/bash")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")))
(tramp-default-port 22))))
;; -TrampPac
(provide 'init-tramp)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-tramp.el ends here

View File

@ -0,0 +1,105 @@
;;; init-treemacs.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-treemacs.el
;; Description: Initialize Treemacs
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 09:56:12 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 11:56:52 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d treemacs
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes treemacs
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; TreemacsPac
(use-package treemacs
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:custom
(treemacs-collapse-dirs 3)
(treemacs-deferred-git-apply-delay 0.5)
(treemacs-display-in-side-window t)
(treemacs-file-event-delay 5000)
(treemacs-file-follow-delay 0.2)
(treemacs-follow-after-init t)
(treemacs-follow-recenter-distance 0.1)
(treemacs-git-command-pipe "")
(treemacs-goto-tag-strategy 'refetch-index)
(treemacs-indentation 2)
(treemacs-indentation-string " ")
(treemacs-is-never-other-window nil)
(treemacs-max-git-entries 5000)
(treemacs-no-png-images nil)
(treemacs-no-delete-other-windows t)
(treemacs-project-follow-cleanup nil)
(treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory))
(treemacs-recenter-after-file-follow nil)
(treemacs-recenter-after-tag-follow nil)
(treemacs-show-cursor nil)
(treemacs-show-hidden-files t)
(treemacs-silent-filewatch nil)
(treemacs-silent-refresh nil)
(treemacs-sorting 'alphabetic-desc)
(treemacs-space-between-root-nodes t)
(treemacs-tag-follow-cleanup t)
(treemacs-tag-follow-delay 1.5)
(treemacs-width 35)
:config
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode t)
:bind
(("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag))
(:map treemacs-mode-map ("C-p" . treemacs-previous-line)))
;; -TreemacsPac
;; TreeMagit
(use-package treemacs-magit
:defer t
:after (treemacs magit))
;; -TreeMagit
;; TreeProj
(use-package treemacs-projectile
:defer t
:after (treemacs projectile))
;; -TreeProj
(provide 'init-treemacs)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-treemacs.el ends here

View File

@ -0,0 +1,103 @@
;;; 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: 2.0.0
;; Last-Updated: Sat Dec 28 18:48:31 2019 (+0100)
;; By: Mikaël Capelle
;; 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))
;; 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)
;; -YorN
;; StartupScreen
(setq inhibit-startup-screen t)
(setq initial-major-mode 'text-mode)
(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
;; Whitespace
(setq-default fill-column 95)
(setq-default whitespace-line-column 95)
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
(add-hook 'LaTeX-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'markdown-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'web-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'text-mode-hook #'whitespace-mode)
(add-hook 'prog-mode-hook #'whitespace-mode)
(add-hook 'before-save-hook 'whitespace-cleanup)
;; -Whitespace
;; DisTimeBat
(display-time-mode 1)
(display-battery-mode 1)
;; -DisTimeBat
(provide 'init-ui-config)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-ui-config.el ends here

View File

@ -0,0 +1,49 @@
;;; init-undo-tree.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-undo-tree.el
;; Description: Initialize Undo Tree
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 15:28:48 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:08:13 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d undo-tree
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes undo-tree
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; UndoTreePac
(use-package undo-tree
:defer t
:diminish undo-tree-mode
:init (global-undo-tree-mode))
;; -UndoTreePac
(provide 'init-undo-tree)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-undo-tree.el ends here

View File

@ -0,0 +1,81 @@
;;; init-webdev.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-webdev.el
;; Description: Initialize Web, Emmet, JS2, TypeScript, Tide
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 11:03:43 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Tue Dec 24 12:03:28 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d web-mode js2-mode typescript-mode emmet instant-rename-tag json-mode
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes web-mode js2-mode typescript-mode emmet instant-rename-tag instant-rename-tag
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; WebModePac
(use-package web-mode
:custom-face
(css-selector ((t (:inherit default :foreground "#66CCFF"))))
(font-lock-comment-face ((t (:foreground "#828282"))))
:mode
("\\.phtml\\'" "\\.tpl\\.php\\'" "\\.[agj]sp\\'" "\\.as[cp]x\\'"
"\\.erb\\'" "\\.mustache\\'" "\\.djhtml\\'" "\\.[t]?html?\\'"))
;; -WebModePac
;; Js2Pac
(use-package js2-mode
:mode "\\.js\\'"
:interpreter "node")
;; -Js2Pac
;; TypeScriptPac
(use-package typescript-mode
:mode "\\.ts\\'"
:commands (typescript-mode))
;; -TypeScriptPac
;; EmmetPac
(use-package emmet-mode
:hook ((web-mode . emmet-mode)
(css-mode . emmet-mode)))
;; -EmmetPac
;; InstantRenameTagPac
(use-package instant-rename-tag
:load-path (lambda () (expand-file-name "site-elisp/instant-rename-tag" user-emacs-directory))
:bind ("C-z <" . instant-rename-tag))
;; -InstantRenameTagPac
;; JsonPac
(use-package json-mode
:mode "\\.json\\'")
;; -JsonPac
(provide 'init-webdev)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-webdev.el ends here

View File

@ -0,0 +1,52 @@
;;; 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: 2.0.0
;; Last-Updated: Thu Aug 8 16:08:23 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; 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

View File

@ -0,0 +1,61 @@
;;; init-winner.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-winner.el
;; Description: Initialize Winner Mode
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 14:39:31 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Thu Aug 8 16:08:26 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d winner
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes winner mode
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; WinnerPac
(use-package winner
:ensure nil
:custom
(winner-boring-buffers
'("*Completions*"
"*Compile-Log*"
"*inferior-lisp*"
"*Fuzzy Completions*"
"*Apropos*"
"*Help*"
"*cvs*"
"*Buffer List*"
"*Ibuffer*"
"*esh command on file*"))
:config
(winner-mode 1))
;; -WinnerPac
(provide 'init-winner)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-winner.el ends here

View File

@ -0,0 +1,66 @@
;;; 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: 2.0.0
;; Last-Updated: Sat Dec 14 20:56:21 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; 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) . 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

View File

@ -0,0 +1,59 @@
;;; init-zone.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-zone.el
;; Description: Initialize Zone
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 17:38:34 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Fri Sep 13 00:41:28 2019 (-0400)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d zone
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes zone mode
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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:
;; ZonePac
(use-package zone
:ensure nil
:defer 5
:config
;; (zone-when-idle 600) ; in seconds
(defun zone-choose (pgm)
"Choose a PGM to run for `zone'."
(interactive
(list
(completing-read
"Program: "
(mapcar 'symbol-name zone-programs))))
(let ((zone-programs (list (intern pgm))))
(zone))))
;; -ZonePac
(provide 'init-zone)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-zone.el ends here

461
.emacs.d/init-bak.el Normal file
View File

@ -0,0 +1,461 @@
;;; init.el --- -*- lexical-binding: t -*-
;;; Init file for emacs
;;; Commentary:
;; Init file, load everything necessary to have a full functional Emacs, this should
;; not be used with Emacs < 24.
;;; Code:
(add-to-list 'load-path "~/.emacs.d/one-file-mode/")
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
;; Themes
(setq custom-theme-directory "~/.emacs.d/themes/")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; Packages
(require 'package) ;; You might already have this line
(setq package-user-dir (expand-file-name "elpa" user-emacs-directory)
package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")
("cselpa" . "http://elpa.thecybershadow.net/packages/")))
(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))))
;; 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))
(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))
(use-package diminish)
(require 'iso-transl)
(global-display-line-numbers-mode)
;; No menu, scrollbar, displayline and column
(menu-bar-mode -1)
(tool-bar-mode -1)
(when (display-graphic-p)
(scroll-bar-mode -1))
(column-number-mode t)
(line-number-mode t)
(desktop-save-mode t)
;; Command rebinding
;; M-f (forward-word) : Déplacement d'un mot vers la droite du curseur.
;; M-b (backward-word) : Déplacement d'un mot vers la gauche du curseur.
;; C-a (beginning-of-line) : Déplacement au début de la ligne courante.
;; C-e (end-of-line) : Déplacement à la fin de la ligne courante.
;; M-{ (backward-paragraph) : Déplacement vers le paragraphe précédent.
(global-set-key (kbd "M-p") 'backward-paragraph)
;; M-} (forward-paragraph) : Déplacement vers le paragraphe suivant.
(global-set-key (kbd "M-n") 'forward-paragraph)
;; C-v (scroll-up) : Déplacement d'un écran vers le bas.
;; M-v (scroll-down) : Déplacement d'un écran vers le haut.
;; M-> (end-of-buffer) : Déplacement à la fin du buffer.
;; M-< (beginning-of-buffer) : Déplacement au début du buffer.
(use-package material-theme
:config
(load-theme 'material t))
;; No split screen at startup
(setq inhibit-startup-screen t)
;; Or if you use use-package
(setq dashboard-items '((recents . 5)
;; (bookmarks . 5)
(projects . 5)
(agenda . 5)
(registers . 5)))
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
(setq dashboard-set-navigator t)
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
(add-hook 'dashboard-mode-hook (lambda () (display-line-numbers-mode -1)))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(use-package doom-modeline
:ensure t
:hook (after-init . doom-modeline-mode))
(use-package ace-window
:bind ("C-x C-o" . ace-window))
;; Encoding
(set-language-environment "UTF-8")
;; Selection mode
(delete-selection-mode 1)
;; Indentation mode
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
;; Compilation coloration
(ignore-errors
(require 'ansi-color)
(defun my-colorize-compilation-buffer ()
(when (eq major-mode 'compilation-mode)
(ansi-color-apply-on-region compilation-filter-start (point-max))))
(add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer))
;; Retrieve PATH from fish shell
(when (memq window-system '(mac ns x))
(setq exec-path-from-shell-shell-name "/usr/local/bin/fish")
(exec-path-from-shell-initialize))
;; Auto complete + Yasnippet
(use-package projectile
:config
(projectile-mode 1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-enable-caching t))
(use-package helm
:config
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x r b") 'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(helm-mode 1)
(add-to-list 'helm-boring-buffer-regexp-list "\\*.*"))
(use-package helm-projectile
:after (helm projectile)
:config
(setq projectile-completion-system 'helm)
(helm-projectile-on))
(use-package yasnippet
:config
(yas-global-mode 1))
(use-package flycheck
:config
(add-hook 'flycheck-after-syntax-check-hook 'flycheck-autolist-hook)
(global-flycheck-mode)
(setq flycheck-emacs-lisp-load-path "inherict")
(setq flycheck-clang-args '("-stdlib=libc++" "-W" "-Wall"))
(add-hook 'c++-mode-hook
(lambda ()
(setq-local flycheck-clang-language-standard "c++14"))))
(use-package flycheck-pos-tip
:after (flycheck)
:config
(add-hook 'flycheck-mode-hook 'flycheck-pos-tip-mode))
(use-package flycheck-color-mode-line
:after (flycheck)
:config
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
(use-package company
:config
(add-hook 'after-init-hook 'global-company-mode)
(global-set-key (kbd "M-/") 'company-complete))
(use-package company-c-headers
:config
(add-to-list 'company-backends 'company-c-headers))
(use-package company-jedi
:config
(add-to-list 'company-backends 'company-jedi))
(use-package company-web
:config
(add-to-list 'company-backends 'company-web-html))
; C++
(use-package modern-cpp-font-lock
:ensure t)
(add-hook 'c++-mode-hook #'modern-c++-font-lock-mode)
;; Doc mode
(require 'doc-mode)
(add-hook 'c-mode-common-hook 'doc-mode)
(add-hook 'c++-mode-common-hook 'doc-mode)
;; Latex
(use-package auctex
:defer t
:config
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(defun my-latex-mode-setup ()
"Redefines and updates variables for various customizations."
(setq LaTeX-paragraph-commands
'("If" "State" "Loop" "For" "ForAll"))
(setq LaTeX-begin-regexp
(concat LaTeX-begin-regexp "\\|If\\b" "\\|Loop\\b" "\\|For\\b" "\\|ForAll\\b"))
(setq LaTeX-end-regexp
(concat LaTeX-end-regexp "\\|EndIf\\b" "\\|EndLoop\\b"
"\\|EndFor\\b" "\\|Else\\b" "\\|ElsIf\\b"))
(setq LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make))
(defun LaTeX-indent-level-count ()
"Count indentation change caused by all \\left, \\right, \\begin, and
\\end commands in the current line."
(save-excursion
(save-restriction
(let ((count 0))
(narrow-to-region (point)
(save-excursion
(re-search-forward
(concat "[^" TeX-esc "]"
"\\(" LaTeX-indent-comment-start-regexp
"\\)\\|\n\\|\\'"))
(backward-char)
(point)))
(while (search-forward TeX-esc nil t)
(cond
((looking-at "left\\b")
(setq count (+ count LaTeX-left-right-indent-level)))
((looking-at "right\\b")
(setq count (- count LaTeX-left-right-indent-level)))
((looking-at LaTeX-begin-regexp)
(setq count (+ count LaTeX-indent-level)))
((looking-at "Else\\b"))
((looking-at "ElsIf\\b"))
((looking-at LaTeX-end-regexp)
(setq count (- count LaTeX-indent-level)))
((looking-at (regexp-quote TeX-esc))
(forward-char 1))))
count)))))
(add-to-list 'LaTeX-verbatim-environments "code")
(add-to-list 'LaTeX-indent-environment-list
'("code" current-indentation))
(add-hook 'LaTeX-mode-hook 'my-latex-mode-setup)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(require 'tex)
(TeX-global-PDF-mode t)
)
(use-package company-auctex
:after (auctex company)
:config (company-auctex-init))
;; (add-to-list 'ispell-local-dictionary-alist '("francais-hunspell"
;; "[[:alpha:]]"
;; "[^[:alpha]]"
;; "[']"
;; t
;; ("-d" "fr_FR")
;; nil
;; iso-8859-1))
;; magit
(use-package magit
:config
(add-hook 'after-save-hook 'magit-after-save-refresh-status))
;; CSS style
(setq css-indent-offset 2)
;; Markdown mode
(use-package markdown-mode
:mode "\\.text\\'" "\\.markdown\\'" "\\.md\\'")
;; White space mode & Fill mode column
(defun my-visual-hook ()
(visual-line-mode t)
;; (visual-fill-column-mode t)
(define-key visual-line-mode-map [remap kill-line] nil)
(whitespace-mode t))
(setq-default fill-column 95)
(setq-default whitespace-line-column 95)
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
(add-hook 'LaTeX-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'markdown-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'web-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'text-mode-hook 'my-visual-hook)
(add-hook 'prog-mode-hook 'my-visual-hook)
(add-hook 'before-save-hook 'whitespace-cleanup)
;; Electric pair mode
(electric-pair-mode 1)
(show-paren-mode 1)
(setq show-paren-delay 0)
;; C mode
(setq c-default-style "k&r")
(setq c-basic-offset 4)
(defun ac-cc-mode-setup ()
"Initialization hook for CC-mode runs before any other hooks."
(hide-ifdef-mode)
(hs-minor-mode)
(setq hide-ifdef-shadow t))
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'c++-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
(setq c-doc-comment-style
'((java-mode . javadoc)
(pike-mode . autodoc)
(c-mode . javadoc)
(c++-mode . javadoc)))
(add-to-list 'auto-mode-alist '("\\.hpp\\'" . c++-mode))
;; Run C programs directly from within emacs
(setq execute-command nil)
(setq execute-buffer-name "*output*")
(setq execute-process-name "execute")
(defun set-execute-command ()
(interactive)
(setq sp (split-string (read-from-minibuffer "Execute command: ")))
(setq execute-command (combine-and-quote-strings (cons (file-truename (car sp)) (cdr sp)))))
(defun kill-execute-c-program ()
(interactive)
(if (get-process execute-process-name)
(delete-process (get-process execute-process-name))))
(defun execute-c-program ()
(interactive)
(if (not execute-command) (set-execute-command))
(kill-execute-c-program)
(setq old-buffer (current-buffer))
(setq output-buffer (get-buffer-create execute-buffer-name))
(switch-to-buffer-other-window output-buffer)
(end-of-buffer)
(insert (concat (propertize execute-command 'face 'bold) "\n"))
(switch-to-buffer-other-window old-buffer)
(start-process-shell-command execute-process-name execute-buffer-name execute-command))
(defun key-c-mode-setup ()
(local-set-key (kbd "C-c C-c") 'smart-compile)
(local-set-key (kbd "C-c C-r") 'execute-c-program)
(local-set-key [f3] 'kill-execute-c-program)
(local-set-key [f4] 'set-execute-command))
(add-hook 'c++-mode-common-hook 'key-c-mode-setup)
(add-hook 'c-mode-common-hook 'key-c-mode-setup)
;; Flyspell dictionarie
(defun fd-switch-dictionary ()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "francais") "english" "francais")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))
(defun key-latex-mode-setup ()
(local-set-key [f8] 'fd-switch-dictionary))
(add-hook 'LaTeX-mode-hook 'key-latex-mode-setup)
;; python
(use-package flycheck-mypy)
(use-package elpy
:config
(when (load "flycheck" t t)
(flycheck-add-next-checker 'python-flake8 'python-mypy)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt")
;; (setq python-shell-interpreter "jupyter"
;; python-shell-interpreter-args "console --simple-prompt"
;; python-shell-prompt-detect-failure-warning nil)
(add-to-list 'python-shell-completion-native-disabled-interpreters
"jupyter")
:init
(setq elpy-rpc-backend "jedi")
(setq elpy-rpc-python-command "I:\\Languages\\Python\\Python37\\python.exe")
(elpy-enable))
(add-hook 'python-mode-hook 'hs-minor-mode)
;; Web mode
(add-to-list 'auto-mode-alist '("\\.ctp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
;;(use-package mmm-mode
;; :config
;; (require 'mmm-auto)
;; (setq mmm-global-mode 'maybe)
;; (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
;; (mmm-add-mode-ext-class nil "\\.ctp\\'" 'html-php)
;; (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil html-js))
;; (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil embedded-css))
;; (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil fancy-html)))
;; Go
(require 'go-template-mode)
;; Dockers
(require 'dockerfile-mode)
(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode))
;; Lilypond
(autoload 'LilyPond-mode "lilypond-mode" "LilyPond Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.ly$" . LilyPond-mode))
(add-to-list 'auto-mode-alist '("\\.ily$" . LilyPond-mode))
(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock)))
;; Term
(setq explicit-shell-file-name "/bin/bash")
(defun my-term-hook ()
(visual-fill-column-mode nil)
(visual-line-mode nil))
(add-hook 'term-load-hook 'my-term-hook)
(eval-after-load "term"
'(define-key term-raw-map (kbd "C-c C-y") 'term-paste))
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
(put 'narrow-to-region 'disabled nil)
(provide 'init)
;;; init.el ends here

View File

@ -1,455 +1,232 @@
;;; init.el --- -*- lexical-binding: t -*-
;;; Init file for emacs
;;
;; 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: 2.0.0
;; Last-Updated: Sat Dec 28 18:41:54 2019 (+0100)
;; By: Mikaël Capelle
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d init
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;; Init file, load everything necessary to have a full functional Emacs, this should
;; not be used with Emacs < 24.
;;
;; 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:
(add-to-list 'load-path "~/.emacs.d/one-file-mode/")
;; CheckVer
(cond ((version< emacs-version "26.1")
(warn "M-EMACS requires Emacs 26.1 and above!"))
((let* ((early-init-f (expand-file-name "early-init.el" user-emacs-directory))
(early-init-do-not-edit-d (expand-file-name "early-init-do-not-edit/" user-emacs-directory))
(early-init-do-not-edit-f (expand-file-name "early-init.el" early-init-do-not-edit-d)))
(and (version< emacs-version "27")
(or (not (file-exists-p early-init-do-not-edit-f))
(file-newer-than-file-p early-init-f early-init-do-not-edit-f)))
(make-directory early-init-do-not-edit-d t)
(copy-file early-init-f early-init-do-not-edit-f t t t t)
(add-to-list 'load-path early-init-do-not-edit-d)
(require 'early-init))))
;; -CheckVer
;; Themes
(setq custom-theme-directory "~/.emacs.d/themes/")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; BetterGC
(defvar better-gc-cons-threshold 67108864 ; 64mb
"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))
;; -AutoGC MinibufferGC
(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)))
;; -MinibufferGC
;; 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))
(update-to-load-path (expand-file-name "one-file-mode" user-emacs-directory))
;; -LoadPath
;; Constants
(require 'init-const)
;; Packages
(require 'package) ;; You might already have this line
(setq package-user-dir (expand-file-name "elpa" user-emacs-directory)
package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")
("cselpa" . "http://elpa.thecybershadow.net/packages/")))
(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))))
;; 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))
(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))
(use-package diminish)
(require 'iso-transl)
(global-display-line-numbers-mode)
;; No menu, scrollbar, displayline and column
(menu-bar-mode -1)
(tool-bar-mode -1)
(when (display-graphic-p)
(scroll-bar-mode -1))
(column-number-mode t)
(line-number-mode t)
(desktop-save-mode t)
;; Command rebinding
;; M-f (forward-word) : Déplacement d'un mot vers la droite du curseur.
;; M-b (backward-word) : Déplacement d'un mot vers la gauche du curseur.
;; C-a (beginning-of-line) : Déplacement au début de la ligne courante.
;; C-e (end-of-line) : Déplacement à la fin de la ligne courante.
;; M-{ (backward-paragraph) : Déplacement vers le paragraphe précédent.
(global-set-key (kbd "M-p") 'backward-paragraph)
;; M-} (forward-paragraph) : Déplacement vers le paragraphe suivant.
(global-set-key (kbd "M-n") 'forward-paragraph)
;; C-v (scroll-up) : Déplacement d'un écran vers le bas.
;; M-v (scroll-down) : Déplacement d'un écran vers le haut.
;; M-> (end-of-buffer) : Déplacement à la fin du buffer.
;; M-< (beginning-of-buffer) : Déplacement au début du buffer.
(use-package material-theme
:config
(load-theme 'material t))
;; No split screen at startup
(setq inhibit-startup-screen t)
;; Or if you use use-package
(setq dashboard-items '((recents . 5)
;; (bookmarks . 5)
(projects . 5)
(agenda . 5)
(registers . 5)))
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
(setq dashboard-set-navigator t)
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
(add-hook 'dashboard-mode-hook (lambda () (display-line-numbers-mode -1)))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(use-package doom-modeline
:ensure t
:hook (after-init . doom-modeline-mode))
(use-package ace-window
:bind ("C-x C-o" . ace-window))
;; Encoding
(set-language-environment "UTF-8")
;; Selection mode
(delete-selection-mode 1)
;; Indentation mode
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
;; Compilation coloration
(ignore-errors
(require 'ansi-color)
(defun my-colorize-compilation-buffer ()
(when (eq major-mode 'compilation-mode)
(ansi-color-apply-on-region compilation-filter-start (point-max))))
(add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer))
;; Retrieve PATH from fish shell
(when (memq window-system '(mac ns x))
(setq exec-path-from-shell-shell-name "/usr/local/bin/fish")
(exec-path-from-shell-initialize))
;; Auto complete + Yasnippet
(use-package projectile
:config
(projectile-mode 1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-enable-caching t))
(use-package helm
:config
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x r b") 'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(helm-mode 1)
(add-to-list 'helm-boring-buffer-regexp-list "\\*.*"))
(use-package helm-projectile
:after (helm projectile)
:config
(setq projectile-completion-system 'helm)
(helm-projectile-on))
(use-package yasnippet
:config
(yas-global-mode 1))
(use-package flycheck
:config
(add-hook 'flycheck-after-syntax-check-hook 'flycheck-autolist-hook)
(global-flycheck-mode)
(setq flycheck-emacs-lisp-load-path "inherict")
(setq flycheck-clang-args '("-stdlib=libc++" "-W" "-Wall"))
(add-hook 'c++-mode-hook
(lambda ()
(setq-local flycheck-clang-language-standard "c++14"))))
(use-package flycheck-pos-tip
:after (flycheck)
:config
(add-hook 'flycheck-mode-hook 'flycheck-pos-tip-mode))
(use-package flycheck-color-mode-line
:after (flycheck)
:config
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
(use-package company
:config
(add-hook 'after-init-hook 'global-company-mode)
(global-set-key (kbd "M-/") 'company-complete))
(use-package company-c-headers
:config
(add-to-list 'company-backends 'company-c-headers))
(use-package company-jedi
:config
(add-to-list 'company-backends 'company-jedi))
(use-package company-web
:config
(add-to-list 'company-backends 'company-web-html))
; C++
(use-package modern-cpp-font-lock
:ensure t)
(add-hook 'c++-mode-hook #'modern-c++-font-lock-mode)
;; Doc mode
(require 'doc-mode)
(add-hook 'c-mode-common-hook 'doc-mode)
(add-hook 'c++-mode-common-hook 'doc-mode)
;; Latex
(use-package auctex
:defer t
:config
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(defun my-latex-mode-setup ()
"Redefines and updates variables for various customizations."
(setq LaTeX-paragraph-commands
'("If" "State" "Loop" "For" "ForAll"))
(setq LaTeX-begin-regexp
(concat LaTeX-begin-regexp "\\|If\\b" "\\|Loop\\b" "\\|For\\b" "\\|ForAll\\b"))
(setq LaTeX-end-regexp
(concat LaTeX-end-regexp "\\|EndIf\\b" "\\|EndLoop\\b"
"\\|EndFor\\b" "\\|Else\\b" "\\|ElsIf\\b"))
(setq LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make))
(defun LaTeX-indent-level-count ()
"Count indentation change caused by all \\left, \\right, \\begin, and
\\end commands in the current line."
(save-excursion
(save-restriction
(let ((count 0))
(narrow-to-region (point)
(save-excursion
(re-search-forward
(concat "[^" TeX-esc "]"
"\\(" LaTeX-indent-comment-start-regexp
"\\)\\|\n\\|\\'"))
(backward-char)
(point)))
(while (search-forward TeX-esc nil t)
(cond
((looking-at "left\\b")
(setq count (+ count LaTeX-left-right-indent-level)))
((looking-at "right\\b")
(setq count (- count LaTeX-left-right-indent-level)))
((looking-at LaTeX-begin-regexp)
(setq count (+ count LaTeX-indent-level)))
((looking-at "Else\\b"))
((looking-at "ElsIf\\b"))
((looking-at LaTeX-end-regexp)
(setq count (- count LaTeX-indent-level)))
((looking-at (regexp-quote TeX-esc))
(forward-char 1))))
count)))))
(add-to-list 'LaTeX-verbatim-environments "code")
(add-to-list 'LaTeX-indent-environment-list
'("code" current-indentation))
(add-hook 'LaTeX-mode-hook 'my-latex-mode-setup)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(require 'tex)
(TeX-global-PDF-mode t)
)
(use-package company-auctex
:after (auctex company)
:config (company-auctex-init))
;; (add-to-list 'ispell-local-dictionary-alist '("francais-hunspell"
;; "[[:alpha:]]"
;; "[^[:alpha]]"
;; "[']"
;; t
;; ("-d" "fr_FR")
;; nil
;; iso-8859-1))
;; magit
(use-package magit
:config
(add-hook 'after-save-hook 'magit-after-save-refresh-status))
;; CSS style
(setq css-indent-offset 2)
;; Markdown mode
(use-package markdown-mode
:mode "\\.text\\'" "\\.markdown\\'" "\\.md\\'")
;; White space mode & Fill mode column
(defun my-visual-hook ()
(visual-line-mode t)
;; (visual-fill-column-mode t)
(define-key visual-line-mode-map [remap kill-line] nil)
(whitespace-mode t))
(setq-default fill-column 95)
(setq-default whitespace-line-column 95)
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
(add-hook 'LaTeX-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'markdown-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'web-mode-hook (lambda () (setq-local whitespace-line-column -1)))
(add-hook 'text-mode-hook 'my-visual-hook)
(add-hook 'prog-mode-hook 'my-visual-hook)
(add-hook 'before-save-hook 'whitespace-cleanup)
;; Electric pair mode
(electric-pair-mode 1)
(show-paren-mode 1)
(setq show-paren-delay 0)
;; C mode
(setq c-default-style "k&r")
(setq c-basic-offset 4)
(defun ac-cc-mode-setup ()
"Initialization hook for CC-mode runs before any other hooks."
(hide-ifdef-mode)
(hs-minor-mode)
(setq hide-ifdef-shadow t))
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'c++-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
(setq c-doc-comment-style
'((java-mode . javadoc)
(pike-mode . autodoc)
(c-mode . javadoc)
(c++-mode . javadoc)))
(add-to-list 'auto-mode-alist '("\\.hpp\\'" . c++-mode))
;; Run C programs directly from within emacs
(setq execute-command nil)
(setq execute-buffer-name "*output*")
(setq execute-process-name "execute")
(defun set-execute-command ()
(interactive)
(setq sp (split-string (read-from-minibuffer "Execute command: ")))
(setq execute-command (combine-and-quote-strings (cons (file-truename (car sp)) (cdr sp)))))
(defun kill-execute-c-program ()
(interactive)
(if (get-process execute-process-name)
(delete-process (get-process execute-process-name))))
(defun execute-c-program ()
(interactive)
(if (not execute-command) (set-execute-command))
(kill-execute-c-program)
(setq old-buffer (current-buffer))
(setq output-buffer (get-buffer-create execute-buffer-name))
(switch-to-buffer-other-window output-buffer)
(end-of-buffer)
(insert (concat (propertize execute-command 'face 'bold) "\n"))
(switch-to-buffer-other-window old-buffer)
(start-process-shell-command execute-process-name execute-buffer-name execute-command))
(defun key-c-mode-setup ()
(local-set-key (kbd "C-c C-c") 'smart-compile)
(local-set-key (kbd "C-c C-r") 'execute-c-program)
(local-set-key [f3] 'kill-execute-c-program)
(local-set-key [f4] 'set-execute-command))
(add-hook 'c++-mode-common-hook 'key-c-mode-setup)
(add-hook 'c-mode-common-hook 'key-c-mode-setup)
;; Flyspell dictionarie
(defun fd-switch-dictionary ()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "francais") "english" "francais")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))
(defun key-latex-mode-setup ()
(local-set-key [f8] 'fd-switch-dictionary))
(add-hook 'LaTeX-mode-hook 'key-latex-mode-setup)
;; python
(use-package flycheck-mypy)
(use-package elpy
:config
(when (load "flycheck" t t)
(flycheck-add-next-checker 'python-flake8 'python-mypy)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt")
;; (setq python-shell-interpreter "jupyter"
;; python-shell-interpreter-args "console --simple-prompt"
;; python-shell-prompt-detect-failure-warning nil)
(add-to-list 'python-shell-completion-native-disabled-interpreters
"jupyter")
:init
(setq elpy-rpc-backend "jedi")
(setq elpy-rpc-python-command "python3")
(elpy-enable))
(add-hook 'python-mode-hook 'hs-minor-mode)
;; Web mode
(add-to-list 'auto-mode-alist '("\\.ctp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
;;(use-package mmm-mode
;; :config
;; (require 'mmm-auto)
;; (setq mmm-global-mode 'maybe)
;; (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
;; (mmm-add-mode-ext-class nil "\\.ctp\\'" 'html-php)
;; (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil html-js))
;; (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil embedded-css))
;; (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil fancy-html)))
;; Go
(require 'go-template-mode)
;; Dockers
(require 'dockerfile-mode)
(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode))
;; Term
(setq explicit-shell-file-name "/bin/bash")
(defun my-term-hook ()
(visual-fill-column-mode nil)
(visual-line-mode nil))
(add-hook 'term-load-hook 'my-term-hook)
(eval-after-load "term"
'(define-key term-raw-map (kbd "C-c C-y") 'term-paste))
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
(put 'narrow-to-region 'disabled nil)
;; 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)
;; User Interface Enhancements
(require 'init-ui-config)
(require 'init-all-the-icons)
(require 'init-theme)
(require 'init-dashboard)
(require 'init-fonts)
(require 'init-scroll)
;; General Programming
(require 'init-magit)
(require 'init-projectile)
(require 'init-treemacs)
(require 'init-yasnippet)
(require 'init-flycheck)
(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-latex)
(require 'init-ess)
;; Web Development
(require 'init-webdev)
;; Miscellaneous
(require 'init-org)
(require 'init-eaf)
(require 'init-erc)
(require 'init-eww)
(require 'init-mu4e)
(require 'init-tramp)
(require 'init-pdf)
(require 'init-leetcode)
(require 'init-pyim)
(require 'init-epaint)
(require 'init-games)
(require 'init-zone)
(provide 'init)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init.el ends here

@ -0,0 +1 @@
Subproject commit 7d6afd1959194956495252abeef0c1cd39ebeee2

@ -0,0 +1 @@
Subproject commit 4aa25e10b0a8bbb31f199cce41f70d35d18209bd

@ -0,0 +1 @@
Subproject commit 9aa81f6c711870ae1a7c6182d911671512a48387

@ -0,0 +1 @@
Subproject commit 50e1df3e273ffa049525726fb72818e859ecc9cf

@ -0,0 +1 @@
Subproject commit 40d6e68085f1f2b6fc3231644e8b5a6c346982c7

@ -0,0 +1 @@
Subproject commit 8b40f927cbb3633d41b9bb4d40d072e522fa3739

@ -0,0 +1 @@
Subproject commit 1f532893f03728406dcf5842e49c019f6186623e

@ -0,0 +1 @@
Subproject commit e41bb4fe0e003130e8c7af199ef4546a2cf57856

@ -0,0 +1 @@
Subproject commit 5909263fa697d2ca44d8fd8b2741315af02d9d9f

@ -0,0 +1 @@
Subproject commit 86e9e167c10eed487cf6715a764527d84ccb35fa

View File

@ -0,0 +1,190 @@
;;; lilypond-font-lock.el --- syntax coloring for LilyPond mode
;; Author: 2001-2006: Heikki Junes
;; * Emacs-mode: new keywords, reserved words, identifiers, notenames,
;; some dynamics and brackets are font-lock-keywords
;; * context-dependent syntax-tables
;; Author: 1997: Han-Wen Nienhuys
;; Author: 1995-1996 Barry A. Warsaw
;; 1992-1994 Tim Peters
;; Created: Feb 1992
;; Version: 2.9.29
;; Last Modified: 11NOV2006
;; Keywords: lilypond languages music notation
;; This started out as a cannabalised version of python-mode.el, by hwn
;; For changes see the LilyPond ChangeLog
;;
;; TODO:
;; - handle lexer modes (\header, \melodic) etc.
(defconst LilyPond-font-lock-keywords
(let* ((kwregex (mapconcat (lambda (x) (concat "\\" x)) LilyPond-keywords "\\|"))
(iregex (mapconcat (lambda (x) (concat "\\" x)) LilyPond-identifiers "\\|"))
(ncrwregex (mapconcat (lambda (x) (concat "" x)) LilyPond-non-capitalized-reserved-words "\\|"))
(rwregex (mapconcat (lambda (x) (concat "" x)) LilyPond-Capitalized-Reserved-Words "\\|"))
(duration "\\([ \t]*\\(128\\|6?4\\|3?2\\|16?\\|8\\)[.]*\\([ \t]*[*][ \t]*[0-9]+\\(/[1-9][0-9]*\\)?\\)?\\)")
(longduration "\\([ \t]*\\(\\\\\\(longa\\|breve\\|maxima\\)\\)[.]*\\([ \t]*[*][ \t]*[0-9]+\\(/[1-9][0-9]*\\)?\\)?\\)")
)
(list
;; Fonts in use (from GNU Emacs Lisp Reference Manual, elisp.ps):
;; font-lock- (c)omment / (s)tring / (k)eyword / (b)uiltin / (f)unction-name /
;; (v)ariable-name / (t)ype / co(n)stant / (w)arning -face
;; The order below is designed so that proofreading would be possible.
;; Fontify...
;; ... (f) identifiers and (k) keywords.
;; ... (n) user defined indetifiers
;; ... (v) the right and the left side of '='-marks.
;; ... (v) reserved words, e.g., FiguredBass.
;; ... (t) notes and rests
;; "on top", ... (s) lyrics-mode
;; "on top", ... (w) horizontal grouping
;; "on top", ... (f) vertical grouping
;; "on top", ... (b) expressional grouping
;; "on top", ... (s) (multiline-)scheme; urgh. one should count the slurs
;; "on top", ... (s) strings
;; "on top", ... (c) (multiline-)comments
;; One should note 'font-lock-multiline' has been possible since Emacs 21.1.
;; See, e.g., text in "http://emacs.kldp.org/emacs-21.1/etc/NEWS".
;; ... identifiers (defined above, see iregex)
(cons (concat "\\(\\([_^-]?\\(" iregex "\\)\\)+\\)\\($\\|[] \t(~{}>\\\\_()^*-]\\)") '(1 font-lock-function-name-face))
;; ... keywords (defined above, see kwregex)
(cons (concat "\\(\\([_^-]?\\(" kwregex "\\)\\)+\\)\\($\\|[] \t(~{}>\\\\_()^*-]\\)") '(1 font-lock-keyword-face))
;; ... user defined identifiers, roughly \[a-zA-Z]+ with single - or _ in between.
'("\\([_^-]?\\\\\\([a-zA-Z[:nonascii:]]\\(?:[-_]?[a-zA-Z[:nonascii:]]\\)*\\)\\)" 1 font-lock-constant-face)
;; ... the left side of '=' -mark
'("\\([_a-zA-Z.0-9-]+\\)[ \t]*=[ \t]*" 1 font-lock-variable-name-face)
;; ... the right side of '=' -mark
'("[ \t]*=[ \t]*\\([_a-zA-Z.0-9-]+\\)" 1 font-lock-variable-name-face)
;; ... reserved words (defined above, see rwregex)
(cons (concat "\\(" rwregex "\\)") 'font-lock-variable-name-face)
;; ... note or rest with (an accidental and) a duration, e.g., b,?16.*3/4
(cons (concat "\\(^\\|[ <\{[/~(!)\t\\\|]\\)\\(\\(\\(" ncrwregex "\\)[,']*[?!]?\\|[srR]\\)" duration "?\\)") '(2 font-lock-type-face))
;; "on top", ... notes and rests with a long duration
(cons (concat "\\(^\\|[ <\{[/~(!)\t\\\|]\\)\\(\\(\\(" ncrwregex "\\)[,']*[?!]?\\|[srR]\\)" longduration "\\)") '(2 font-lock-type-face t))
;; "on top", ... lyrics-mode: fontify everything between '<'...'>' or '{'...'}'
; URGH, does not know anything about inner brackets.
; Multiple lines may need refontifying (C-c f).
'("\\(\\\\lyrics[^{<]*\\)\\({[^}]*\\|<[^>]*\\)" 2 font-lock-string-face t)
;; "on top", ... horizontal grouping, also as postfix syntax '-*':
;; - brackets '{[]}'
;; - ties '~'
;; - ligatures \[, \]
'("\\(-?[][~}{]\\|\\\\[][]\\)" 0 font-lock-reference-face t)
;; "on top", ... vertical grouping:
;; - '<>'-chord brackets with '\\'-voice sep., not marcato '->'
;; - '<< a b >>8' -chords
(cons (concat "\\(\\(-.\\)+\\|[^-^_]\\)\\([<>]+\\(" duration "\\|" longduration "\\)?\\|\\\\\\\\\\)") '(3 font-lock-function-name-face t))
;; "on top", ... expressional grouping, also as postfix syntax '-*':
;; - slurs ( ), \( \), [-^_][()]
;; - hairpins \<, \>, \!
'("\\(-?\\\\[(<!>)]\\|[-^_]?[()]\\)" 0 font-lock-builtin-face t)
;; "on top", ... (multiline-)scheme: try find slurs up to 7th
'("[_^-]?#\\(#[ft]\\|-?[0-9.]+\\|\"[^\"]*\"\\|['`]?[a-zA-Z:-]+\\|['`]?([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^)]*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*[^)]*)\\)" 0 font-lock-string-face t)
;; "on top", ... strings, match also unending strings at eof:
;; if '\n' was not found, it must be '$' which is eof (?).
'("\\([_^-]?\"\\([^\"\\\\]\\|\\\\.\\|\\\\\n\\)*\\(\"\\|$\\)\\)" 0 font-lock-string-face t)
;; "on top", ... (multiline-)comments
'("\\(%\\({[^%]*%\\(}\\|\\([^}][^%]*%\\)+}\\)\\|.*\\)\\)" 0 font-lock-comment-face t)
)
)
"Additional expressions to fontify in LilyPond mode.")
;; define a mode-specific abbrev table for those who use such things
(defvar LilyPond-mode-abbrev-table nil
"Abbrev table in use in `LilyPond-mode' buffers.")
(define-abbrev-table 'LilyPond-mode-abbrev-table nil)
(defvar LilyPond-mode-syntax-table nil
"Syntax table used in `LilyPond-mode' buffers.")
(defun LilyPond-mode-set-syntax-table (&optional not-punct)
"Change syntax table according to the argument `not-punct' which contains characters which are given a context dependent non-punctuation syntax: parentheses may be set to parenthesis syntax and characters `-', `^' and `_' may be set to escape syntax."
(if (not not-punct) (setq not-punct '()))
(setq LilyPond-mode-syntax-table (make-syntax-table))
(let ((defaults
'(
;; NOTE: Emacs knows only "13"-style (used), XEmacs knows also "1b3b", etc.
( ?\% . "< 13" ) ; comment starter, 1st char in block-comments
( ?\n . ">") ; newline: comment ender
( ?\r . ">") ; formfeed: comment ender
( ?\\ . "\\" ) ; escape characters (as '\n' in strings)
( ?\" . "\"" ) ; string quote characters
;; word constituents (e.g., belonging to a note)
( ?\' . "w") ( ?\, . "w") ; transposing octaves
;; punctuation characters (separate symbols from another)
( ?\$ . "." ) ( ?\& . "." )
( ?\* . "." ) ( ?\+ . "." ) ( ?\/ . "." ) ( ?\= . "." )
( ?\| . "." ) ; bar line
)))
;; all the paren characters are now handled by lily-specific indenting/matching code in lilypond-indent.el
(if (or (memq ?\{ not-punct) (memq ?\} not-punct))
(setq defaults (cons '( ?\{ . "(} 2" ) (cons '( ?\} . "){ 4" ) defaults))) ; begin and end of a block-comment
(setq defaults (cons '( ?\{ . ". 2" ) (cons '( ?\} . ". 4" ) defaults)))) ; begin and end of a block-comment
(if (or (memq ?\[ not-punct) (memq ?\] not-punct))
(setq defaults (cons '( ?\[ . "(]" ) (cons '( ?\] . ")[" ) defaults)))
(setq defaults (cons '( ?\[ . "." ) (cons '( ?\] . "." ) defaults))))
(if (or (memq ?\< not-punct) (memq ?\> not-punct))
(setq defaults (cons '( ?\< . "(>" ) (cons '( ?\> . ")<" ) defaults)))
(setq defaults (cons '( ?\< . "." ) (cons '( ?\> . "." ) defaults))))
(if (or (memq ?\( not-punct) (memq ?\) not-punct))
(setq defaults (cons '( ?\( . "()" ) (cons '( ?\) . ")(" ) defaults)))
(setq defaults (cons '( ?\( . "." ) (cons '( ?\) . "." ) defaults))))
;; In LilyPond the following chars serve as escape chars, e.g., c^> d-) e_( ,
;; but they may be set to punctuation chars, since inside strings they should not act as escape chars
(setq defaults (cons (if (memq ?- not-punct) '( ?\- . "\\" ) '( ?\- . "." ) ) defaults))
(setq defaults (cons (if (memq ?^ not-punct) '( ?^ . "\\" ) '( ?^ . "." ) ) defaults))
(setq defaults (cons (if (memq ?\_ not-punct) '( ?\_ . "\\" ) '( ?\_ . "." ) ) defaults))
(mapcar (function
(lambda (x) (modify-syntax-entry
(car x) (cdr x) LilyPond-mode-syntax-table)))
defaults)
(set-syntax-table LilyPond-mode-syntax-table)))
(defun LilyPond-mode-context-set-syntax-table ()
"Change syntax table according to current context."
(interactive)
;; default syntax table sets parentheses to punctuation characters
(LilyPond-mode-set-syntax-table)
;; find current context
(setq context (parse-partial-sexp (point-min) (point)))
(cond ((nth 3 context)) ; inside string
((nth 4 context)) ; inside a comment
((eq (char-syntax (or (char-before (point)) 0)) ?\\)) ; found escape-char
((and (eq (char-syntax (or (char-before (- (point) 1)) 0)) ?\\)
(memq (char-before (point)) '( ?\) ?\] )))) ; found escape-char
((memq (char-before (point)) '( ?\) ))
(LilyPond-mode-set-syntax-table '( ?\( ?\) )))
((memq (char-before (point)) '( ?\] ))
(LilyPond-mode-set-syntax-table '( ?\[ ?\] )))
((memq (char-before (point)) '( ?\> ?\} ))
(LilyPond-mode-set-syntax-table '( ?\< ?\> ?\{ ?\} ?\^ ?\- ?\_ )))
((memq (char-after (point)) '( ?\( ))
(LilyPond-mode-set-syntax-table '( ?\( ?\) )))
((memq (char-after (point)) '( ?\[ ))
(LilyPond-mode-set-syntax-table '( ?\[ ?\] )))
((memq (char-after (point)) '( ?\< ?\{ ))
(LilyPond-mode-set-syntax-table '( ?\< ?\> ?\{ ?\} ?\^ ?\- ?\_ )))
))

View File

@ -0,0 +1,587 @@
;;; lilypond-indent.el --- Auto-indentation for lilypond code
;;;
;;; Heikki Junes <hjunes@cc.hut.fi>
;;; * ond-char paren matching is handled by context dependent syntax tables
;;; * match two-char slurs '\( ... \)' and '\[ ... \]' separately.
;;; * adopt Emacs' f90-comment-region
;;; Chris Jackson <chris@fluffhouse.org.uk>
;;; some code is taken from ESS (Emacs Speaks Statistics) S-mode by A.J.Rossini <rossini@biostat.washington.edu>
;;; Variables for customising indentation style
;;; TODO:
;;; * currently, in bracket matching one may need a non-bracket
;;; chararacter between the bracket characters, like ( ( ) )
(defcustom LilyPond-indent-level 2
"*Indentation of lilypond statements with respect to containing block."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-brace-offset 0
"*Extra indentation for open braces.
Compares with other text in same context."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-angle-offset 0
"*Extra indentation for open angled brackets.
Compares with other text in same context."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-square-offset 0
"*Extra indentation for open square brackets.
Compares with other text in same context."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-scheme-paren-offset 0
"*Extra indentation for open scheme parens.
Compares with other text in same context."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-close-brace-offset 0
"*Extra indentation for closing braces."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-close-angle-offset 0
"*Extra indentation for closing angle brackets."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-close-square-offset 0
"*Extra indentation for closing square brackets."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-close-scheme-paren-offset 0
"*Extra indentation for closing scheme parens."
:group 'LilyPond
:type 'integer)
(defcustom LilyPond-fancy-comments t
"*Non-nil means distiguish between %, %%, and %%% for indentation."
:group 'LilyPond
:type 'boolean)
(defcustom LilyPond-comment-region "%%%"
"*String inserted by \\[LilyPond-comment-region]\
at start of each line in region."
:group 'LilyPond
:type 'string)
(defun LilyPond-comment-region (beg-region end-region)
"Comment/uncomment every line in the region.
Insert LilyPond-comment-region at the beginning of every line in the region
or, if already present, remove it."
(interactive "*r")
(let ((end (make-marker)))
(set-marker end end-region)
(goto-char beg-region)
(beginning-of-line)
(if (looking-at (regexp-quote LilyPond-comment-region))
(delete-region (point) (match-end 0))
(insert LilyPond-comment-region))
(while (and (zerop (forward-line 1))
(< (point) (marker-position end)))
(if (looking-at (regexp-quote LilyPond-comment-region))
(delete-region (point) (match-end 0))
(insert LilyPond-comment-region)))
(set-marker end nil)))
(defun LilyPond-calculate-indent ()
"Return appropriate indentation for current line as lilypond code.
In usual case returns an integer: the column to indent to.
Returns nil if line starts inside a string"
(save-excursion
(beginning-of-line)
(let ((indent-point (point))
(case-fold-search nil)
state)
(setq containing-sexp (save-excursion (LilyPond-scan-containing-sexp)))
(beginning-of-defun)
(while (< (point) indent-point)
(setq state (parse-partial-sexp (point) indent-point 0)))
;; (setq containing-sexp (car (cdr state))) is the traditional way for languages
;; with simpler parenthesis delimiters
(cond ((nth 3 state)
;; point is in the middle of a string
nil)
((nth 4 state)
;; point is in the middle of a block comment
(LilyPond-calculate-indent-within-blockcomment))
((null containing-sexp)
;; Line is at top level - no indent
(beginning-of-line)
0)
(t
;; Find previous non-comment character.
(goto-char indent-point)
(LilyPond-backward-to-noncomment containing-sexp)
;; Now we get the answer.
;; Position following last unclosed open.
(goto-char containing-sexp)
(or
;; Is line first statement after an open brace or bracket?
;; If no, find that first statement and indent like it.
(save-excursion
(forward-char 1)
;; Skip over comments following open brace.
(skip-chars-forward " \t\n")
(cond ((looking-at "%{")
(while (progn
(and (not (looking-at "%}"))
(< (point) (point-max))))
(forward-line 1)
(skip-chars-forward " \t\n"))
(forward-line 1)
(skip-chars-forward " \t\n"))
((looking-at "%")
(while (progn (skip-chars-forward " \t\n")
(looking-at "%"))
(forward-line 1))))
;; The first following code counts
;; if it is before the line we want to indent.
(and (< (point) indent-point)
(current-column)))
;; If no previous statement,
;; indent it relative to line brace is on.
;; For open brace in column zero, don't let statement
;; start there too. If LilyPond-indent-level is zero, use
;; LilyPond-brace-offset instead
(+ (if (and (bolp) (zerop LilyPond-indent-level))
(cond ((= (following-char) ?{)
LilyPond-brace-offset)
((= (following-char) ?<)
LilyPond-angle-offset)
((= (following-char) ?\[)
LilyPond-square-offset)
((= (following-char) ?\))
LilyPond-scheme-paren-offset)
(t
0))
LilyPond-indent-level)
(progn
(skip-chars-backward " \t")
(current-indentation)))))))))
(defun LilyPond-indent-line ()
"Indent current line as lilypond code.
Return the amount the indentation changed by."
(let ((indent (LilyPond-calculate-indent))
beg shift-amt
(case-fold-search nil)
(pos (- (point-max) (point))))
(beginning-of-line)
(setq beg (point))
(cond ((eq indent nil)
(setq indent (current-indentation)))
(t
(skip-chars-forward " \t")
(if (and LilyPond-fancy-comments (looking-at "%%%\\|%{\\|%}"))
(setq indent 0))
(if (and LilyPond-fancy-comments
(looking-at "%")
(not (looking-at "%%\\|%{\\|%}")))
(setq indent comment-column)
(if (eq indent t) (setq indent 0))
(if (listp indent) (setq indent (car indent)))
(cond
((= (following-char) ?})
(setq indent (+ indent (- LilyPond-close-brace-offset LilyPond-indent-level))))
((= (following-char) ?>)
(setq indent (+ indent (- LilyPond-close-angle-offset LilyPond-indent-level))))
((= (following-char) ?\])
(setq indent (+ indent (- LilyPond-close-square-offset LilyPond-indent-level))))
((and (= (following-char) ?\)) (LilyPond-inside-scheme-p))
(setq indent (+ indent (- LilyPond-close-scheme-paren-offset LilyPond-indent-level))))
((= (following-char) ?{)
(setq indent (+ indent LilyPond-brace-offset)))
((= (following-char) ?<)
(setq indent (+ indent LilyPond-angle-offset)))
((= (following-char) ?\[)
(setq indent (+ indent LilyPond-square-offset)))
((and (= (following-char) ?\() (LilyPond-inside-scheme-p))
(setq indent (+ indent LilyPond-scheme-paren-offset)))
))))
(skip-chars-forward " \t")
(setq shift-amt (- indent (current-column)))
(if (zerop shift-amt)
(if (> (- (point-max) pos) (point))
(goto-char (- (point-max) pos)))
(delete-region beg (point))
(indent-to indent)
;; If initial point was within line's indentation,
;; position after the indentation.
;; Else stay at same point in text.
(if (> (- (point-max) pos) (point))
(goto-char (- (point-max) pos))))
shift-amt))
(defun LilyPond-inside-comment-p ()
"Return non-nil if point is inside a line or block comment"
(setq this-point (point))
(or (save-excursion (beginning-of-line)
(skip-chars-forward " \t")
(looking-at "%"))
(save-excursion
;; point is in the middle of a block comment
(setq lastopen (save-excursion (re-search-backward "%{[ \\t]*" (point-min) t)))
(setq lastclose (save-excursion (re-search-backward "%}[ \\t]*" (point-min) t)))
(if (or (and (= (char-before) ?%) (= (char-after) ?{))
(and (= (char-after) ?%) (= (char-after (1+ (point))) ?{)))
(setq lastopen (save-excursion (backward-char) (point))))
(and
lastopen
(or (not lastclose)
(<= lastclose lastopen))))
))
(defun LilyPond-inside-string-or-comment-p ()
"Test if point is inside a string or a comment"
(setq this-point (point))
(or (save-excursion (beginning-of-line)
(skip-chars-forward " \t")
(looking-at "%"))
(save-excursion
(beginning-of-defun)
(while (< (point) this-point)
(setq state (parse-partial-sexp (point) this-point 0)))
(cond ((nth 3 state)
;; point is in the middle of a string
t )
((nth 4 state)
;; point is in the middle of a block comment
t )
(t
nil)))))
(defun LilyPond-backward-over-blockcomments (lim)
"Move point back to closest non-whitespace character not part of a block comment"
(setq lastopen (save-excursion (re-search-backward "%{[ \\t]*" lim t)))
(setq lastclose (save-excursion (re-search-backward "%}[ \\t]*" lim t)))
(if lastopen
(if lastclose
(if (<= lastclose lastopen)
(goto-char lastopen))
(goto-char lastopen)))
(skip-chars-backward " %\t\n\f"))
(defun LilyPond-backward-over-linecomments (lim)
"Move point back to the closest non-whitespace character not part of a line comment.
Argument LIM limit."
(let (opoint stop)
(while (not stop)
(skip-chars-backward " \t\n\f" lim)
(setq opoint (point))
(beginning-of-line)
(search-forward "%" opoint 'move)
(skip-chars-backward " \t%")
(setq stop (or (/= (preceding-char) ?\n) (<= (point) lim)))
(if stop (point)
(beginning-of-line)))))
(defun LilyPond-backward-to-noncomment (lim)
"Move point back to closest non-whitespace character not part of a comment"
(LilyPond-backward-over-linecomments lim)
(LilyPond-backward-over-blockcomments lim))
(defun LilyPond-calculate-indent-within-blockcomment ()
"Return the indentation amount for line inside a block comment."
(let (end percent-start)
(save-excursion
(beginning-of-line)
(skip-chars-forward " \t")
(skip-chars-backward " \t\n")
(setq end (point))
(beginning-of-line)
(skip-chars-forward " \t")
(and (re-search-forward "%{[ \t]*" end t)
(goto-char (1+ (match-beginning 0))))
(if (and (looking-at "[ \t]*$") (= (preceding-char) ?\%))
(1+ (current-column))
(current-column)))))
;; Key: Type of bracket (character).
;; Value: Pair of regexps representing the corresponding open and close bracket
;; () are treated specially (need to indent in Scheme but not in music)
(defconst LilyPond-parens-regexp-alist
`( ( ?> . ("\\([^\\]\\|^\\)<" . "\\([^ \\n\\t_^-]\\|[_^-][-^]\\|\\s-\\)\\s-*>"))
;; a b c->, a b c^> and a b c_> are not close-angle-brackets, they're accents
;; but a b c^-> and a b c^^> are close brackets with tenuto/marcato before them
;; also \> and \< are hairpins
;; duh .. a single '>', as in chords '<< ... >>', was not matched here
( ?} . ("{" . "}"))
;; ligatures '\[ ... \]' are skipped in the following expression
( ?\] . ("\\([^\\]\\([\\][\\]\\)*\\|^\\)[[]" . "\\([^\\]\\([\\][\\]\\)*\\|^\\)[]]"))
( "\\]" . ("\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][[]" . "\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][]]"))
( "\\)" . ("\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][(]" . "\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][)]"))
))
(defconst LilyPond-parens-alist
`( ( ?< . ?> )
( ?{ . ?} )
( ?\[ . ?\] )
( "\\[" . "\\]" )
( ?\( . ?\) )
( "\\(" . "\\)" )
))
(defun LilyPond-matching-paren (bracket-type)
"Returns the open corresponding to the close specified by bracket-type, or vice versa"
(cond ( (member bracket-type (mapcar 'car LilyPond-parens-alist))
(cdr (assoc bracket-type LilyPond-parens-alist)) )
( (member bracket-type (mapcar 'cdr LilyPond-parens-alist))
(car (rassoc bracket-type LilyPond-parens-alist)) )
nil))
(defun LilyPond-scan-containing-sexp (&optional bracket-type slur-paren-p dir)
"Move point to the beginning of the deepest parenthesis pair enclosing point.
If the optional argument bracket-type, a character representing a
close bracket such as ) or }, is specified, then the parenthesis pairs
searched are limited to this type.
If the optional argument slur-paren-p is non-nil, then slur
parentheses () are considered as matching pairs. Otherwise Scheme
parentheses are considered to be matching pairs, but slurs are not.
slur-paren-p defaults to nil.
"
;;; An user does not call this function directly, or by a key sequence.
;; (interactive)
(let ( (level (if (not (eq dir 1)) 1 -1))
(regexp-alist LilyPond-parens-regexp-alist)
(oldpos (point))
(assoc-bracket-type (if (not (eq dir 1)) bracket-type (LilyPond-matching-paren bracket-type))))
(if (LilyPond-inside-scheme-p)
(setq paren-regexp "(\\|)")
(if slur-paren-p
;; expressional slurs '\( ... \)' are not taken into account
(setq regexp-alist (cons '( ?\) . ("\\([^\\]\\([\\][\\]\\)*\\|^\\)(" . "\\([^\\]\\([\\][\\]\\)*\\|^\\))")) regexp-alist)))
(if (member assoc-bracket-type (mapcar 'car regexp-alist))
(progn (setq paren-regexp (cdr (assoc assoc-bracket-type regexp-alist)))
(setq paren-regexp (concat (car paren-regexp) "\\|" (cdr paren-regexp))))
(setq paren-regexp (concat (mapconcat 'car (mapcar 'cdr regexp-alist) "\\|") "\\|"
(mapconcat 'cdr (mapcar 'cdr regexp-alist) "\\|")))))
;; match concurrent one-char opening and closing slurs
(if (and (eq dir 1)
(not (sequencep bracket-type))
(eq (char-syntax (or (char-after oldpos) 0)) ?\()
(not (eq (char-after oldpos) ?<)))
;; anyway do not count open slur, since already level = -1
(progn (forward-char 1)
(if (eq (following-char)
(LilyPond-matching-paren (char-after oldpos)))
;; matching char found, go after it and set level = 0
(progn (forward-char 1)
(setq level 0)))))
;; browse the code until matching slur is found, or report mismatch
(while (and (if (not (eq dir 1))
(> level 0)
(< level 0))
;; dir tells whether to search backward or forward
(if (not (eq dir 1))
(re-search-backward paren-regexp nil t)
(re-search-forward paren-regexp nil t))
;; note: in case of two-char bracket only latter is compared
(setq match (char-before (match-end 0))))
;;; (message "%d" level) (sit-for 0 300)
(if (not (save-excursion (goto-char (match-end 0))
;; skip over strings and comments
(LilyPond-inside-string-or-comment-p)))
(if (memq match '(?} ?> ?\] ?\)))
;; count closing brackets
(progn (setq level (1+ level))
;; slurs may be close to each other, e.g.,
;; a single '>' was not matched .. need to be corrected
(if (and (eq dir 1) (eq (char-after (match-end 0)) match))
(if (/= level 0)
(progn
(setq level (1+ level))
(forward-char 1))))
;;; (message "%d %c" level match) (sit-for 0 300)
;; hmm..
(if (and (= match ?>)
(looking-at ".\\s-+>\\|\\({\\|}\\|<\\|>\\|(\\|)\\|[][]\\)>"))
(forward-char 1)))
;; count opening brackets
(progn (setq level (1- level))
;;; (message "%d %c" level match) (sit-for 0 300)
;; hmm..
(if (and (= match ?<)
(looking-at ".\\s-+<\\|\\({\\|}\\|<\\|>\\|(\\|)\\|[][]\\)<"))
(forward-char 1))))))
;; jump to the matching slur
(if (not (eq dir 1))
(progn
(if (sequencep bracket-type)
;; match the latter char in two-char brackets
(if (looking-at "..[][)(]") (forward-char 1)))
;; if the following char is not already a slur
(if (and (not (looking-at "[)(]"))
;; match the slur which follows
(looking-at ".[][><)(]")) (forward-char 1)))
(backward-char 1))
(if (= level 0)
(point)
(progn (goto-char oldpos)
nil))))
(defun LilyPond-inside-scheme-p ()
"Tests if point is inside embedded Scheme code"
;;; An user does not call this function directly, or by a key sequence.
;; (interactive)
(let ( (test-point (point))
(level 0) )
(save-excursion
(if (or (and (eq (char-after (point)) ?\()
(save-excursion
(skip-chars-backward "'`")
(memq (char-before) '(?# ?$))))
(and (re-search-backward "[#$][`']?(" nil t)
(progn
(search-forward "(")
(setq level 1)
(while (and (> level 0)
(re-search-forward "[()]" test-point t)
(setq match (char-after (match-beginning 0)))
(<= (point) test-point))
(if (= match ?\()
(setq level (1+ level))
(setq level (1- level))))
(> level 0))))
t
nil))))
;;; Largely taken from the 'blink-matching-open' in lisp/simple.el in
;;; the Emacs distribution.
(defun LilyPond-blink-matching-paren (&optional dir)
"Move cursor momentarily to the beginning of the sexp before
point. In lilypond files this is used for closing ), ], } and >, whereas the
builtin 'blink-matching-open' is not used. In syntax table, see
`lilypond-font-lock.el', all brackets are punctuation characters."
;;; An user does not call this function directly, or by a key sequence.
;; (interactive)
(let ( (oldpos (point))
(level 0)
(mismatch) )
(if (not (or (equal this-command 'LilyPond-electric-close-paren)
(eq dir 1)))
(goto-char (setq oldpos (- oldpos 1))))
;; Test if a ligature \] or expressional slur \) was encountered
(setq bracket-type (char-after (point)))
(setq char-before-bracket-type nil)
(if (memq bracket-type '(?\] ?\) ?\[ ?\())
(progn
(setq np -1)
(while (eq (char-before (- (point) (setq np (+ np 1)))) ?\\)
(setq char-before-bracket-type (if char-before-bracket-type nil ?\\)))
(if (eq char-before-bracket-type ?\\)
(setq bracket-type (string char-before-bracket-type bracket-type)))))
(when blink-matching-paren-distance
(narrow-to-region
(max (point-min) (- (point) blink-matching-paren-distance))
(min (point-max) (+ (point) blink-matching-paren-distance))))
(if (and (equal this-command 'LilyPond-electric-close-paren)
(memq bracket-type '(?> ?} ?< ?{)))
;; < { need to be mutually balanced and nested, so search backwards for both of these bracket types
(LilyPond-scan-containing-sexp nil nil dir)
;; whereas ( ) slurs within music don't, so only need to search for ( )
;; use same mechanism for [ ] slurs
(LilyPond-scan-containing-sexp bracket-type t dir))
(setq blinkpos (point))
(setq mismatch
(or (null (LilyPond-matching-paren (char-after blinkpos)))
(/= (char-after oldpos)
(LilyPond-matching-paren (char-after blinkpos)))))
(if mismatch (progn (setq blinkpos nil)
(message "Mismatched parentheses")))
(if (and blinkpos
(equal this-command 'LilyPond-electric-close-paren))
(if (pos-visible-in-window-p)
(and blink-matching-paren-on-screen
(sit-for blink-matching-delay))
(message
"Matches %s"
;; Show what precedes the open in its line, if anything.
(if (save-excursion
(skip-chars-backward " \t")
(not (bolp)))
(buffer-substring (progn (beginning-of-line) (point))
(1+ blinkpos))
;; Show what follows the open in its line, if anything.
(if (save-excursion
(forward-char 1)
(skip-chars-forward " \t")
(not (eolp)))
(buffer-substring blinkpos
(progn (end-of-line) (point)))
;; Otherwise show the previous nonblank line,
;; if there is one.
(if (save-excursion
(skip-chars-backward "\n \t")
(not (bobp)))
(concat
(buffer-substring (progn
(skip-chars-backward "\n \t")
(beginning-of-line)
(point))
(progn (end-of-line)
(skip-chars-backward " \t")
(point)))
;; Replace the newline and other whitespace with `...'.
"..."
(buffer-substring blinkpos (1+ blinkpos)))
;; There is nothing to show except the char itself.
(buffer-substring blinkpos (1+ blinkpos))))))))
(if (not (equal this-command 'LilyPond-electric-close-paren))
(goto-char (setq oldpos (+ oldpos 1)))
(goto-char oldpos))
(if (not (eq dir 1))
blinkpos
(+ blinkpos 1))))
(defun LilyPond-electric-close-paren ()
"Blink on the matching open paren when a >, ), } or ] is inserted"
(interactive)
(let ((oldpos (point)))
(self-insert-command 1)
;; Refontify buffer if a block-comment-ender '%}' is inserted
(if (and (eq (char-before (point)) ?})
(eq (char-before (- (point) 1)) ?%))
(font-lock-fontify-buffer)
;; Match paren if the cursor is not inside string or comment.
(if (and blink-matching-paren
(not (LilyPond-inside-string-or-comment-p))
(save-excursion (re-search-backward
(concat (mapconcat 'cdr (mapcar 'cdr LilyPond-parens-regexp-alist) "\\|") "\\|)") nil t)
(eq oldpos (1- (match-end 0)))))
(progn (backward-char 1)
(LilyPond-blink-matching-paren)
(forward-char 1))))))
(defun LilyPond-scan-sexps (pos dir)
"This function is redefined to be used in Emacs' show-paren-function and
in XEmacs' paren-highlight."
(LilyPond-blink-matching-paren dir))

View File

@ -0,0 +1,21 @@
;;; lilypond-init.el --- Startup code for LilyPond mode
;;
;; Instructions, extracted from Documentation/topdocs/INSTALL.texi:
;; Emacs mode for entering music and running LilyPond is contained in
;; the source archive as `lilypond-mode.el', `lilypond-indent.el',
;; `lilypond-font-lock.el' and `lilypond-words.el'. You should install
;; these files to a directory included in your `load-path'.
;; File `lilypond-init.el' should be placed to `load-path/site-start.d/'
;; or appended to your `~/.emacs' or `~/.emacs.el'.
;; As a user, you may want add your source path or, e.g., `~/site-lisp/' to
;; your `load-path'. Append the following line (modified) to your `~/.emacs':
;(setq load-path (append (list (expand-file-name "~/site-lisp")) load-path))
(autoload 'LilyPond-mode "lilypond-mode" "LilyPond Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.ly$" . LilyPond-mode))
(add-to-list 'auto-mode-alist '("\\.ily$" . LilyPond-mode))
(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock)))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,556 @@
;;;; lilypond-song.el --- Emacs support for LilyPond singing
;;;;
;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
;;;; Copyright (C) 2006 Brailcom, o.p.s.
;;;; Author: Milan Zamazal <pdm@brailcom.org>
;;;;
;;;; LilyPond 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.
;;;;
;;;; LilyPond 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 LilyPond. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This file adds Emacs support for singing lyrics of LilyPond files.
;; It extends lilypond-mode with the following commands (see their
;; documentation for more information):
;;
;; - M-x LilyPond-command-sing (C-c C-a)
;; - M-x LilyPond-command-sing-and-play (C-c C-q)
;; - M-x LilyPond-command-sing-last (C-c C-z)
;;
;; Note these commands are not available from the standard LilyPond mode
;; command menus.
;;; Code:
(require 'cl)
(require 'lilypond-mode)
(ignore-errors (require 'ecasound))
;;; User options
(defcustom LilyPond-synthesize-command "lilysong"
"Command used to sing LilyPond files."
:group 'LilyPond
:type 'string)
(defcustom LilyPond-play-command (or (executable-find "ecaplay") "play")
"Command used to play WAV files."
:group 'LilyPond
:type 'string)
;; In case you would like to use fluidsynth (not recommended as fluidsynth
;; can perform wave file synthesis only in real time), you can use the
;; following setting:
;; (setq LilyPond-midi->wav-command "fluidsynth -nil -a file soundfont.sf2 '%s' && sox -t raw -s -r 44100 -w -c 2 fluidsynth.raw '%t'")
(defcustom LilyPond-midi->wav-command "timidity -Ow %m -s %r -o '%t' '%s'"
"Command used to make a WAV file from a MIDI file.
%s in the string is replaced with the source MIDI file name,
%t is replaced with the target WAV file name.
%r is replaced with rate.
%m is replaced with lilymidi call."
:group 'LilyPond
:type 'string)
(defcustom LilyPond-voice-rates
'((".*czech.*" . 44100)
(".*\\<fi\\(\\>\\|nnish\\).*" . 22050)
(".*" . 16000))
"Alist of regexps matching voices and the corresponding voice rates.
It may be necessary to define proper voice rates here in order to
avoid ecasound resampling problems."
:group 'LilyPond
:type '(alist :key-type regexp :value-type integer))
(defcustom LilyPond-use-ecasound (and (featurep 'ecasound)
(executable-find "ecasound")
t)
"If non-nil, use ecasound for mixing and playing songs."
:group 'LilyPond
:type 'boolean)
(defcustom LilyPond-voice-track-regexp "voice"
"Perl regexp matching names of MIDI tracks to be ignored on sing&play."
:group 'LilyPond
:type 'string)
(defcustom LilyPond-lilymidi-command "\"`lilymidi --prefix-tracks -Q --filter-tracks '%s' '%f'`\""
"Command to insert into LilyPond-midi->wav-command calls.
%f is replaced with the corresponding MIDI file name.
%s is replaced with `LilyPond-voice-track-regexp'."
:group 'LilyPond
:type 'string)
;;; Lyrics language handling
(defvar lilysong-language nil)
(make-variable-buffer-local 'lilysong-language)
(defvar lilysong-last-language nil)
(make-variable-buffer-local 'lilysong-last-language)
(defvar lilysong-languages '("cs" "en"))
(defvar lilysong-voices nil)
(defun lilysong-voices ()
(or lilysong-voices
(with-temp-buffer
(call-process "lilysong" nil t nil "--list-voices")
(call-process "lilysong" nil t nil "--list-languages")
(goto-char (point-min))
(while (not (eobp))
(push (buffer-substring-no-properties
(line-beginning-position) (line-end-position))
lilysong-voices)
(forward-line))
lilysong-voices)))
(defun lilysong-change-language ()
"Change synthesis language or voice of the current document."
(interactive)
(setq lilysong-language
(completing-read "Lyrics language or voice: "
(mapcar 'list (lilysong-voices)))))
(defun lilysong-update-language ()
(unless lilysong-language
(lilysong-change-language)))
;;; Looking for \festival* and \midi commands
(defun lilysong-document-files ()
(let ((resulting-files ())
(stack (list (LilyPond-get-master-file))))
(while (not (null stack))
(let ((file (expand-file-name (pop stack))))
(when (and (file-exists-p file)
(not (member file resulting-files)))
(push file resulting-files)
(save-excursion
(save-restriction
(set-buffer (find-file-noselect file nil))
(widen)
(goto-char (point-min))
(while (re-search-forward "^[^%\n]*\\\\include +\"\\([^\"]+\\)\"" nil t)
(push (match-string 1) stack)))))))
(nreverse resulting-files)))
(defvar lilysong-festival-command-regexp
"^[^%\n]*\\\\festival\\(syl\\)? +#\"\\([^\"]+\\)\"")
(defun lilysong-find-song (direction)
"Find XML file name of the nearest Festival command in the given DIRECTION.
DIRECTION is one of the symbols `forward' or `backward'.
If no Festival command is found in the current buffer, return nil.
The point is left at the position where the command occurrence was found."
(save-match-data
(when (funcall (if (eq direction 'backward)
're-search-backward
're-search-forward)
lilysong-festival-command-regexp nil t)
(match-string-no-properties 2))))
(defun lilysong-current-song ()
"Return the XML file name corresponding to the song around current point.
If there is none, return nil."
(save-excursion
(or (progn (end-of-line) (lilysong-find-song 'backward))
(progn (beginning-of-line) (lilysong-find-song 'forward)))))
(defun lilysong-all-songs (&optional limit-to-region)
"Return list of XML file names of the song commands in the current buffer.
If there are none, return an empty list.
If LIMIT-TO-REGION is non-nil, look for the commands in the current region
only."
(let ((result '())
(current nil))
(save-excursion
(save-restriction
(when limit-to-region
(narrow-to-region (or (mark) (point)) (point)))
(goto-char (point-min))
(while (setq current (lilysong-find-song 'forward))
(push current result))))
(nreverse result)))
(defun lilysong-walk-files (collector)
(save-excursion
(mapcar (lambda (f)
(set-buffer (find-file-noselect f))
(funcall collector))
(lilysong-document-files))))
(defun lilysong-all-songs* ()
"Return list of XML file names of the song commands in the current document."
(remove-duplicates (apply #'append (lilysong-walk-files #'lilysong-all-songs))
:test #'equal))
(defvar lilysong-song-history nil)
(make-variable-buffer-local 'lilysong-song-history)
(defvar lilysong-last-song-list nil)
(make-variable-buffer-local 'lilysong-last-song-list)
(defvar lilysong-last-command-args nil)
(make-variable-buffer-local 'lilysong-last-command-args)
(defun lilysong-song-list (multi)
(cond
((eq multi 'all)
(lilysong-all-songs*))
(multi
(lilysong-select-songs))
(t
(lilysong-select-single-song))))
(defun lilysong-select-single-song ()
(let ((song (lilysong-current-song)))
(if song
(list song)
(error "No song found"))))
(defun lilysong-select-songs ()
(let* ((all-songs (lilysong-all-songs*))
(available-songs all-songs)
(initial-songs (if (or (not lilysong-last-song-list)
(eq LilyPond-command-current
'LilyPond-command-region))
(lilysong-all-songs t)
lilysong-last-song-list))
(last-input (completing-read
(format "Sing file%s: "
(if initial-songs
(format " (default `%s')"
(mapconcat 'identity initial-songs
", "))
""))
(mapcar 'list all-songs)
nil t nil
'lilysong-song-history)))
(if (equal last-input "")
initial-songs
(let ((song-list '())
default-input)
(while (not (equal last-input ""))
(push last-input song-list)
(setq default-input (second (member last-input available-songs)))
(setq available-songs (remove last-input available-songs))
(setq last-input (completing-read "Sing file: "
(mapcar #'list available-songs)
nil t default-input
'lilysong-song-history)))
(setq lilysong-last-song-list (nreverse song-list))))))
(defun lilysong-count-midi-words ()
(count-rexp (point-min) (point-max) "^[^%]*\\\\midi"))
(defun lilysong-midi-list (multi)
(if multi
(let ((basename (file-name-sans-extension (buffer-file-name)))
(count (apply #'+ (save-match-data
(lilysong-walk-files #'lilysong-count-midi-words))))
(midi-files '()))
(while (> count 0)
(setq count (1- count))
(if (= count 0)
(push (concat basename ".midi") midi-files)
(push (format "%s-%d.midi" basename count) midi-files)))
midi-files)
(list (LilyPond-string-current-midi))))
;;; Compilation
(defun lilysong-file->wav (filename &optional extension)
(format "%s.%s" (save-match-data
(if (string-match "\\.midi$" filename)
filename
(file-name-sans-extension filename)))
(or extension "wav")))
(defun lilysong-file->ewf (filename)
(lilysong-file->wav filename "ewf"))
(defstruct lilysong-compilation-data
command
makefile
buffer
songs
midi
in-parallel)
(defvar lilysong-compilation-data nil)
(defun lilysong-sing (songs &optional midi-files in-parallel)
(setq lilysong-last-command-args (list songs midi-files in-parallel))
(lilysong-update-language)
(add-to-list 'compilation-finish-functions 'lilysong-after-compilation)
(setq songs (mapcar #'expand-file-name songs))
(let* ((makefile (lilysong-makefile (current-buffer) songs midi-files))
(command (format "make -f %s" makefile)))
(setq lilysong-compilation-data
(make-lilysong-compilation-data
:command command
:makefile makefile
:buffer (current-buffer)
:songs songs
:midi midi-files
:in-parallel in-parallel))
(save-some-buffers (not compilation-ask-about-save))
(unless (equal lilysong-language lilysong-last-language)
(mapc #'(lambda (f) (when (file-exists-p f) (delete-file f)))
(append songs (mapcar 'lilysong-file->wav midi-files))))
(if (lilysong-up-to-date-p makefile)
(lilysong-process-generated-files lilysong-compilation-data)
(compile command))))
(defun lilysong-up-to-date-p (makefile)
(equal (call-process "make" nil nil nil "-f" makefile "-q") 0))
(defun lilysong-makefile (buffer songs midi-files)
(let ((temp-file (make-temp-file "Makefile.lilysong-el"))
(language lilysong-language))
(with-temp-file temp-file
(let ((source-files (save-excursion
(set-buffer buffer)
(lilysong-document-files)))
(master-file (save-excursion
(set-buffer buffer)
(LilyPond-get-master-file)))
(lilyfiles (append songs midi-files)))
(insert "all:")
(dolist (f (mapcar 'lilysong-file->wav (append songs midi-files)))
(insert " " f))
(insert "\n")
(when lilyfiles
(dolist (f songs)
(insert f " "))
(when midi-files
(dolist (f midi-files)
(insert f " ")))
(insert ": " master-file "\n")
(insert "\t" LilyPond-lilypond-command " " master-file "\n")
(dolist (f songs)
(insert (lilysong-file->wav f) ": " f "\n")
(insert "\t" LilyPond-synthesize-command " $< " (or language "") "\n"))
;; We can't use midi files in ecasound directly, because setpos
;; doesn't work on them.
(let ((lilymidi LilyPond-lilymidi-command)
(voice-rate (format "%d" (or (cdr (assoc-if (lambda (key) (string-match key language))
LilyPond-voice-rates))
16000))))
(when (string-match "%s" lilymidi)
(setq lilymidi (replace-match LilyPond-voice-track-regexp nil nil lilymidi)))
(dolist (f midi-files)
(insert (lilysong-file->wav f) ": " f "\n")
(let ((command LilyPond-midi->wav-command)
(lilymidi* lilymidi))
(when (string-match "%s" command)
(setq command (replace-match f nil nil command)))
(when (string-match "%t" command)
(setq command (replace-match (lilysong-file->wav f) nil nil command)))
(when (string-match "%r" command)
(setq command (replace-match voice-rate nil nil command)))
(when (string-match "%f" lilymidi*)
(setq lilymidi (replace-match f nil nil lilymidi*)))
(when (string-match "%m" command)
(setq command (replace-match lilymidi nil nil command)))
(insert "\t" command "\n")))
))))
temp-file))
(defun lilysong-after-compilation (buffer message)
(let ((data lilysong-compilation-data))
(when (and data
(equal compile-command
(lilysong-compilation-data-command data)))
(unwind-protect
(when (lilysong-up-to-date-p (lilysong-compilation-data-makefile data))
(lilysong-process-generated-files data))
(delete-file (lilysong-compilation-data-makefile data))))))
(defun lilysong-process-generated-files (data)
(with-current-buffer (lilysong-compilation-data-buffer data)
(setq lilysong-last-language lilysong-language))
(lilysong-play-files (lilysong-compilation-data-in-parallel data)
(lilysong-compilation-data-songs data)
(lilysong-compilation-data-midi data)))
;;; Playing files
(defun lilysong-play-files (in-parallel songs midi-files)
(funcall (if LilyPond-use-ecasound
'lilysong-play-with-ecasound
'lilysong-play-with-play)
in-parallel songs midi-files))
(defun lilysong-call-play (files)
(apply 'start-process "lilysong-el" nil LilyPond-play-command files))
(defun lilysong-play-with-play (in-parallel songs midi-files)
(let ((files (mapcar 'lilysong-file->wav (append songs midi-files))))
(if in-parallel
(dolist (f files)
(lilysong-call-play (list f)))
(lilysong-call-play files))))
(defun lilysong-make-ewf-files (files)
(let ((offset 0.0))
(dolist (f files)
(let* ((wav-file (lilysong-file->wav f))
(length (with-temp-buffer
(call-process "ecalength" nil t nil "-s" wav-file)
(goto-char (point-max))
(forward-line -1)
(read (current-buffer)))))
(with-temp-file (lilysong-file->ewf f)
(insert "source = " wav-file "\n")
(insert (format "offset = %s\n" offset))
(insert "start-position = 0.0\n")
(insert (format "length = %s\n" length))
(insert "looping = false\n"))
(setq offset (+ offset length))))))
(when (and (featurep 'ecasound)
(not (fboundp 'eci-cs-set-param)))
(defeci cs-set-param ((parameter "sChainsetup option: " "%s"))))
(defun lilysong-play-with-ecasound (in-parallel songs midi-files)
(ecasound)
(eci-cs-add "lilysong-el")
(eci-cs-select "lilysong-el")
(eci-cs-remove)
(eci-cs-add "lilysong-el")
(eci-cs-select "lilysong-el")
(eci-cs-set-param "-z:mixmode,sum")
(unless in-parallel
(lilysong-make-ewf-files songs)
;; MIDI files should actually start with each of the songs
(mapc 'lilysong-make-ewf-files (mapcar 'list midi-files)))
(let* ((file->wav (if in-parallel 'lilysong-file->wav 'lilysong-file->ewf))
(files (mapcar file->wav (append songs midi-files))))
(dolist (f files)
(eci-c-add f)
(eci-c-select f)
(eci-ai-add f))
(eci-c-select-all)
(eci-ao-add-default)
(let* ((n (length songs))
(right (if (<= n 1) 50 0))
(step (if (<= n 1) 0 (/ 100.0 (1- n)))))
(dolist (f songs)
(let ((chain (funcall file->wav f)))
(eci-c-select chain)
(eci-cop-add "-erc:1,2")
(eci-cop-add (format "-epp:%f" (min right 100)))
(incf right step))))
(eci-start)))
;;; User commands
(defun lilysong-arg->multi (arg)
(cond
((not arg)
nil)
((or
(numberp arg)
(equal arg '(4)))
t)
(t
'all)))
(defun lilysong-command (arg play-midi?)
(let* ((multi (lilysong-arg->multi arg))
(song-list (lilysong-song-list multi))
(midi-list (if play-midi? (lilysong-midi-list multi))))
(message "Singing %s" (mapconcat 'identity song-list ", "))
(lilysong-sing song-list midi-list (if play-midi? t (listp arg)))))
(defun LilyPond-command-sing (&optional arg)
"Sing lyrics of the current LilyPond buffer.
Without any prefix argument, sing current \\festival* command.
With the universal prefix argument, ask which parts to sing.
With a double universal prefix argument, sing all the parts.
With a numeric prefix argument, ask which parts to sing and sing them
sequentially rather than in parallel."
(interactive "P")
(lilysong-command arg nil))
(defun LilyPond-command-sing-and-play (&optional arg)
"Sing lyrics and play midi of the current LilyPond buffer.
Without any prefix argument, sing and play current \\festival* and \\midi
commands.
With the universal prefix argument, ask which parts to sing and play.
With a double universal prefix argument, sing and play all the parts."
(interactive "P")
(lilysong-command arg t))
(defun LilyPond-command-sing-last ()
"Repeat last LilyPond singing command."
(interactive)
(if lilysong-last-command-args
(apply 'lilysong-sing lilysong-last-command-args)
(error "No previous singing command")))
(defun LilyPond-command-clean ()
"Remove generated *.xml and *.wav files used for singing."
(interactive)
(flet ((delete-file* (file)
(when (file-exists-p file)
(delete-file file))))
(dolist (xml-file (lilysong-song-list 'all))
(delete-file* xml-file)
(delete-file* (lilysong-file->wav xml-file)))
(mapc 'delete-file* (mapcar 'lilysong-file->wav (lilysong-midi-list 'all)))))
(define-key LilyPond-mode-map "\C-c\C-a" 'LilyPond-command-sing)
(define-key LilyPond-mode-map "\C-c\C-q" 'LilyPond-command-sing-and-play)
(define-key LilyPond-mode-map "\C-c\C-x" 'LilyPond-command-clean)
(define-key LilyPond-mode-map "\C-c\C-z" 'LilyPond-command-sing-last)
(easy-menu-add-item LilyPond-command-menu nil
["Sing Current" LilyPond-command-sing t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing Selected" (LilyPond-command-sing '(4)) t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing All" (LilyPond-command-sing '(16)) t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing Selected Sequentially" (LilyPond-command-sing 1) t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing and Play Current" LilyPond-command-sing-and-play t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing and Play Selected" (LilyPond-command-sing-and-play '(4)) t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing and Play All" (LilyPond-command-sing-and-play '(16)) t])
(easy-menu-add-item LilyPond-command-menu nil
["Sing Last" LilyPond-command-sing-last t])
;;; Announce
(provide 'lilypond-song)
;;; lilypond-song.el ends here

View File

@ -0,0 +1,260 @@
; Features:
;
; -> Counts number of notes between last | and point. Adds durations of
; each note up, and returns result.
;
; -> Works well on notes and chords.
;
; -> Ignores most keywords, like \override
;
; -> Is aware of certain keywords which often contain parameters that
; look like notes, but should not be counted.
; | a \key b \minor c % b is not counted, but a and c are.
;
; -> Ignores Scheme expressions, which start with #
;
; -> Doesn't ignore the \times keyword. Intelligently handles triplets.
;
;
; Caveats:
;
; -> Doesn't work on regions that aren't preceded by a |. This is because such
; notes are only delimited by a {, and what-beat can't distinguish a { that
; opens a set of notes from an internal { (say from a triplet)
;
; -> Doesn't work with << >> expressions or nested {} expressions (unless
; {} is part of a keyword like \times)
;
; -> Keywords abutted against a note are not visible to what-beat, and
; can therefore surreptitiosly sneak fake notes into what-beat.
; | c\glissando f <- BAD: the f gets counted, but shouldn't
; | c \glissando f <- GOOD: the f gets ignored
;
; -> Does not look outside notes context. Derivation rules don't work:
; str = \notes { a8 b c d }
; \score { \notes { | e4 %{ gets counted }% \str %{gets ignored}%
;
; -> Does not handle repeats.
;
; -> Ignores \bar commands (and does not get confused by a | inside a \bar)
;
; Recognizes pitch & octave
(setq pitch-regex "\\([a-z]+[,']*\\|<[^>]*>\\)\\(=[,']*\\)?")
; Recognizes duration
(setq duration-regex "[ \t\n]*\\(\\(\\(128\\|6?4\\|3?2\\|16?\\|8\\)\\([.]*\\)\\)\\([ \t]*[*][ \t]*\\([0-9]+\\)\\(/\\([1-9][0-9]*\\)\\)?\\)?\\)")
; These keywords precede notes that should not be counted during beats
(setq Parm-Keywords '("key" "clef" "appoggiatura" "acciaccatura" "grace"
"override" "revert" "glissando"))
(defun extract-match (string match-num)
(if (null (match-beginning match-num))
nil
(substring string (match-beginning match-num) (match-end match-num))))
(defun add-fractions (f1 f2)
"Adds two fractions, both are (numerator denominator)"
(setq result (list (+ (* (car f1) (cadr f2)) (* (car f2) (cadr f1)))
(* (cadr f1) (cadr f2))))
(setq result (reduce-fraction result 2))
(setq result (reduce-fraction result 3))
(setq result (reduce-fraction result 5))
(setq result (reduce-fraction result 7))
)
(defun reduce-fraction (f divisor)
"Eliminates divisor from fraction if present"
(while (and (= 0 (% (car result) divisor))
(= 0 (% (cadr result) divisor))
(< 1 (cadr result))
(< 0 (car result)))
(setq result (list (/ (car result) divisor) (/ (cadr result) divisor))))
result
)
(defun parse-duration (duration)
"Returns a duration string parsed as '(numerator denominator)"
(string-match duration-regex duration)
(let ((result (list 1 (string-to-number (extract-match duration 2))))
(dots (extract-match duration 4))
(numerator (or (extract-match duration 6) "1"))
(denominator (or (extract-match duration 8) "1")))
(if (and (not (null dots)) (< 0 (string-width dots)))
(dotimes (dummy (string-width dots))
(setq result (list (1+ (* 2 (car result))) (* 2 (cadr result))))))
(list (* (string-to-number numerator) (car result))
(* (string-to-number denominator) (cadr result)))
))
(defun walk-note-duration ()
"Returns duration of next note, moving point past note.
If point is not before a note, returns nil
If next note has no duration, returns t"
(let ((have-pitch (looking-at pitch-regex)))
(if have-pitch (goto-char (match-end 0)))
(if (not (looking-at duration-regex))
have-pitch
(goto-char (match-end 0))
(parse-duration (match-string 0)))))
; returns nil if not at a comment
(defun skip-comment ()
(if (not (char-equal ?\% (following-char)))
nil
(progn
(forward-char)
(if (char-equal ?\{ (following-char))
(re-search-forward "}%" nil t)
(progn
(skip-chars-forward "^\n")
(forward-char)))
t
)))
; returns nil if not at a quotation
(defun skip-quotation ()
(if (not (char-equal ?\" (following-char)))
nil
(progn
(forward-char)
(skip-chars-forward "^\"")
(forward-char)
t
)))
; returns nil if not at a sexp
(defun skip-sexp ()
(interactive)
(if (not (char-equal ?\# (following-char)))
nil
(progn
(forward-char)
(if (char-equal ?\' (following-char))
(forward-char))
(if (not (char-equal ?\( (following-char)))
(skip-chars-forward "^ \t\n")
(progn
(let ((paren 1))
(while (< 0 paren)
(forward-char)
(cond ((char-equal ?\( (following-char))
(setq paren (1+ paren)))
((char-equal ?\) (following-char))
(setq paren (1- paren)))))
(forward-char)
t
))))))
(defun goto-note-begin ()
(interactive)
; skip anything that is not ws. And skip any comments or quotations
(while (or (< 0 (skip-chars-forward "^ \t\n~%#\""))
(skip-comment)
(skip-quotation)
(skip-sexp)))
; Now skip anything that isn't alphanum or \. And skip comments or quotations
(while (or (< 0 (skip-chars-forward "^A-Za-z1-9<%}#=\""))
(skip-comment)
(skip-quotation)
(skip-sexp)))
; (skip-chars-forward "^\\") Why doesn't this work?!!
(if (char-equal ?\\ (preceding-char))
(backward-char))
)
(defun skip-good-keywords ()
(if (looking-at "\\\\\\([a-z]*\\)")
(progn
(goto-char (match-end 0))
(if (member (match-string 1) Parm-Keywords)
(progn
(if (looking-at "[ \t\n]*?\\([a-z0-9_]+\\|{[^}]*}\\|\"[^\"]*\"\\)")
(goto-char (match-end 0))
(error "Improper regex match:")
(error "Unknown text: %s")
))))))
(defun find-measure-start ()
(let ((start (re-search-backward "\|" 0 t)))
(if (null start)
-1
(if (looking-at "[^ \n\t]*\"")
(find-measure-start)
(point)
))))
(defun get-beat ()
(save-excursion
(save-restriction
(let* ((end (point))
(measure-start (find-measure-start))
(last-dur (or (re-search-backward duration-regex 0 t) -1))
(duration (if (= -1 last-dur) 0 (parse-duration (match-string 0))))
(result '(0 1))) ; 0 in fraction form
(if (= measure-start -1)
(message "No | before point")
(goto-char (1+ measure-start))
(goto-note-begin)
(while (< (point) end)
(let ((new-duration (walk-note-duration)))
(if (null new-duration)
(if (not (looking-at
(concat "\\\\t\\(?:\\(imes\\)\\|uplet\\)[ \t]*\\([0-9]+\\)/\\([0-9]+\\)\\(?:[ \t\n]"
duration-regex "\\)?[ \t\n]*{")))
(skip-good-keywords)
; handle \times/\tuplet specially
(let* ((times-p (match-beginning 1))
(numerator (string-to-number (match-string (if times-p 2 3))))
(denominator (string-to-number (match-string (if times-p 3 2)))))
(goto-char (match-end 0))
(goto-note-begin)
(while (and (not (looking-at "}"))
(< (point) end))
(setq new-duration (walk-note-duration))
(if (null new-duration)
(if (looking-at "\\\\[a-z]*[ \t]*[a-z]*")
(goto-char (match-end 0))
(error "Unknown text: %S %s" result(buffer-substring (point) end))))
(if (not (eq new-duration t))
(setq duration new-duration))
(setq result (add-fractions result
(list (* numerator (car duration))
(* denominator (cadr duration)))))
(goto-note-begin))
(if (< (point) end)
(forward-char 1)))) ; skip }
(if (not (eq new-duration t))
(setq duration new-duration))
(setq result (add-fractions result duration)))
(goto-note-begin)))
result)))))
(defun LilyPond-what-beat ()
"Returns how much of a measure lies between last measaure '|' and point.
Recognizes chords, and triples."
(interactive)
(let ((beat (get-beat)))
(message "Beat: %d/%d" (car beat) (cadr beat)))
)
(defun LilyPond-electric-bar ()
"Indicate the number of beats in last measure when a | is inserted"
(interactive)
(self-insert-command 1)
(save-excursion
(save-restriction
(backward-char)
(LilyPond-what-beat)
(forward-char)
)))

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
Subproject commit 8deb0f2252399cca2426eb3cc3e9646c5de726b3

@ -0,0 +1 @@
Subproject commit 44f77cc35f75e623a6e2a419629a16ec9b9c3fbf

36
.gitmodules vendored
View File

@ -7,3 +7,39 @@
[submodule "zsh-custom/plugins/zsh-syntax-highlighting"]
path = zsh-custom/plugins/zsh-syntax-highlighting
url = git://github.com/zsh-users/zsh-syntax-highlighting
[submodule ".emacs.d/site-elisp/color-rg"]
path = .emacs.d/site-elisp/color-rg
url = https://github.com/manateelazycat/color-rg.git
[submodule ".emacs.d/site-elisp/awesome-pair"]
path = .emacs.d/site-elisp/awesome-pair
url = https://github.com/manateelazycat/awesome-pair.git
[submodule ".emacs.d/site-elisp/header2"]
path = .emacs.d/site-elisp/header2
url = https://github.com/emacsmirror/header2.git
[submodule ".emacs.d/site-elisp/grep-dired"]
path = .emacs.d/site-elisp/grep-dired
url = https://github.com/manateelazycat/grep-dired.git
[submodule ".emacs.d/site-elisp/leetcode.el"]
path = .emacs.d/site-elisp/leetcode.el
url = https://github.com/kaiwk/leetcode.el.git
[submodule ".emacs.d/site-elisp/delete-block"]
path = .emacs.d/site-elisp/delete-block
url = https://github.com/manateelazycat/delete-block.git
[submodule ".emacs.d/site-elisp/instant-rename-tag"]
path = .emacs.d/site-elisp/instant-rename-tag
url = https://github.com/manateelazycat/instant-rename-tag.git
[submodule ".emacs.d/site-elisp/emacs-application-framework"]
path = .emacs.d/site-elisp/emacs-application-framework
url = https://github.com/manateelazycat/emacs-application-framework.git
[submodule ".emacs.d/site-elisp/snails"]
path = .emacs.d/site-elisp/snails
url = https://github.com/manateelazycat/snails.git
[submodule ".emacs.d/site-elisp/multi-term"]
path = .emacs.d/site-elisp/multi-term
url = https://github.com/manateelazycat/multi-term.git
[submodule ".emacs.d/site-elisp/epaint"]
path = .emacs.d/site-elisp/epaint
url = https://github.com/chuntaro/epaint.git
[submodule ".emacs.d/site-elisp/aweshell"]
path = .emacs.d/site-elisp/aweshell
url = https://github.com/MatthewZMD/aweshell.git