2022-12-01 09:02:21 +01:00
|
|
|
;;; -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;;; BEGIN OPTIMIZATION
|
|
|
|
|
|
|
|
;; Optimizations (mostly taken from doom)
|
|
|
|
(defvar init-done-hook nil)
|
|
|
|
|
|
|
|
;; Don't garbage collect during init
|
|
|
|
(add-hook 'init-done-hook
|
|
|
|
`(lambda () (setq gc-cons-threshold
|
|
|
|
,(default-toplevel-value 'gc-cons-threshold))))
|
|
|
|
(setq gc-cons-threshold most-positive-fixnum)
|
|
|
|
|
|
|
|
;; Don't use file type handlers during init
|
|
|
|
(let ((old-value (default-toplevel-value 'file-name-handler-alist)))
|
|
|
|
(setq file-name-handler-alist nil)
|
|
|
|
(set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist)
|
|
|
|
(put 'file-name-handler-alist 'initial-value old-value)
|
|
|
|
(add-hook 'init-done-hook
|
|
|
|
(lambda ()
|
|
|
|
(setq file-name-handler-alist
|
|
|
|
;; Merge instead of overwrite because there may have been changes to
|
|
|
|
;; `file-name-handler-alist' since startup we want to preserve.
|
|
|
|
(delete-dups (append file-name-handler-alist old-value))))))
|
|
|
|
|
|
|
|
;; Don't resize during init
|
|
|
|
(setq frame-inhibit-implied-resize t)
|
|
|
|
(setq inhibit-startup-screen t
|
|
|
|
inhibit-startup-echo-area-message user-login-name)
|
|
|
|
(advice-add #'display-startup-echo-area-message :override #'ignore)
|
|
|
|
(advice-add #'display-startup-screen :override #'ignore)
|
|
|
|
|
|
|
|
;; Don't use advanced modes for scratch buffer
|
|
|
|
(setq initial-major-mode 'fundamental-mode
|
|
|
|
initial-scratch-message nil)
|
|
|
|
|
|
|
|
;; Don't cause rewrites when loading file
|
|
|
|
(define-advice load-file (:override (file) silence) (load file nil 'nomessage))
|
|
|
|
(define-advice startup--load-user-init-file (:before (&rest _) undo-silence)
|
|
|
|
(advice-remove #'load-file #'load-file@silence))
|
|
|
|
|
|
|
|
;; Disable modeline
|
|
|
|
(put 'mode-line-format 'initial-value (default-toplevel-value 'mode-line-format))
|
|
|
|
(setq-default mode-line-format nil)
|
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
(with-current-buffer buf (setq mode-line-format nil)))
|
|
|
|
|
|
|
|
;; Inhibit redraws
|
|
|
|
(setq-default inhibit-redisplay t
|
|
|
|
inhibit-message t)
|
|
|
|
(defun reset-inhibited-vars-h ()
|
|
|
|
(setq-default inhibit-redisplay nil
|
|
|
|
;; Inhibiting `message' only prevents redraws and
|
|
|
|
inhibit-message nil)
|
|
|
|
(redraw-frame))
|
|
|
|
(add-hook 'after-init-hook #'reset-inhibited-vars-h)
|
|
|
|
|
|
|
|
(define-advice startup--load-user-init-file (:after (&rest _) undo-inhibit-vars)
|
|
|
|
(when init-file-had-error
|
|
|
|
(reset-inhibited-vars-h))
|
|
|
|
(unless (default-toplevel-value 'mode-line-format)
|
|
|
|
(setq-default mode-line-format (get 'mode-line-format 'initial-value))))
|
|
|
|
|
|
|
|
;; Don't load toolbar
|
|
|
|
(advice-add #'tool-bar-setup :override #'ignore)
|
|
|
|
(define-advice startup--load-user-init-file (:before (&rest _) defer-tool-bar-setup)
|
|
|
|
(advice-remove #'tool-bar-setup #'ignore)
|
|
|
|
(add-transient-hook! 'tool-bar-mode (tool-bar-setup)))
|
|
|
|
|
|
|
|
;; Don't bother with MACOS exclusive options
|
|
|
|
(setq command-line-ns-option-alist nil)
|
|
|
|
|
|
|
|
;;; END OPTIMIZATION
|
|
|
|
|
2022-11-20 16:56:34 +01:00
|
|
|
;; File inclusion
|
2023-07-25 11:16:50 +02:00
|
|
|
(defun path (f) (concat (file-name-as-directory (getenv "HOME")) (file-name-as-directory ".emacs.d") f))
|
2022-11-20 16:56:34 +01:00
|
|
|
(defmacro include (f) (load (path f)))
|
|
|
|
|
|
|
|
;; Keybinds
|
|
|
|
(include "binds.el")
|
|
|
|
|
|
|
|
;; Style (theme, etc)
|
|
|
|
(include "style.el")
|
|
|
|
|
|
|
|
;; Zotero
|
2022-11-21 18:33:55 +01:00
|
|
|
(include "packages.el")
|
2022-11-20 16:56:34 +01:00
|
|
|
|
|
|
|
;; Secrets
|
|
|
|
(include "secrets.el")
|
|
|
|
|
|
|
|
;; Behaviour
|
|
|
|
(include "behaviour.el")
|
|
|
|
|
2022-11-25 01:20:50 +01:00
|
|
|
;; Emacs server
|
|
|
|
(server-start)
|
|
|
|
|
2022-11-20 16:56:34 +01:00
|
|
|
(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.
|
2023-02-05 17:07:29 +01:00
|
|
|
'(TeX-command-list
|
|
|
|
'(("latexmk" "latexmk -pdf %t" TeX-run-TeX nil t)
|
|
|
|
("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %(output-dir) %t" TeX-run-TeX nil
|
|
|
|
(plain-tex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run plain TeX")
|
|
|
|
("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil
|
|
|
|
(latex-mode doctex-mode)
|
|
|
|
:help "Run LaTeX")
|
|
|
|
("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil
|
|
|
|
(texinfo-mode)
|
|
|
|
:help "Run Makeinfo with Info output")
|
|
|
|
("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t" TeX-run-compile nil
|
|
|
|
(texinfo-mode)
|
|
|
|
:help "Run Makeinfo with HTML output")
|
|
|
|
("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %t" TeX-run-TeX nil
|
|
|
|
(ams-tex-mode)
|
|
|
|
:help "Run AMSTeX")
|
|
|
|
("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" TeX-run-TeX nil
|
|
|
|
(context-mode)
|
|
|
|
:help "Run ConTeXt once")
|
|
|
|
("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil
|
|
|
|
(context-mode)
|
|
|
|
:help "Run ConTeXt until completion")
|
|
|
|
("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode context-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run BibTeX")
|
|
|
|
("Biber" "biber %(output-dir) %s" TeX-run-Biber nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run Biber")
|
|
|
|
("Texindex" "texindex %s.??" TeX-run-command nil
|
|
|
|
(texinfo-mode)
|
|
|
|
:help "Run Texindex")
|
|
|
|
("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil
|
|
|
|
(texinfo-mode)
|
|
|
|
:help "Run Texi2dvi or Texi2pdf")
|
|
|
|
("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer")
|
|
|
|
("Print" "%p" TeX-run-command t t :help "Print the file")
|
|
|
|
("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command)
|
|
|
|
("File" "%(o?)dvips %d -o %f " TeX-run-dvips t
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Generate PostScript file")
|
|
|
|
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Convert DVI file to PostScript")
|
|
|
|
("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Convert DVI file to PDF with dvipdfmx")
|
|
|
|
("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Convert PostScript file to PDF")
|
|
|
|
("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run makeglossaries to create glossary file")
|
|
|
|
("Index" "makeindex %(O?idx)" TeX-run-index nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run makeindex to create index file")
|
|
|
|
("upMendex" "upmendex %(O?idx)" TeX-run-index t
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run upmendex to create index file")
|
|
|
|
("Xindy" "texindy %s" TeX-run-command nil
|
|
|
|
(plain-tex-mode latex-mode doctex-mode texinfo-mode ams-tex-mode)
|
|
|
|
:help "Run xindy to create index file")
|
|
|
|
("Check" "lacheck %s" TeX-run-compile nil
|
|
|
|
(latex-mode)
|
|
|
|
:help "Check LaTeX file for correctness")
|
|
|
|
("ChkTeX" "chktex -v6 %s" TeX-run-compile nil
|
|
|
|
(latex-mode)
|
|
|
|
:help "Check LaTeX file for common mistakes")
|
|
|
|
("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document")
|
|
|
|
("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files")
|
|
|
|
("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files")
|
|
|
|
("Other" "" TeX-run-command t t :help "Run an arbitrary command")))
|
|
|
|
'(TeX-view-program-selection
|
|
|
|
'((output-pdf "PDF Tools")
|
|
|
|
((output-dvi has-no-display-manager)
|
|
|
|
"dvi2tty")
|
|
|
|
((output-dvi style-pstricks)
|
|
|
|
"dvips and gv")
|
|
|
|
(output-dvi "xdvi")
|
|
|
|
(output-pdf "Evince")
|
2023-07-25 11:16:50 +02:00
|
|
|
(output-html "xdg-open")) t)
|
|
|
|
'(auth-source-save-behavior nil)
|
|
|
|
'(chess-display-popup nil)
|
|
|
|
'(dired-listing-switches "-alh")
|
2022-12-01 09:02:21 +01:00
|
|
|
'(display-time-24hr-format t)
|
|
|
|
'(display-time-default-load-average nil)
|
|
|
|
'(display-time-interval 15)
|
|
|
|
'(display-time-mode t)
|
2022-11-20 16:56:34 +01:00
|
|
|
'(evil-undo-system 'undo-tree)
|
2023-02-05 17:07:29 +01:00
|
|
|
'(haskell-emacs-build-tool 'stack)
|
2023-02-28 15:41:35 +01:00
|
|
|
'(haskell-interactive-popup-errors nil)
|
|
|
|
'(haskell-process-args-ghci '("-ignore-dot-ghci" "-ferror-spans"))
|
|
|
|
'(haskell-process-show-debug-tips nil)
|
2022-12-02 01:22:04 +01:00
|
|
|
'(image-converter 'imagemagick)
|
|
|
|
'(image-file-name-extensions
|
|
|
|
'("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm" "pnm" "svg" "ora"))
|
|
|
|
'(image-use-external-converter t)
|
|
|
|
'(imagemagick-enabled-types
|
|
|
|
'(3FR ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW CUR CUT DCM DCR DCX DDS DJVU DNG DPX EXR FAX FITS GBR GIF GIF87 GRB HRZ ICB ICO ICON J2C JNG JP2 JPC JPEG JPG JPX K25 KDC MIFF MNG MRW MSL MSVG MTV NEF ORF OTB PBM PCD PCDS PCL PCT PCX PDB PEF PGM PICT PIX PJPEG PNG PNG24 PNG32 PNG8 PNM PPM PSD PTIF PWP RAF RAS RBG RGB RGBA RGBO RLA RLE SCR SCT SFW SGI SR2 SRF SUN SVG SVGZ TGA TIFF TIFF64 TILE TIM TTF UYVY VDA VICAR VID VIFF VST WBMP WPG X3F XBM XC XCF XPM XV XWD YCbCr YCbCrA YUV ORA))
|
2023-07-25 11:16:50 +02:00
|
|
|
'(org-agenda-files nil)
|
2023-02-28 15:41:35 +01:00
|
|
|
'(org-preview-latex-default-process 'imagemagick)
|
|
|
|
'(org-startup-with-latex-preview t)
|
2022-12-02 01:22:04 +01:00
|
|
|
'(shell-file-name "/bin/bash")
|
2023-01-10 19:29:35 +01:00
|
|
|
'(treemacs-collapse-dirs 3)
|
|
|
|
'(treemacs-filewatch-mode t)
|
|
|
|
'(treemacs-follow-mode t)
|
|
|
|
'(treemacs-fringe-indicator-mode t)
|
|
|
|
'(treemacs-git-mode t)
|
|
|
|
'(treemacs-no-delete-other-windows nil)
|
|
|
|
'(treemacs-select-when-already-in-treemacs 'next-or-back)
|
2022-11-20 16:56:34 +01:00
|
|
|
'(warning-suppress-log-types '((comp)))
|
|
|
|
'(warning-suppress-types '((comp)))
|
2023-02-05 17:07:29 +01:00
|
|
|
'(writeroom-global-effects
|
|
|
|
'(writeroom-set-alpha writeroom-set-menu-bar-lines writeroom-set-tool-bar-lines writeroom-set-vertical-scroll-bars writeroom-set-bottom-divider-width))
|
2023-02-28 15:41:35 +01:00
|
|
|
'(writeroom-maximize-window nil)
|
2022-11-21 18:33:55 +01:00
|
|
|
'(writeroom-mode-line t)
|
2023-07-25 11:16:50 +02:00
|
|
|
'(writeroom-width 100))
|
2022-11-20 16:56:34 +01:00
|
|
|
(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.
|
2022-11-22 23:49:42 +01:00
|
|
|
'(bookmark-face ((t (:foreground "#fdf6e3"))))
|
2022-11-20 16:56:34 +01:00
|
|
|
'(mode-line ((t (:underline nil :overline nil))))
|
|
|
|
'(mode-line-inactive ((t (:underline nil :overline nil)))))
|
2022-12-01 09:02:21 +01:00
|
|
|
|
|
|
|
;; Reset values
|
|
|
|
(run-hooks 'init-done-hook)
|
2023-01-10 19:29:35 +01:00
|
|
|
|
|
|
|
;; Performance post-init
|
2023-02-05 17:07:29 +01:00
|
|
|
(setq gc-cons-threshold (* 512 1024))
|
2023-01-10 19:29:35 +01:00
|
|
|
(run-with-idle-timer 1 t 'garbage-collect)
|