From f051150ac58685ab349d8deb318344ac1a9b8951 Mon Sep 17 00:00:00 2001 From: willemml Date: Sun, 22 Jan 2023 10:39:16 -0800 Subject: [PATCH] remove blank lines in emacs use-package defs --- emacs.nix | 73 +------------------------------------------------------ 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/emacs.nix b/emacs.nix index adbdb95..982e5a6 100644 --- a/emacs.nix +++ b/emacs.nix @@ -11,7 +11,6 @@ in { packageQuickstart = false; recommendedGcSettings = true; usePackageVerbose = false; - earlyInit = '' ; -*-emacs-lisp-*- ;; Disable Toolbar @@ -20,74 +19,57 @@ in { (scroll-bar-mode -1) ;; Disable menubar (menu-bar-mode -1) - ;; Increase garbage collector threshold before load (setq gc-cons-threshold 640000000) - (setq debug-on-error t) - ;; Use UTF-8 (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (prefer-coding-system 'utf-8) - ;; Minimize native-comp warnings (setq native-comp-async-report-warnings-errors nil) (setq warning-minimum-level 'error) ''; + prelude = '' ; -*-emacs-lisp-*- ;; Disable startup message. (setq inhibit-startup-screen t inhibit-startup-echo-area-message (user-login-name)) - (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("melpa-stable" . "https://stable.melpa.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/") ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) - ;; Empty initial scratch buffer. (setq initial-major-mode 'fundamental-mode initial-scratch-message nil) - (setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH"))) - ;; Accept 'y' and 'n' rather than 'yes' and 'no'. (defalias 'yes-or-no-p 'y-or-n-p) - ;; Typically, I only want spaces when pressing the TAB key. I also ;; want 4 of them. (setq-default indent-tabs-mode nil tab-width 4 c-basic-offset 4) - ;; Increase emacs data read limit (default too low for LSP) (setq read-process-output-max (* 1024 1024)) - ;; Reduce wrist pain (global-set-key (kbd "M-n") "~") (global-set-key (kbd "M-N") "`") - ;; Stop creating backup and autosave files. (setq make-backup-files nil auto-save-default nil) - ;; Always show line and column number in the mode line. (line-number-mode) (column-number-mode) - ;; Soft wrap lines (visual-line-mode) - ;; Use one space to end sentences. (setq sentence-end-double-space nil) - ;; I typically want to use UTF-8. (prefer-coding-system 'utf-8) - ;; Enable highlighting of current line. (global-hl-line-mode 1) - ;; When finding file in non-existing directory, offer to create the ;; parent directory. (defun with-buffer-name-prompt-and-make-subdirs () @@ -95,41 +77,32 @@ in { (when (and (not (file-exists-p parent-directory)) (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) (make-directory parent-directory t)))) - (add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) - ;; Bind Emacs built in completion using completion-at-point to "C-M-i" (global-set-key (kbd "C-M-i") 'completion-at-point) - ;; Keybind to format/prettify document, uses either format-all or ;; lsp-mode depending on availability (global-set-key (kbd "C-c C-y") 'my/format-document) - ;; Don't warn when cannot guess python indent level (setq-default python-indent-guess-indent-offset-verbose nil) - (defun my/define-multiple-keys (map keys) "Define multiple KEYS in a keymap. Argument MAP keymap in which to bind the keys." (dolist (key keys nil) (define-key map (kbd (car key)) (nth 1 key)))) - (defun my/customize-set-variables (variables) "Set multiple Customize VARIABLES at once." (dolist (variable variables nil) (customize-set-variable (car variable) (nth 1 variable)))) - (defun my/find-file-in-folder-shortcut (folder) "Interactively call `find-file' after using 'cd' into 'FOLDER'." (cd (expand-file-name folder)) (call-interactively #'find-file)) - (defun my/electric-mode () "Enable some basic features for coding." (interactive) (electric-pair-local-mode) (electric-indent-local-mode)) - (defun dev () "Shortcut to '~/dev' folder." (interactive) @@ -204,11 +177,9 @@ in { init = '' ;; Align company-mode tooltips to the right hand side (setq company-tooltip-align-annotations t) - ;; Display number of completions before and after current suggestions ;; in company-mode (setq company-tooltip-offset-display 'lines) - ;; Display text icon of type in company popup (setq company-format-margin-function #'company-text-icons-margin) ''; @@ -292,7 +263,6 @@ in { "(javascript-mode . lsp)" ]; bind = { "C-c C-y" = "my/format-document"; }; - extraPackages = [ pkgs.nodePackages.bash-language-server ]; }; @@ -354,7 +324,6 @@ in { (setq nix-executable "/nix/var/nix/profiles/default/bin/nix") ''; bindLocal.nix-mode-map = { "C-c C-y" = "nix-format-buffer"; }; - extraPackages = [ pkgs.nixfmt ]; }; @@ -372,7 +341,6 @@ in { (org-edit-special) (indent-region (point-min) (point-max)) (org-edit-src-exit))) - (defun my/org-force-open-current-window () "Open a link using 'org-open-at-point' in current window." (interactive) @@ -385,7 +353,6 @@ in { (wl . wl))) )) (org-open-at-point))) - (defun my/follow-org-link (arg) "Follow a link in orgmode If ARG is given. Opens in new window otherwise opens in current window." @@ -397,65 +364,49 @@ in { init = '' ; -*-emacs-lisp-*- (defvar my/org-dir "~/Documents/org/") - (require 'oc) (require 'oc-basic) (require 'oc-csl) (require 'oc-natbib) (require 'ox-latex) - (setq org-src-window-setup 'current-window) (setq org-confirm-babel-evaluate nil) (setq org-src-fontify-natively t) (setq org-src-tab-acts-natively t) (setq org-src-preserve-indentation t) - (setq org-export-with-tags nil) - (setq org-publish-project-alist '(("root" :base-directory (expand-file-name my/org-dir) :publishing-function org-html-publish-to-html :publishing-directory (expand-file-name "~/public_html") :section-numbers nil - :with-author nil :with-creator t :with-toc t :time-stamp-file nil))) - ;; Configure HTML export (setq org-html-validation-link nil) (setq org-html-head-include-scripts nil) (setq org-html-head-include-default-style nil) (setq org-html-head "") (setq org-html-section) - (setq bibtex-completion-notes-path (expand-file-name "notes.org" my/org-dir)) - (setq org-cite-global-bibliography '("~/Documents/org/zotero.bib")) - (setq org-cite-export-processors '((t basic))) - (setq org-cite-follow-processor 'ivy-bibtex-org-cite-follow) - (setq org-cite-csl-styles-dir "~/Zotero/styles") - (setq bibtex-completion-pdf-open-function (lambda (fpath) (call-process "open" nil 0 nil "-a" "/Applications/Preview.app" fpath))) - (defun org-export-latex-no-toc (depth) (when depth (format "%% Org-mode is exporting headings to %s levels.\n" depth))) (setq org-export-latex-format-toc-function 'org-export-latex-no-toc) - (setq org-latex-pdf-process '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f")) - (add-to-list 'exec-path "/Users/willem/.nix-profile/bin") - (add-to-list 'org-latex-classes '("apa6" "\\documentclass{apa6}" @@ -464,7 +415,6 @@ in { ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) - (add-to-list 'org-latex-classes '("mla" "\\documentclass{mla}" @@ -473,14 +423,12 @@ in { ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) - (setq org-agenda-files '("~/Documents/org" "~/Documents/org/ubc")) ''; hook = [ "(org-babel-after-execute . org-redisplay-inline-images)" "(org-mode . visual-line-mode)" ]; - bind = { "C-c n c" = "org-id-get-create"; "C-c n a" = "org-agenda"; @@ -490,7 +438,6 @@ in { "C-c C-y" = "my/indent-org-block-automatically"; "" = "my/follow-org-link"; }; - extraPackages = [ pkgs.texlive.combined.scheme-full ]; }; @@ -500,14 +447,11 @@ in { enable = true; init = '' (require 'gnuplot) - (autoload 'gnuplot-mode "gnuplot" "Gnuplot major mode" t) (autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot-mode" t) (setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist)) - (require 'gnuplot-context) ''; - extraPackages = [ pkgs.gnuplot ]; }; @@ -558,14 +502,11 @@ in { ob-matlab = { enable = true; after = [ "org" ]; - init = '' ; -*-emacs-lisp-*- - (setq org-babel-octave-shell-command "${pkgs.octave}/bin/octave -q") (setq org-babel-matlab-shell-command "~/Applications/MATLAB_R2022b.app/bin/matlab -nosplash") ''; - extraPackages = [ pkgs.octave pkgs.texinfo4 ]; }; @@ -604,9 +545,7 @@ in { company-math = { enable = true; - after = [ "company" ]; - init = '' ; -*-emacs-lisp-*- (add-to-list 'company-backends 'company-math-symbols-unicode) @@ -644,7 +583,6 @@ in { (setq ivy-re-builders-alist '((ivy-bibtex . ivy--regex-ignore-order) (t . ivy--regex-plus))) - (setq ivy-bibtex-bibliography '("~/Documents/org/zotero.bib")) (setq reftex-default-bibliography '("~/Documents/org/zotero.bib")) (setq bibtex-completion-pdf-field "file") @@ -653,21 +591,16 @@ in { org-ref = { enable = true; - init = '' ; -*-emacs-lisp-*- (setq org-ref-insert-cite-function (lambda () (org-cite-insert nil))) - (setq org-ref-default-bibliography "~/Documents/org/zotero.bib") - (setq bibtex-completion-bibliography '("~/Documents/org/zotero.bib")) - (require 'org-ref) (require 'org-ref-ivy) ''; - bindLocal.org-mode-map = { "C-c ]" = "org-ref-insert-link"; }; }; @@ -675,14 +608,11 @@ in { pdf-tools = { enable = true; - init = '' ; -*-emacs-lisp-*- (setq-default pdf-view-display-size 'fit-width) - (setq pdf-annot-activate-created-annotations t) ''; - extraPackages = [ pkgs.poppler pkgs.automake ]; }; @@ -800,7 +730,6 @@ in { '("z" . meow-pop-selection) '("'" . repeat) '("" . ignore))) - (meow-setup) ''; };