;; -*- lexical-binding: t; -*- (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (setq package-install-upgrade-built-in t) (package-initialize) ;(package-refresh-contents) ;; Avoid long startup times, I think this is handled by Nix anyway? (use-package transient :ensure t) ;; Global settings (desktop-save-mode 1) ;; Remember window layouts and open buffers (electric-pair-mode 1) ;; Automatic bracket matching (global-auto-revert-mode t) ;; Automatically refresh buffers when changes on disk (global-display-line-numbers-mode 1) (save-place-mode 1) ;; Remember cursor/scroll position (setq-default indent-tabs-mode nil) ;; Isolate backup and auto-save files (setq backup-directory-alist `(("." . ,(expand-file-name "backups" user-emacs-directory)))) (setq auto-save-file-name-transforms `((".*" ,(expand-file-name "auto-saves/" user-emacs-directory) t))) (setq create-lockfiles nil) ;; Disables .#filename lockfiles ;; External modules (add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) (load (expand-file-name "modules/my-org.el" user-emacs-directory)) ;; Search and navigation (use-package vertico ;; https://github.com/minad/vertico :ensure t ;:custom ;(vertico-scroll-margin 0) ;; Different scroll margin ;(vertico-count 20) ;; Show more candidates ;(vertico-resize t) ;; Grow and shrink the Vertico minibuffer ;(vertico-cycle t) ;; Enable cycling for `vertico-next/previous' :init (vertico-mode) ) (use-package savehist :init (savehist-mode) ) (use-package saveplace-pdf-view :ensure t :after (:any doc-view pdf-tools) :demand t) (use-package orderless :ensure t :custom ;; Configure a custom style dispatcher (see the Consult wiki) ;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)) ;; (orderless-component-separator #'orderless-escapable-split-on-space) (completion-styles '(orderless basic)) (completion-category-overrides '((file (styles partial-completion)))) (completion-category-defaults nil) ;; Disable defaults, use our settings (completion-pcm-leading-wildcard t) ;; Emacs 31: partial-completion behaves like substring ) (use-package marginalia :ensure t :init (marginalia-mode) ) (use-package emacs :custom ;; Enable context menu. `vertico-multiform-mode' adds a menu in the minibuffer ;; to switch display modes. (context-menu-mode t) ;; Support opening new minibuffers from inside existing minibuffers. (enable-recursive-minibuffers t) ;; Hide commands in M-x which do not work in the current mode. Vertico ;; commands are hidden in normal buffers. This setting is useful beyond ;; Vertico. (read-extended-command-predicate #'command-completion-default-include-p) ;; Do not allow the cursor in the minibuffer prompt (minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt))) (use-package consult ;; https://github.com/minad/consult :ensure t :bind (("C-x b" . consult-buffer) ;; Fuzzy find open buffers, recents, & bookmarks ("M-y" . consult-yank-pop) ;; Better paste history ("M-s r" . consult-ripgrep) ;; Search text INSIDE all your files ("M-g g" . consult-goto-line))) ;; Interaction & tools (use-package evil :ensure t :init (setq evil-shift-width 2) :config (evil-mode 1) (with-eval-after-load 'evil-maps (define-key evil-motion-state-map (kbd "TAB") nil)) ) (use-package pdf-tools ;; https://github.com/vedang/pdf-tools :ensure t :custom (pdf-util-convert-program "magick") ;; "The pdf-util-convert-program is unset or non-executable" (pdf-view-incompatible-modes nil) ;; Silences the annoying warning popup :init (add-hook 'pdf-view-mode-hook (lambda () (display-line-numbers-mode -1))) (add-hook 'pdf-view-mode-hook (lambda () (blink-cursor-mode -1))) :config (pdf-loader-install) ) ;; Theming (use-package olivetti :ensure t ) ;; Activate with M-x olivetti-mode (use-package auto-dark :ensure t :custom (auto-dark-themes '((modus-vivendi) (modus-operandi))) :hook (auto-dark-dark-mode . (lambda () (pdf-view-midnight-minor-mode 1) )) (auto-dark-light-mode . (lambda () ;; something to execute when light mode is detected (pdf-view-midnight-minor-mode -1) )) :init (auto-dark-mode) ) (defvar my/pre-zen-menu-bar nil "Store menu bar state before zen mode.") (defvar my/pre-zen-tool-bar nil "Store tool bar state before zen mode.") (defvar my/pre-zen-scroll-bar nil "Store scroll bar state before zen mode.") (defvar my/pre-zen-line-numbers nil "Stores line number state before zen mode.") (define-minor-mode my/zen-mode "A complete full-screen, distraction-free environment." :init-value nil :global t (if my/zen-mode (progn ;; ON (setq my/pre-zen-menu-bar (bound-and-true-p menu-bar-mode)) (setq my/pre-zen-tool-bar (bound-and-true-p tool-bar-mode)) (setq my/pre-zen-scroll-bar (bound-and-true-p scroll-bar-mode)) (setq my/pre-zen-line-numbers (bound-and-true-p global-display-line-numbers-mode)) (olivetti-mode 1) (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) (display-line-numbers-mode -1) (set-frame-parameter nil 'fullscreen 'maximized)) (progn ;; OFF (olivetti-mode -1) (menu-bar-mode (if my/pre-zen-menu-bar 1 -1)) (tool-bar-mode (if my/pre-zen-tool-bar 1 -1)) (scroll-bar-mode (if my/pre-zen-scroll-bar 1 -1)) (display-line-numbers-mode (if my/pre-zen-line-numbers 1 -1)) (set-frame-parameter nil 'fullscreen nil)) )) (define-minor-mode my/presentation-mode "A clean, scaled-up environment." :init-value nil :global t (if my/presentation-mode (progn ;; ON (my/zen-mode 1) ;; Inherit zen mode (face-remap-set-base 'default :height 180)) ;; Scale font to 18pt (progn ;; OFF (my/zen-mode -1) (face-remap-set-base 'default)) )) (global-set-key (kbd "") 'my/zen-mode) (global-set-key (kbd "") 'my/presentation-mode) ;; TODO Put exports in their own directory? (now filename-prefix.pdf) ;; TODO I store my lecture PDFs in ~/Nextcloud/Documents/UGent//theory/*.pdf, is there some way to make a shortcut for this (related to Fuzzy finding files etc.). Maybe consider integrating with Zotero and storing PDFs there? ;; Additional package to explore ;; TODO https://magit.vc/ <-> Nextcloud WebDAV? What about mobile? FolderSync seems unreliable (currently using for LogSeq, often reports failures without actually being recently modified files.) I have my own Git server, but what about keys - I don't really like just making new keysets for this..? ;; TODO I was thinking of syncing (1-way) Org TO-DO's to CalDav (Nextcloud), new calendar, so I can quickly see them in my tasklist. (https://github.com/dengste/org-caldav) ;; Turn on Auto Fill mode automatically in Text mode and related modes (see Hooks). ;; TODO (add-hook 'text-mode-hook 'auto-fill-mode) ;; Do I want this? ;; TODO Finally, compare experience to organice https://organice.200ok.ch/ ;; TODO org-compile-file: File "/tmp/nix-shell.UEk6Ye/orgtexcJso3E.dvi" wasn’t produced Please adjust ‘dvipng’ part of ‘org-preview-latex-process-alist’.