Chapter 8. Install and configure Emacs
-
Compile Emacs
Get the source code.
git clone git://git.sv.gnu.org/emacs.git
Install the prerequisites to compile it.
apt install libgccjit0 libgccjit-10-dev gcc-10 g++-10 libjansson4 libjansson-dev autoconf libgtk-4-dev libncurses6 gnome-tweaks libgccjit0 libccjit-10-dev gnutls-bin libgnutls28-dev libncurses5-dev libgif-dev libxpm-dev libsqlite3-dev libmagickwand-dev libtree-sitter-dev
export CC=/usr/bin/gcc-10 CXX=/usr/bin/gcc-10 ./configure --with-pgtk --with-native-compilation --with-json --with-imagemagick make -j8 cd emacs ./autogen.sh
make install
-
Emacs
Get the standard config
mkdir ~/.emacs
cp ~/Dropbox/Basic/new_machine/linux/emacs/.emacs.d.init.el.current ~/.emacs.d/init.el
;;; init.el --- Initialization file for Emacs ;;; Commentary: ;;; sanmarco version ;; Emacs Startup File --- initialization for Emacs ;; Settings froma https://aronbedra.com/emacs.d/ ;; Settings from https://www.sandeepnambiar.com/my-minimal-emacs-setup/ ;;; Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Packaging ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'package) (setq package-enable-at-startup nil) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package) (eval-when-compile (require 'use-package))) ;; Start benchmarking as early as possible (use-package benchmark-init :config ;; To disable collection of benchmark data after init is done. (add-hook 'after-init-hook 'benchmark-init/deactivate)) (add-hook 'after-init-hook (lambda () (message "loaded in %s" (emacs-init-time)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Custom ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(default ((t (:family "Quadraat Sans Mono OT" :foundry "unknown" :slant normal :weight normal :height 200 :width normal)))) '(flycheck-inline-error ((t (:inherit compilation-error :inverse-video t :family "IBM Plex Mono")))) '(flycheck-inline-info ((t (:inherit compilation-info :inverse-video t :family "IBM Plex Mono")))) '(flycheck-inline-warning ((t (:inherit compilation-warning :inverse-video t :family "IBM Plex Mono")))) '(powerline-active1 ((t (:background "tan" :foreground "gray29"))))) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) '(backup-by-copying t) '(backup-directory-alist '(("." . "~/.emacs.d/backup"))) '(column-number-mode t) '(company-idle-delay 2) '(completions-format 'one-column) '(create-lockfiles nil) '(custom-safe-themes '("830877f4aab227556548dc0a28bf395d0abe0e3a0ab95455731c9ea5ab5fe4e1" "285d1bf306091644fb49993341e0ad8bafe57130d9981b680c1dbd974475c5c7" "57a29645c35ae5ce1660d5987d3da5869b048477a7801ce7ab57bfb25ce12d3e" "51ec7bfa54adf5fff5d466248ea6431097f5a18224788d0bd7eb1257a4f7b773" "4c56af497ddf0e30f65a7232a8ee21b3d62a8c332c6b268c81e9ea99b11da0d3" "fee7287586b17efbfda432f05539b58e86e059e78006ce9237b8732fde991b4c" "c433c87bd4b64b8ba9890e8ed64597ea0f8eb0396f4c9a9e01bd20a04d15d358" "2809bcb77ad21312897b541134981282dc455ccd7c14d74cc333b6e549b824f3" default)) '(delete-old-versions t) '(echo-keystrokes 0.1) '(flycheck-check-syntax-automatically '(save idle-change idle-buffer-switch new-line mode-enabled)) '(flycheck-disabled-checkers '(python-pylint)) '(flycheck-display-errors-delay 0.3) '(flycheck-display-errors-function 'flycheck-display-error-messages-unless-error-list) '(flycheck-flake8rc "~/.config/.flake8") '(flycheck-idle-change-delay 0.2) '(flycheck-indication-mode 'left-fringe) '(flycheck-navigation-minimum-level 'error) '(flycheck-pylintrc "~/.config/.pylintrc" nil nil "set standard") '(flycheck-python-mypy-config '("mypy.ini" "setup.cfg" "~/.config/mypy/config")) '(flycheck-relevant-error-other-file-minimum-level 'error) '(flycheck-relevant-error-other-file-show nil) '(frame-title-format '((:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b"))) t) '(fset 'yes-or-no-p t) '(gc-cons-threshold 50000000) '(git-gutter:modified-sign "Δ") '(git-gutter:verbosity 0) '(global-auto-revert-mode t) '(global-display-line-numbers-mode 1) '(global-hl-line-mode 1) '(indent-tabs-mode nil) '(inhibit-startup-screen t) '(kept-new-versions 20) '(kept-old-versions 5) '(large-file-warning-threshold 100000000) '(line-number-mode 1) '(menu-bar-mode nil) '(next-error-message-highlight 'keep) '(nxml-slash-auto-complete-flag t) '(package-selected-packages '(jinja2-mode scad-mode benchmark-init undo-tree diffview ac-slime anaconda-mode auto-complete blacken company-jedi crux dap-mode dash expand-region flycheck flycheck-pos-tip free-keys helm hideshow-org importmagic json-mode markdown-mode py-isort python-pytest pythonic smart-mode-line smex solarized-theme use-package which-key yasnippet yasnippet-snippets)) '(prefer-coding-system 'utf-8) '(python-check-command "mypy") '(read-extended-command-predicate 'command-completion-default-include-p) '(scroll-bar-mode nil) '(set-default-coding-systems 'utf-8) '(set-keyboard-coding-system 'utf-8) '(set-terminal-coding-system 'utf-8) '(show-paren-mode t) '(size-indication-mode t) '(solarized-distinct-fringe-background t) '(solarized-emphasize-indicators nil) '(solarized-high-contrast-mode-line t) '(tab-width 4) '(tool-bar-mode nil) '(undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree/"))) '(use-package-always-ensure t) '(version-control t)) (add-hook 'after-change-major-mode-hook (lambda() (electric-indent-mode -1))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Packages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (use-package blacken) (use-package company :ensure t :diminish company-mode :config (add-hook 'after-init-hook 'global-company-mode)) (use-package company :ensure t :diminish company-mode :config (add-hook 'after-init-hook 'global-company-mode)) (use-package crux :ensure t :bind ("C-k" . crux-smart-kill-line) ("C-c n" . crux-cleanup-buffer-or-region) ("C-c f" . crux-recentf-find-file) ("C-a" . crux-move-beginning-of-line)) ;; ;; https://tychoish.com/post/better-company/ ;; (setq company-backends '(company-capf ;; company-keywords ;; company-jedi)) ;; (setq company-tooltip-limit 20) ;; (setq company-show-quick-access t) ;; (setq company-idle-delay 0) ;; (setq company-echo-delay 0) (use-package exec-path-from-shell :config (exec-path-from-shell-initialize)) (use-package expand-region :ensure t :bind ("M-m" . er/expand-region)) (use-package flycheck :ensure t :init (global-flycheck-mode)) (use-package flycheck-color-mode-line) (use-package flycheck-inline) (with-eval-after-load 'flycheck (add-hook 'flycheck-mode-hook #'flycheck-inline-mode) (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode) (flycheck-pos-tip-mode)) (use-package git-gutter :config (global-git-gutter-mode 't)) (use-package graphviz-dot-mode) (use-package hideshow) (use-package magit :bind (("C-M-g" . magit-status))) ;; (use-package nxml-mode) (use-package powerline) (powerline-default-theme) (use-package pyvenv :ensure t :config (pyvenv-mode 1)) (use-package rainbow-delimiters :config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)) (use-package rainbow-mode :config (setq rainbow-x-colors nil) (add-hook 'prog-mode-hook 'rainbow-mode)) (use-package recentf :config (recentf-mode 1)) (use-package sgml-mode) (use-package smart-mode-line :ensure t :config ;; (setq sml/theme 'powerline) (add-hook 'after-init-hook 'sml/setup)) (use-package smex :bind ("M-x" . smex) ("M-X" . smex-major-mode-commands)) (use-package smart-mode-line :ensure t :config ;; (setq sml/theme 'powerline) (add-hook 'after-init-hook 'sml/setup)) (use-package solarized-theme :config (load-theme 'solarized-gruvbox-dark t)) (use-package undo-tree :defer 5 :config (global-undo-tree-mode 1)) (use-package which-key :config (which-key-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Python ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-hook 'python-mode-hook (lambda () ;; explicitly load company for the occasion when the deferred ;; loading with use-package hasn't kicked in yet (company-mode) ) ) (org-babel-do-load-languages 'org-babel-load-languages '((python . t))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Flycheck ;; from https://medium.com/@enzuru/helpful-emacs-python-mode-hooks-especially-for-type-hinting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (flycheck-define-checker python-mypy "" :command ("mypy" "--ignore-missing-imports" "--python-version" "3.8" source-original) :error-patterns ((error line-start (file-name) ":" line ": error:" (message) line-end)) :modes python-mode :after (add-to-list 'flycheck-checkers 'python-mypy) (remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nXML/Docbook ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (eval-after-load 'rng-loc ;; '(add-to-list 'rng-schema-locating-files "~/.schema/schemas.xml")) ;; (add-to-list 'hs-special-modes-alist ;; '(nxml-mode ;; "<!--\\|<[^/>]*[^/]>" ;; "-->\\|</[^/>]*[^/]>" ;; "<!--" ;; sgml-skip-tag-forward ;; nil) ;; ) ;; (add-hook 'nxml-mode-hook 'hs-minor-mode) ;; ;; optional key bindings, easier than hs defaults ;; (define-key nxml-mode-map (kbd "C-c h") 'hs-toggle-hiding) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; HTML/CSS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar c-basic-offset) (add-hook 'css-mode-hook (lambda () (setq c-basic-offset 2) (setq indent-tabs-mode nil))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Global Keyboard Mappings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'org) ; Required to prevent flycheck error with org-mode keybindings (require 'bind-key) (bind-keys* ("C--" . company-complete) ; Ctrl+hyphen ("C-;" . comment-or-uncomment-region) ; tried moving flycheck bindings to use-package but didn't work ("C-<next>" . flycheck-next-error) ; Ctrl+<page-down> ("C-<prior>" . flycheck-previous-error) ; Ctrl+<page-up> ("C-<return>" . completion-at-point) ("C-`" . keyboard-escape-quit) ("C-c a" . org-agenda) ("C-c c" . org-capture) ("C-c l" . org-store-link) ("C-c C-n" . next-error) ("C-f" . toggle-frame-fullscreen) ("C-g" . goto-line) ("C-h" . replace-string) ("C-v" . yank) ; Stop scrolling-up by muscle memory ("C-z" . undo) ; Stop minimizing by accident ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Finish up ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'server) (if (not (server-running-p)) (server-start)); (provide '.emacs) (provide 'init) ;;; init.el ends here
-
Konsole
Config files will only be kept if the copying occurs with Konsole closed (i.e., in xterm or console). If that fails, the key settings are in both Edit Profile and Configure Konsole.
xterm &
Close all instances of Konsole
Copy files
cp ~/Dropbox/Basic/new_machine/linux/kde/konsolerc .config/
mkdir ~/.local/share/konsole
cp ~/Dropbox/Basic/new_machine/linux/kde/Joel\'s\ Konsole\ Profile.profile ~/.local/share/konsole
Configure Konsole Always Show Tab Bar
Configure Profile
-
Solarized
-
14 pt Quadraat Sans Mono
-
Set Unlimited Scrollbar, Hidden
-
hide Menubar
-
Uncheck Show Menubar by default
-
-
Aliases
Copy the file.
cp ~/Dropbox/Basic/new_machine/linux/misc/.bash_aliases ~/
alias df='duf' alias diff='delta' alias duh='dust -d 2' alias elast='emacs $(!!)' alias grep='rg' alias grepnocomment='rg ^[^#]' alias less='less --quit-if-one-screen --no-init' alias more='less --quit-if-one-screen --no-init' alias man='man --pager="less -FX"' alias ps='procs' alias pf='procs --tree' alias pg='procs --tree | rg' alias tx='tar xzvf' alias tj='tar xjvf' alias tJ='tar xJvf' alias ..='cd ..' alias ...='cd ../../../' alias ....='cd ../../../../' alias .....='cd ../../../../' alias .4='cd ../../../../' alias .5='cd ../../../../..' alias l='exa --all --header --binary --group --long --tree --level=1 --sort=changed' alias ll='exa --all --header --binary --group --long --tree --level=2 --sort=changed' alias lll='exa --all --header --binary --group --long --tree --level=3 --sort=changed' alias llll='exa --all --header --binary --group --long --tree --level=4 --sort=changed' alias lall='exa --all --header --binary --group --long --tree --sort=changed' alias lss='exa --all --header --binary --group --long --tree --level=1 --sort=size' alias lnn='exa --all --header --binary --group --long --tree --level=1 --sort=name' alias ld=ls\ -alrt\ '~/Downloads'\ --block-size="\'1" alias h=history alias hig='history | grep ' alias mv='mv -i' # applications alias gq='geeqie' alias m=mpv # Package Management alias aptfiles='dpkg-query -L' alias aptstat='dpkg -l | grep' alias ass='apt-cache search' alias aptapt="apt-get update && apt-get upgrade -y && apt-get autoremove -y" umask=0002 export EDITOR=emacs tty -s && export PS1="\t \u@\h:\w\\$ \[$(tput sgr0)\]"
Repeat for skel.
cp ~/Dropbox/Basic/new_machine/linux/misc/.bash_aliases /etc/skel/
Repeat for root
cp ~/Dropbox/Basic/new_machine/linux/misc/.bash_aliases /root/
-
Add ~/bin to path
Edit:
emacs ~/.bashrc
Add at the end:
export PATH=$PATH:~/bin
And remove the default alias for
l
Warning
Seems like this may not be necessary because it's in .profile?? Check in later.
-
MPV
Load config files
mkdir ~/.config/mpv
Copy over custom key bindings for changing aspect ratiocp ~/Dropbox/Basic/new_machine/linux/misc/mpv_input.conf ~/.config/mpv/input.conf
F2 video-aspect-override 1.3333 F3 video-aspect-override 1.7778 F4 video-aspect-override 1.85 F5 video-aspect-override 2 F6 video-aspect-override 2.3 F7 video-aspect-override 1 F8 video-aspect-override 1.1 F9 video-aspect-override 1.2 F10 zoom 2