Merge branch 'trim'

This commit is contained in:
Grigory Shipunov 2020-11-14 22:22:45 +01:00
commit d78cdf6cc7
No known key found for this signature in database
GPG key ID: 77BB6C3E4771EE7C
2 changed files with 149 additions and 88 deletions

6
.gitignore vendored
View file

@ -1,9 +1,13 @@
auto-save-list
backups
bookmarks
custom.el
games
ido.last
irony
projectile-bookmarks.eld
smex-items
straight
custom.el
transient
games
bookmarks

231
init.el
View file

@ -1,4 +1,4 @@
;;; init.el --- emacs configuration
;;; init.el --- emacs configuration -*- lexical-binding: t; -*-
;;; Commentary:
;;; M-x 🦋
;;; Code:
@ -25,7 +25,9 @@
(require 'use-package)
;; essential config
(menu-bar-mode -1)
(if (eq system-type 'darwin)
(menu-bar-mode 1) ; if on a mac, there's global menu anyway
(menu-bar-mode -1))
(tool-bar-mode -1)
(toggle-scroll-bar 1)
(global-display-line-numbers-mode)
@ -34,6 +36,9 @@
(setq auto-save-default nil)
(setq visible-bell t)
;; declutter modeline with diminish
(straight-use-package 'diminish)
;; magic in the world of idiotic defaults...
(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-nonexistent-file-or-buffer nil)
@ -41,6 +46,7 @@
;; readline prevails
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-h" 'delete-backward-char)
(defadvice term-handle-exit
(after term-kill-buffer-on-exit activate)
@ -54,12 +60,16 @@
(add-hook 'prog-mode-hook #'my-whitespace-hook)
(add-hook 'text-mode-hook #'my-whitespace-hook)
;; let's try to fix the pile of burning garbage that emacs calls a tab
;; let's try to fix the pile of burning garbage that emacs calls a
;; tab. If anyone reading actually knows why mixing tabs and spaces or
;; deleting the tab one space at a time is a good idea, please drop me
;; an email. I want to know.
(require 'whitespace)
(setq whitespace-style '(face tabs tab-mark))
(setq whitespace-display-mappings
'((tab-mark 9 [187 9] [92 9])))
'((tab-mark 9 [187 9] [92 9])))
(add-hook 'prog-mode-hook #'whitespace-mode)
(diminish 'whitespace-mode)
;; let's delete a tab as a whole...
(setq backward-delete-char-untabify-method 'nil)
@ -68,25 +78,53 @@
(straight-use-package 'smart-tabs-mode)
(smart-tabs-insinuate 'c 'c++)
;; radical way to fix emacs mixing tabs and spaces
(setq-default indent-tabs-mode nil)
;;helper functions to switch tab expansion on and off
(defun tabs-yay ()
"Function to enable tab indentation in buffer."
;;(local-set-key (kbd "TAB") 'tab-to-tab-stop)
(setq indent-tabs-mode t))
(defun tabs-nay () (setq indent-tabs-mode nil))
(defun tabs-nay ()
"Function to enable space indentation in buffer."
(setq indent-tabs-mode nil))
;;wasteland of hooks regarding tabs behaviour
;;Remember how it "Just worked"™ in vim?
;;That's what you pay with for org mode
(add-hook 'prog-mode-hook 'tabs-yay)
(add-hook 'lisp-mode-hook 'tabs-nay)
(add-hook 'scheme-mode-hook 'tabs-nay)
(add-hook 'emacs-lisp-mode-hook 'tabs-nay)
;; wasteland of hooks regarding tabs behavior Remember how it "Just
;; worked"™ in vim? That's what you pay with for org mode
(add-hook 'cc-mode-hook 'tabs-yay)
;; time to throw out this "DocView" abomination: full featured pdf
;; viewer of antiquity, that emacs uses today!
(defun ensc/mailcap-mime-data-filter (filter)
(mapcar (lambda(major)
(append (list (car major))
(remove nil
(mapcar (lambda(minor)
(when (funcall filter (car major) (car minor) (cdr minor))
minor))
(cdr major)))))
mailcap-mime-data))
(defun ensc/no-pdf-doc-view-filter (major minor spec)
(if (and (string= major "application")
(string= minor "pdf")
(member '(viewer . doc-view-mode) spec))
nil
t))
(eval-after-load 'mailcap
'(progn
(setq mailcap-mime-data
(ensc/mailcap-mime-data-filter 'ensc/no-pdf-doc-view-filter))))
;; TODO: and this seems to make xdg-open work, but breaks python interpreter
;; (setq process-connection-type nil)
;; highlight the parens
(setq show-paren-delay 0)
(show-paren-mode 1)
;; follow symlinks to version-controlled files
(setq vc-follow-symlinks t)
@ -105,58 +143,63 @@
version-control t)
;; color theme
(straight-use-package 'gruvbox-theme)
(straight-use-package 'leuven-theme)
(straight-use-package 'zenburn-theme)
(straight-use-package 'color-theme-sanityinc-tomorrow)
(load-theme 'sanityinc-tomorrow-night 1)
(set-face-italic 'font-lock-comment-face t)
(set-face-italic 'font-lock-comment-delimiter-face nil)
(load-theme 'gruvbox-dark-hard t)
;; CC mode default styles
(setq c-default-style '((java-mode . "java")
(awk-mode . "awk")
(c-mode . "linux")
(c++-mode . "stroustrup")
(other . "linux")))
;; swiper for search
(straight-use-package 'swiper)
(global-set-key "\C-s" 'swiper)
;; ivy for completion
(straight-use-package 'ivy)
(ivy-mode 1)
(diminish 'ivy-mode)
;; ignore substring order, except for swiper
(setq ivy-re-builders-alist
'((swiper . ivy--regex-plus)
(t . ivy--regex-ignore-order)))
;; do not use caret, quite often we want start typing from the middle
(eval-after-load 'counsel ;counsel modifies this var
(setq ivy-initial-inputs-alist nil))
;; counsel for ivy-powered alternatives
(straight-use-package 'counsel)
(counsel-mode 1)
(diminish 'counsel-mode)
;; completion by default - welcome to 2020
(straight-use-package 'company)
(straight-use-package 'company-auctex)
(add-hook 'after-init-hook 'global-company-mode)
(diminish 'company-mode)
;; healthy people weeks are starting on Monday
(use-package calendar
:init (setq calendar-week-start-day 1))
;; CC mode
(use-package cc-mode
:init
(setq c-default-style '((java-mode . "java")
(awk-mode . "awk")
(c-mode . "linux")
(c++-mode . "stroustrup")
(other . "linux"))))
(use-package tex-site
:defer t
:mode ("\\.tex\\'" . latex-mode)
:straight auctex
:config
(setq TeX-parse-self t)
(use-package company-auctex
:straight t
:config
(company-auctex-init)))
;; completion for LaTeX
(use-package company-auctex
:config
(company-auctex-init)))
(use-package latex-preview-pane
:straight t)
(use-package flycheck
:straight t
:config (global-flycheck-mode))
(use-package ivy
:straight t
:demand
:bind (("\C-s" . swiper)
("C-c C-r" . ivy-resume))
:init
(setq ivy-display-style 'fancy)
:config
(ivy-mode 1))
(use-package counsel
:straight t
:config
(counsel-mode 1))
(use-package rainbow-delimiters
:straight t
:hook ((emacs-lisp-mode . rainbow-delimiters-mode)
@ -177,18 +220,18 @@
org-startup-folded 'content)
;; default agenda files
(setq org-agenda-files '("~/nextcloud/org/"
"~/nextcloud/org-phone/"
"~/nextcloud/org/phone/"
"~/Seafile/ORG/"))
;; templates
(setq org-capture-templates
'(("t" "TODO" entry
(file+headline "~/nextcloud/org/random.org" "Tasks")
(file+headline "~/nextcloud/org/inbox.org" "Tasks")
"** TODO %?\n %i")
("T" "TODO+file" entry
(file+headline "~/nextcloud/org/random.org" "Tasks")
(file+headline "~/nextcloud/org/inbox.org" "Tasks")
"** TODO %?\n %i\n %a")
("n" "note" entry
(file+headline "~/nextcloud/org/random.org" "Notes")
(file+headline "~/nextcloud/org/inbox.org" "Notes")
"** %U\n%?\n")
("i" "IFW TODO" entry
(file+headline "~/Seafile/ORG/ifw.org" "Tasks")
@ -197,56 +240,47 @@
(file+datetree "~/nextcloud/org/log.org.gpg")
"**** %U %?\n")
("b" "Bookmark" entry
(file "~/nextcloud/org/bookmarks.org")
"* [[%x][%?]\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")))
(file+headline "~/nextcloud/org/bookmarks.org" "Inbox")
"** [[%x][%?]\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")))
;; autosave advices for agenda and org-capture
(advice-add 'org-agenda-quit :before 'org-save-all-org-buffers)
(advice-add 'org-capture-finalize :after 'org-save-all-org-buffers)
;; refile everywhere where agenda lives
(setq org-refile-targets
'((nil :maxlevel . 1)
(org-agenda-files :maxlevel . 1)))
;; babel stuff
(org-babel-do-load-languages
'org-babel-load-languages
'((scheme . t)
'((C . t)
(dot . t)
(emacs-lisp .t)
(python . t)
(C . t))))
(scheme . t)))
;; latex preview settings
(add-to-list 'org-latex-packages-alist '("" "braket" t))
:config
;; abbrev expansion in org-mode
(require 'org-tempo))
(use-package org-tempo
:after org)
(use-package org-roam
:straight t
:hook ('after-init-hook . 'org-roam-mode)
:init (setq org-roam-directory "~/nextcloud/org/roam"
org-roam-db-update-method 'immediate))
(use-package magit
:straight t
:bind (("C-x C-g" . magit-dispatch)
("C-x g" . magit-status)))
(use-package gnuplot-mode
:straight t)
(use-package undo-tree
:straight t
:diminish
:config
(global-undo-tree-mode 1))
(use-package elpy
:straight t
:after flycheck
:hook
(elpy-mode . flycheck-mode)
:config
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(elpy-enable))
(use-package markdown-mode
:straight t
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init (setq markdown-command "multimarkdown"))
(use-package company
:straight t
:hook ('prog-mode . 'company-mode))
;; I positively cannot spell :D
(use-package ispell
:config
@ -262,12 +296,10 @@
('log-edit-mode . (lambda () (flyspell-mode -1)))
('prog-mode . 'flyspell-prog-mode)))
(use-package haskell-mode
:straight t)
(use-package comment-tags
:straight t
:hook (('prog-mode . 'comment-tags-mode)
('markdown-mode . 'comment-tags-mode)
('tex-mode . 'comment-tags-mode))
:init
(setq comment-tags-require-colon 0))
@ -280,14 +312,39 @@
:bind ("C-=" . er/expand-region))
(use-package vterm
:straight t
:bind ("C-c t" . vterm)
:init
(setq vterm-kill-buffer-on-exit t))
(use-package geiser
:straight t
:init
(setq geiser-active-implementations '(racket)))
(setq geiser-active-implementations '(racket mit)))
(use-package flycheck
:straight t
:init (global-flycheck-mode))
(use-package nix-mode
:straight t
:mode "\\.nix\\'")
(use-package markdown-mode
:straight t
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode)))
(use-package direnv
:straight t
:config
(direnv-mode))
(use-package which-key
:straight t
:diminish
:config
(which-key-mode))
;; throw away all the list-of-custom-shit!
(setq custom-file "~/.emacs.d/custom.el")