emacs tweaks

This commit is contained in:
Yorick van Pelt 2022-04-11 12:15:47 +02:00
parent 2942ad9525
commit 7f81dfb76b
Signed by: yorick
GPG key ID: A36E70F9DC014A15
5 changed files with 111 additions and 158 deletions

View file

@ -1,111 +0,0 @@
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(require 'package)
;; remove the load path for nix profiles
;; todo: fix woman
(eval-after-load 'woman '(error "fix the path from /nix/*-emacs-*/..site-start.el first"))
(require 'seq)
(setq load-path
(seq-difference load-path (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
(split-string (or (getenv "NIX_PROFILES") "")))))
(package-initialize 'noactivate)
(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.
'(custom-safe-themes
(quote
("8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "a8245b7cc985a0610d71f9852e9f2767ad1b852c2bdea6f4aadc12cce9c4d6d0" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
'(notmuch-saved-searches
(quote
((:name "unread" :query "tag:unread" :key "u")
(:name "flagged" :query "tag:flagged" :key "f")
(:name "sent" :query "tag:sent" :key "t")
(:name "drafts" :query "tag:draft" :key "d")
(:name "all mail" :query "*" :key "a")
(:name "inbox" :query "tag:inbox"))))
'(safe-local-variable-values
(quote
((eval c-set-offset
(quote inlambda)
0)
(eval c-set-offset
(quote arglist-cont-nonempty)
(quote
(c-lineup-gcc-asm-reg c-lineup-arglist)))
(eval c-set-offset
(quote arglist-close)
0)
(eval c-set-offset
(quote arglist-intro)
(quote ++))
(eval c-set-offset
(quote case-label)
0)
(eval c-set-offset
(quote statement-case-open)
0)
(eval c-set-offset
(quote access-label)
(quote -))
(eval c-set-offset
(quote substatement-open)
0)
(eval c-set-offset
(quote arglist-cont-nonempty)
(quote +))
(eval c-set-offset
(quote arglist-cont)
0)
(eval c-set-offset
(quote arglist-intro)
(quote +))
(eval c-set-offset
(quote inline-open)
0)
(eval c-set-offset
(quote defun-open)
0)
(eval c-set-offset
(quote innamespace)
0)
(indicate-empty-lines . t)))))
(setq org-modules '(org-bbdb org-bibtex org-docview org-gnus org-habit
org-info org-irc org-mhe org-rmail org-w3m))
(setq max-lisp-eval-depth 10000)
(setq max-specpdl-size 13000)
(org-babel-load-file "~/dotfiles/emacs/emacs.org")
;(add-to-list 'custom-theme-load-path "~/tmp/emacs-color-theme-solarized")
;; (defun set-solarized-theme (frame theme)
;; (set-frame-parameter frame 'background-mode theme)
;; (set-terminal-parameter frame 'background-mode theme)
;; (load-theme 'solarized)
;; ;; transparent background
;; (when (not (display-graphic-p)) (set-face-background 'default "unspecified-bg" frame)))
;; (add-hook 'after-make-frame-functions
;; (lambda (frame)
;; (let ((mode (if (display-graphic-p frame) 'light 'dark)))
;; (set-solarized-theme frame mode)
;; )))
(xterm-mouse-mode 1)
(define-key local-function-key-map "\033[73;5~" [(control return)])
(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.
'(evil-goggles-change-face ((t (:inherit diff-removed))))
'(evil-goggles-delete-face ((t (:inherit diff-removed))))
'(evil-goggles-paste-face ((t (:inherit diff-added))))
'(evil-goggles-undo-redo-add-face ((t (:inherit diff-added))))
'(evil-goggles-undo-redo-change-face ((t (:inherit diff-changed))))
'(evil-goggles-undo-redo-remove-face ((t (:inherit diff-removed))))
'(evil-goggles-yank-face ((t (:inherit diff-changed)))))

36
emacs/early-init.el Normal file
View file

@ -0,0 +1,36 @@
;; installed by home-manager
;; temporarily disable GC
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)
;; re-enable GC later
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold 100000000
gc-cons-percentage 0.1)))
;; disable toolbars before GUI shows
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
;; we use a tiling WM, so don't attempt any window resizes
(setq frame-inhibit-implied-resize t)
;; magic package quickstart feature
(setq package-quickstart 't)
(set-face-attribute 'default nil
:family "monospace"
:height 120
:weight 'normal
:width 'normal)
;; don't redisplay during startup
(setq-default inhibit-redisplay t
inhibit-message t)
(add-hook 'window-setup-hook
(lambda ()
(setq-default inhibit-redisplay nil
inhibit-message nil)
(redisplay)))

View file

@ -2,6 +2,11 @@
#+AUTHOR: Yorick van Pelt
* Prelims
** Workarounds?
#+BEGIN_SRC emacs-lisp
(setq max-lisp-eval-depth 10000)
(setq max-specpdl-size 13000)
#+END_SRC
** start server
#+BEGIN_SRC emacs-lisp
(server-start)
@ -18,6 +23,15 @@
(load custom-file)
#+END_SRC
* Org stuff
** Scratch buffer
#+BEGIN_SRC emacs-lisp
(setq initial-major-mode 'org-mode)
(setq initial-scratch-message "\
,#+TITLE: Scratch buffer
,#+AUTHOR: Yorick van Pelt
")
#+END_SRC
** modules
#+BEGIN_SRC emacs-lisp
#+END_SRC
@ -120,15 +134,6 @@
(setq org-ref-completion-library 'org-ref-ivy-cite))
#+END_SRC
* Look
** Fonts
#+BEGIN_SRC emacs-lisp
(set-face-attribute 'default nil
:family "monospace"
:height 120
:weight 'normal
:width 'normal)
#+END_SRC
** Solarized
#+BEGIN_SRC emacs-lisp
;; (use-package solarized
@ -157,14 +162,14 @@
#+END_SRC
** Transparency
#+BEGIN_SRC emacs-lisp
(set-frame-parameter (selected-frame) 'alpha '(95 . 95))
(add-to-list 'default-frame-alist '(alpha . (95 . 95)))
;; todo: transparency is slow somehow
;; (set-frame-parameter (selected-frame) 'alpha '(95 . 95))
;; (add-to-list 'default-frame-alist '(alpha . (95 . 95)))
#+END_SRC
** Cleaner frames
#+BEGIN_SRC emacs-lisp
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
;; toolbars are disabled in early-init.el
(setq inhibit-startup-screen t)
#+END_SRC
** hl-line
#+BEGIN_SRC emacs-lisp
@ -248,6 +253,7 @@ from https://vickychijwani.me/nuggets-from-my-emacs-part-i/
:diminish
:bind (("C-s" . swiper)
("C-c C-r" . ivy-resume)
("C-x b" . ivy-switch-buffer)
("<f6>" . ivy-resume)))
#+END_SRC
** Counsel
@ -280,7 +286,6 @@ from https://vickychijwani.me/nuggets-from-my-emacs-part-i/
** ggtags
#+BEGIN_SRC emacs-lisp
(use-package ggtags
:demand
:bind ("M-." . ggtags-find-tag-dwim))
#+END_SRC
** intuitive window resize
@ -337,6 +342,11 @@ from https://vickychijwani.me/nuggets-from-my-emacs-part-i/
: move-border-down
** TODO i3-emacs
** Terminal
#+BEGIN_SRC emacs-lisp
(xterm-mouse-mode 1)
(define-key local-function-key-map "\033[73;5~" [(control return)])
#+END_SRC
* editing
** line numbers
*** relative
@ -410,25 +420,27 @@ from [[https://www.emacswiki.org/emacs/BackupDirectory][emacs wiki]]
** Evil
#+BEGIN_SRC emacs-lisp
(global-undo-tree-mode)
(setq evil-want-C-i-jump nil)
;; prevent .~undo-tree file pollution
(setq undo-tree-auto-save-history nil)
(setq evil-want-C-i-jump nil)
(use-package evil
:config
(evil-mode t)
(evil-set-undo-system 'undo-tree)
(use-package evil
:config
(evil-mode t)
(evil-set-undo-system 'undo-tree)
; change cursor based on mode
(add-hook 'evil-insert-state-entry-hook (lambda () (when (not (display-graphic-p)) (send-string-to-terminal "\033[5 q"))))
(add-hook 'evil-normal-state-entry-hook (lambda () (when (not (display-graphic-p)) (send-string-to-terminal "\033[0 q"))))
)
(use-package which-key
:diminish
:init
(setq which-key-allow-evil-operators t)
(setq which-key-show-operator-state-maps t)
:config
(which-key-mode 1)
(which-key-setup-minibuffer)) ; do I need this?
; change cursor based on mode
(add-hook 'evil-insert-state-entry-hook (lambda () (when (not (display-graphic-p)) (send-string-to-terminal "\033[5 q"))))
(add-hook 'evil-normal-state-entry-hook (lambda () (when (not (display-graphic-p)) (send-string-to-terminal "\033[0 q"))))
)
(use-package which-key
:diminish
:init
(setq which-key-allow-evil-operators t)
(setq which-key-show-operator-state-maps t)
:config
(which-key-mode 1)
(which-key-setup-minibuffer)) ; do I need this?
#+END_SRC
#+RESULTS:
@ -437,9 +449,11 @@ from [[https://www.emacswiki.org/emacs/BackupDirectory][emacs wiki]]
*** evil-goggles
#+BEGIN_SRC emacs-lisp
(use-package evil-goggles
:diminish
:config (evil-goggles-mode)
(evil-goggles-use-diff-faces))
:diminish
:after evil
:config
(evil-goggles-mode)
(evil-goggles-use-diff-faces))
#+END_SRC
*** TODO [[https://github.com/emacs-evil/evil-surround][evil-surround]]
*** TODO more evil bindings
@ -448,7 +462,8 @@ from [[https://www.emacswiki.org/emacs/BackupDirectory][emacs wiki]]
** TODO multiple-cursors
** crdt
#+BEGIN_SRC emacs-lisp
(use-package crdt)
(use-package crdt
:commands (crdt-connect))
#+END_SRC
#+RESULTS:
@ -527,15 +542,21 @@ from [[https://www.emacswiki.org/emacs/BackupDirectory][emacs wiki]]
#+END_SRC
** lsp
#+BEGIN_SRC emacs-lisp
(use-package lsp-mode
:init
(setq lsp-keymap-prefix "C-c s")
:hook (lsp-mode . lsp-enable-which-key-integration)
:commands (lsp lsp-deferred))
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol)
(use-package lsp-ui :commands lsp-ui-mode)
(use-package lsp-mode
:init
(setq lsp-keymap-prefix "C-c s")
:hook
(lsp-mode . lsp-enable-which-key-integration)
:commands
(lsp lsp-deferred))
(use-package lsp-ivy
:commands lsp-ivy-workspace-symbol
:after lsp)
(use-package lsp-ui
:commands lsp-ui-mode
:after lsp)
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024 3)) ;; 3mb
(setq read-process-output-max (* 1024 1024 3)) ;; 3mb
#+END_SRC
#+RESULTS:

4
emacs/init.el Normal file
View file

@ -0,0 +1,4 @@
;; installed by home-manager
(setq org-modules '(org-bbdb org-bibtex org-docview org-gnus org-habit
org-info org-irc org-mhe org-rmail org-w3m))
(org-babel-load-file "~/dotfiles/emacs/emacs.org")

View file

@ -129,6 +129,9 @@ in {
extraConfig.pull.ff = "only";
extraConfig."includeIf \"gitdir:~/serokell/\"".path =
"~/serokell/.gitconfig";
# ignores = [
# "*.~undo-tree~"
# ];
aliases = {
lg =
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative";
@ -255,9 +258,9 @@ in {
'';
};
};
home.file.".emacs.d/init.el" = {
source = (toString /home/yorick/dotfiles/emacs/.emacs.d/init.el);
};
# todo: precompile?
home.file.".emacs.d/init.el".source = (toString /home/yorick/dotfiles/emacs/init.el);
home.file.".emacs.d/early-init.el".source = (toString /home/yorick/dotfiles/emacs/early-init.el);
xdg.configFile."nixpkgs/config.nix".text = ''
import "${toString ../config.nix}"
'';