mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-12 11:17:17 +00:00
Removes emacs
This commit is contained in:
parent
10543ff882
commit
6397a8bef3
14 changed files with 3 additions and 795 deletions
|
@ -19,7 +19,6 @@
|
|||
home.file.".gnupg/gpg-agent.conf" = {
|
||||
text = ''
|
||||
pinentry-program "${pkgs.pinentry.out}/bin/pinentry"
|
||||
allow-emacs-pinentry
|
||||
default-cache-ttl 30
|
||||
max-cache-ttl 600
|
||||
'';
|
||||
|
|
|
@ -8,22 +8,5 @@
|
|||
in {
|
||||
launchd = {
|
||||
enable = true;
|
||||
|
||||
agents.emacs = {
|
||||
enable = true;
|
||||
config = {
|
||||
EnvironmentVariables = {
|
||||
TERMINFO_DIRS = "${config.home.homeDirectory}/.nix-profile/share/terminfo:/run/current-system/sw/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/usr/share/terminfo";
|
||||
};
|
||||
ProgramArguments = [
|
||||
"${config.programs.emacs.finalPackage}/bin/emacs"
|
||||
"--fg-daemon"
|
||||
];
|
||||
KeepAlive = true;
|
||||
ProcessType = "Interactive";
|
||||
StandardOutPath = logFile "emacs";
|
||||
StandardErrorPath = logFile "emacs";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
emacsCommand = "${config.programs.emacs.finalPackage}/bin/emacsclient -nw";
|
||||
in rec {
|
||||
}: {
|
||||
imports = [
|
||||
./modules/emacs.nix
|
||||
./packages.nix
|
||||
./programs/default.nix
|
||||
./modules/nix/pkgs-config.nix
|
||||
|
@ -32,10 +29,8 @@ in rec {
|
|||
|
||||
sessionVariables = rec {
|
||||
DOTDIR = "${config.home.homeDirectory}/.config/dotfiles.nix";
|
||||
EDITOR = emacsCommand;
|
||||
VISUAL = emacsCommand;
|
||||
ORGDIR = "${config.home.homeDirectory}/Documents/org";
|
||||
UBCDIR = "${ORGDIR}/ubc";
|
||||
EDITOR = "hx";
|
||||
VISUAL = "hx";
|
||||
MAILDIR = "${config.home.homeDirectory}/Maildir";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -20,6 +20,4 @@
|
|||
];
|
||||
|
||||
home.homeDirectory = "/home/willem";
|
||||
|
||||
programs.emacs.enableOrgTex = false;
|
||||
}
|
||||
|
|
|
@ -14,19 +14,6 @@
|
|||
defaultCacheTtl = 30;
|
||||
maxCacheTtl = 600;
|
||||
pinentryFlavor = "curses";
|
||||
extraConfig = ''
|
||||
allow-emacs-pinentry
|
||||
'';
|
||||
};
|
||||
|
||||
emacs = {
|
||||
enable = true;
|
||||
package =
|
||||
if config.programs.emacs.enable
|
||||
then config.programs.emacs.finalPackage
|
||||
else pkgs.emacs;
|
||||
client.enable = true;
|
||||
startWithUserSession = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.types) path str anything either package listOf;
|
||||
inherit (lib) mkIf mkEnableOption mkOption;
|
||||
cfg = config.programs.emacs;
|
||||
configFileOption = mkOption {
|
||||
type = either path str;
|
||||
default = "";
|
||||
};
|
||||
fileFromPathOrText = input:
|
||||
if (builtins.typeOf input) == "path"
|
||||
then {
|
||||
source = input;
|
||||
}
|
||||
else {
|
||||
text = input;
|
||||
};
|
||||
in {
|
||||
options.programs.emacs = {
|
||||
enableOrgTex = mkEnableOption "Enable Emacs Org and LaTeX configuration";
|
||||
texPackages = mkOption {
|
||||
type = listOf package;
|
||||
default = [];
|
||||
};
|
||||
texEmacsPackages = lib.mkOption {
|
||||
type = anything;
|
||||
default = epkgs: [];
|
||||
};
|
||||
orgTexConfigFile = configFileOption;
|
||||
initFile = configFileOption;
|
||||
earlyInitFile = configFileOption;
|
||||
};
|
||||
|
||||
config = {
|
||||
home.packages = mkIf cfg.enableOrgTex cfg.texPackages;
|
||||
|
||||
programs.emacs.extraPackages = mkIf cfg.enableOrgTex cfg.texEmacsPackages;
|
||||
|
||||
home.file.".emacs.d/nix-extraconfig.el".text = cfg.extraConfig;
|
||||
home.file.".emacs.d/org-tex-cfg.el" = mkIf cfg.enableOrgTex (fileFromPathOrText cfg.orgTexConfigFile);
|
||||
home.file.".emacs.d/early-init.el" = fileFromPathOrText cfg.earlyInitFile;
|
||||
home.file.".emacs.d/init.el" = fileFromPathOrText cfg.initFile;
|
||||
};
|
||||
}
|
|
@ -5,7 +5,6 @@
|
|||
...
|
||||
}: {
|
||||
imports = [
|
||||
./emacs
|
||||
./ssh.nix
|
||||
./vim.nix
|
||||
./zsh.nix
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.emacs = {
|
||||
earlyInitFile = ./early-init.el;
|
||||
initFile = ./init.el;
|
||||
|
||||
enable = true;
|
||||
|
||||
package = pkgs.emacs29-nox;
|
||||
|
||||
extraPackages = epkgs:
|
||||
(with epkgs; let
|
||||
company-mode = epkgs.trivialBuild rec {
|
||||
pname = "company-mode";
|
||||
version = "7c24dc8668af5aea8a5d07aeceda5fac7a2a85b5";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = pname;
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-6aX2S4cUop1rdxweIF5f1qrgNmYd1mtWgT9T1Q1s2h8=";
|
||||
};
|
||||
};
|
||||
in [
|
||||
all-the-icons
|
||||
all-the-icons-dired
|
||||
company-mode
|
||||
counsel
|
||||
dash
|
||||
editorconfig
|
||||
edit-indirect
|
||||
f
|
||||
flycheck
|
||||
format-all
|
||||
ivy
|
||||
magit
|
||||
magit-section
|
||||
meow
|
||||
nix-mode
|
||||
nix-update
|
||||
org
|
||||
org-modern
|
||||
pinentry
|
||||
polymode
|
||||
poly-org
|
||||
rustic
|
||||
s
|
||||
separedit
|
||||
swiper
|
||||
yasnippet
|
||||
])
|
||||
++ (with pkgs; [
|
||||
sqlite
|
||||
]);
|
||||
};
|
||||
|
||||
services.emacs = lib.mkIf pkgs.stdenv.isLinux {
|
||||
enable = true;
|
||||
client.enable = true;
|
||||
startWithUserSession = true;
|
||||
};
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
;;; early-init.el -- willemm's Emacs configuration (early-init).
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; The early-init part of my Emacs configuration.
|
||||
;; Originally generated by home-manager.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(defun hm/reduce-gc ()
|
||||
"Reduce the frequency of garbage collection."
|
||||
(setq gc-cons-threshold most-positive-fixnum
|
||||
gc-cons-percentage 0.6))
|
||||
|
||||
(defun hm/restore-gc ()
|
||||
"Restore the frequency of garbage collection."
|
||||
(setq gc-cons-threshold 16777216
|
||||
gc-cons-percentage 0.1))
|
||||
|
||||
;; Make GC more rare during init, while minibuffer is active, and
|
||||
;; when shutting down. In the latter two cases we try doing the
|
||||
;; reduction early in the hook.
|
||||
(hm/reduce-gc)
|
||||
(add-hook 'minibuffer-setup-hook #'hm/reduce-gc -50)
|
||||
(add-hook 'kill-emacs-hook #'hm/reduce-gc -50)
|
||||
|
||||
;; But make it more regular after startup and after closing minibuffer.
|
||||
(add-hook 'emacs-startup-hook #'hm/restore-gc)
|
||||
(add-hook 'minibuffer-exit-hook #'hm/restore-gc)
|
||||
|
||||
;; Avoid unnecessary regexp matching while loading .el files.
|
||||
(defvar hm/file-name-handler-alist file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
|
||||
(defun hm/restore-file-name-handler-alist ()
|
||||
"Restore the `file-name-handler-alist` variable."
|
||||
(setq file-name-handler-alist hm/file-name-handler-alist)
|
||||
(makunbound 'hm/file-name-handler-alist))
|
||||
|
||||
(add-hook 'emacs-startup-hook #'hm/restore-file-name-handler-alist)
|
||||
|
||||
;; Avoid expensive frame resizing. Inspired by Doom Emacs.
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
|
||||
;; Disable Toolbar
|
||||
(tool-bar-mode -1)
|
||||
|
||||
;; Disable scrollbar
|
||||
(scroll-bar-mode -1)
|
||||
|
||||
;; Disable menubar
|
||||
(menu-bar-mode -1)
|
||||
|
||||
(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
|
||||
(defvar native-comp-async-report-warnings-errors nil)
|
||||
(defvar warning-minimum-level 'error)
|
||||
|
||||
;; Disable startup message.
|
||||
(setq inhibit-startup-screen t
|
||||
inhibit-startup-echo-area-message (user-login-name))
|
||||
|
||||
;; Empty initial scratch buffer.
|
||||
(setq initial-major-mode 'emacs-lisp-mode
|
||||
initial-scratch-message nil)
|
||||
|
||||
(provide 'early-init)
|
||||
;;; early-init.el ends here
|
|
@ -1,279 +0,0 @@
|
|||
;;; init.el -- willemm's Emacs configuration.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; My Emacs configuration, uses nix-community's emacs-overlay for package installation.
|
||||
;; Originally generated by home-manager, taken apart and reassembled by me.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; Make sure nix installed binaries are in the PATH
|
||||
(setenv "PATH" (concat "/Users/willem/.nix-profile/bin:" (getenv "PATH")))
|
||||
(add-to-list 'exec-path "/Users/willem/.nix-profile/bin")
|
||||
|
||||
(setq inhibit-default-init t)
|
||||
|
||||
;; Transparent background for Emacs in terminal windows.
|
||||
(add-hook 'server-switch-hook
|
||||
(lambda ()
|
||||
(set-face-background 'default "unspecified-bg" (selected-frame))))
|
||||
|
||||
;; 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))
|
||||
|
||||
;; 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)
|
||||
|
||||
;; Enable highlighting of current line.
|
||||
(global-hl-line-mode 1)
|
||||
|
||||
;; Make it easier to enter tildes and backticks
|
||||
(global-set-key (kbd "M-n") "~")
|
||||
(global-set-key (kbd "M-N") "`")
|
||||
|
||||
(defun with-buffer-name-prompt-and-make-subdirs ()
|
||||
"Offer to create parent directory when finding file in a non-existent directory."
|
||||
(let ((parent-directory (file-name-directory buffer-file-name)))
|
||||
(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)
|
||||
|
||||
;; Don't warn when cannot guess python indent level
|
||||
(setq-default python-indent-guess-indent-offset-verbose nil)
|
||||
|
||||
;; Disable scroll + C to zoom
|
||||
(global-unset-key (kbd "C-<wheel-down>"))
|
||||
(global-unset-key (kbd "C-<wheel-up>"))
|
||||
|
||||
(require 'all-the-icons)
|
||||
(require 'all-the-icons-dired)
|
||||
(require 'company)
|
||||
(require 'counsel)
|
||||
(require 'edit-indirect)
|
||||
(require 'editorconfig)
|
||||
(require 'eglot)
|
||||
(require 'format-all)
|
||||
(require 'ivy)
|
||||
(require 'magit)
|
||||
(require 'meow)
|
||||
(require 'nix-mode)
|
||||
(require 'nix-update)
|
||||
(require 'org)
|
||||
(require 'org-modern)
|
||||
(require 'pinentry)
|
||||
(require 'polymode)
|
||||
(require 'rustic)
|
||||
(require 'rust-ts-mode)
|
||||
(require 'swiper)
|
||||
(require 'yasnippet)
|
||||
|
||||
(setenv "INSIDE_EMACS" (format "%s,comint" emacs-version))
|
||||
(pinentry-start)
|
||||
|
||||
(let ((org-config (expand-file-name "~/.emacs.d/org-tex-cfg.el")))
|
||||
(when (file-exists-p org-config)
|
||||
(load-file org-config))
|
||||
)
|
||||
(let ((nix-extraconfig (expand-file-name "~/.emacs.d/nix-extraconfig.el")))
|
||||
(when (file-exists-p nix-extraconfig)
|
||||
(load-file nix-extraconfig))
|
||||
)
|
||||
|
||||
(setq org-directory (expand-file-name "~/Documents/org"))
|
||||
|
||||
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
|
||||
|
||||
(setq company-format-margin-function 'company-text-icons-margin)
|
||||
(setq company-text-icons-add-background t)
|
||||
|
||||
(add-hook 'after-init-hook 'global-company-mode)
|
||||
|
||||
;; Configure Ivy/Swiper
|
||||
(global-set-key "\C-s" 'swiper)
|
||||
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
||||
(global-set-key (kbd "<f6>") 'ivy-resume)
|
||||
(global-set-key (kbd "M-x") 'counsel-M-x)
|
||||
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
|
||||
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
|
||||
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
|
||||
(global-set-key (kbd "<f1> o") 'counsel-describe-symbol)
|
||||
(global-set-key (kbd "<f1> l") 'counsel-find-library)
|
||||
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
|
||||
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
|
||||
(global-set-key (kbd "C-c g") 'counsel-git)
|
||||
(global-set-key (kbd "C-c j") 'counsel-git-grep)
|
||||
(global-set-key (kbd "C-c k") 'counsel-ag)
|
||||
(global-set-key (kbd "C-x l") 'counsel-locate)
|
||||
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
|
||||
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
|
||||
|
||||
(editorconfig-mode 1)
|
||||
|
||||
(global-set-key (kbd "C-c C-y") 'format-all-buffer)
|
||||
|
||||
(add-to-list 'format-all-default-formatters '("Nix" alejandra))
|
||||
(setq-default format-all-formatters format-all-default-formatters)
|
||||
|
||||
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
||||
(add-hook 'after-init-hook 'ivy-mode)
|
||||
|
||||
(setq ivy-use-virtual-buffers t)
|
||||
(setq ivy-use-selectable-prompt t)
|
||||
(setq enable-recursive-minibuffers t)
|
||||
|
||||
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
|
||||
;; ignores the order of regexp tokens when searching for matching candidates.
|
||||
(setq ivy-re-builders-alist
|
||||
'((ivy-bibtex . ivy--regex-ignore-order)
|
||||
(t . ivy--regex-plus)))
|
||||
|
||||
(defun meow-setup ()
|
||||
"Initialize meow-edit for colemak."
|
||||
(setq meow-cheatsheet-layout meow-cheatsheet-layout-colemak)
|
||||
(meow-motion-overwrite-define-key
|
||||
;; Use e to move up, n to move down.
|
||||
;; Since special modes usually use n to move down, we only overwrite e here.
|
||||
'("e" . meow-prev)
|
||||
'("<escape>" . ignore))
|
||||
(meow-leader-define-key
|
||||
'("?" . meow-cheatsheet)
|
||||
;; To execute the originally e in MOTION state, use SPC e.
|
||||
'("e" . "H-e")
|
||||
'("1" . meow-digit-argument)
|
||||
'("2" . meow-digit-argument)
|
||||
'("3" . meow-digit-argument)
|
||||
'("4" . meow-digit-argument)
|
||||
'("5" . meow-digit-argument)
|
||||
'("6" . meow-digit-argument)
|
||||
'("7" . meow-digit-argument)
|
||||
'("8" . meow-digit-argument)
|
||||
'("9" . meow-digit-argument)
|
||||
'("0" . meow-digit-argument))
|
||||
(meow-normal-define-key
|
||||
'("0" . meow-expand-0)
|
||||
'("1" . meow-expand-1)
|
||||
'("2" . meow-expand-2)
|
||||
'("3" . meow-expand-3)
|
||||
'("4" . meow-expand-4)
|
||||
'("5" . meow-expand-5)
|
||||
'("6" . meow-expand-6)
|
||||
'("7" . meow-expand-7)
|
||||
'("8" . meow-expand-8)
|
||||
'("9" . meow-expand-9)
|
||||
'("-" . negative-argument)
|
||||
'(";" . meow-reverse)
|
||||
'("," . meow-inner-of-thing)
|
||||
'("." . meow-bounds-of-thing)
|
||||
'("[" . meow-beginning-of-thing)
|
||||
'("]" . meow-end-of-thing)
|
||||
'("/" . meow-visit)
|
||||
'("a" . meow-append)
|
||||
'("A" . meow-open-below)
|
||||
'("b" . meow-back-word)
|
||||
'("B" . meow-back-symbol)
|
||||
'("c" . meow-change)
|
||||
'("d" . meow-delete)
|
||||
'("e" . meow-prev)
|
||||
'("E" . meow-prev-expand)
|
||||
'("f" . meow-find)
|
||||
'("g" . meow-cancel-selection)
|
||||
'("G" . meow-grab)
|
||||
'("h" . meow-left)
|
||||
'("H" . meow-left-expand)
|
||||
'("i" . meow-right)
|
||||
'("I" . meow-right-expand)
|
||||
'("j" . meow-join)
|
||||
'("k" . meow-kill)
|
||||
'("l" . meow-line)
|
||||
'("L" . meow-goto-line)
|
||||
'("m" . meow-mark-word)
|
||||
'("M" . meow-mark-symbol)
|
||||
'("n" . meow-next)
|
||||
'("N" . meow-next-expand)
|
||||
'("o" . meow-block)
|
||||
'("O" . meow-to-block)
|
||||
'("p" . meow-yank)
|
||||
'("q" . meow-quit)
|
||||
'("r" . meow-replace)
|
||||
'("s" . meow-insert)
|
||||
'("S" . meow-open-above)
|
||||
'("t" . meow-till)
|
||||
'("u" . meow-undo)
|
||||
'("U" . meow-undo-in-selection)
|
||||
'("v" . meow-search)
|
||||
'("w" . meow-next-word)
|
||||
'("W" . meow-next-symbol)
|
||||
'("x" . meow-delete)
|
||||
'("X" . meow-backward-delete)
|
||||
'("y" . meow-save)
|
||||
'("z" . meow-pop-selection)
|
||||
'("'" . repeat)
|
||||
'("<escape>" . ignore)))
|
||||
|
||||
(meow-setup)
|
||||
(meow-global-mode 1)
|
||||
|
||||
|
||||
;; Polymode config (add support for nix files with commented strings)
|
||||
|
||||
(define-hostmode poly-nix-hostmode :mode 'nix-mode)
|
||||
|
||||
(define-auto-innermode poly-any-expr-nix-innermode
|
||||
:head-matcher (rx (* blank) "/*" (* blank) bow (+ (or word punct)) eow (* blank) "*/" (* blank) "''\n")
|
||||
:mode-matcher (cons (rx "/*" (* blank) (submatch bow (+ (or word punct)) eow) (* blank) "*/") 1)
|
||||
:tail-matcher (rx bol (* blank) "'';" (* blank) eol)
|
||||
:head-mode 'host
|
||||
:tail-mode 'host
|
||||
:fallback-mode 'text-mode)
|
||||
|
||||
(define-polymode poly-nix-mode
|
||||
:hostmode 'poly-nix-hostmode
|
||||
:innermodes '(poly-any-expr-nix-innermode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.nix$" . poly-nix-mode))
|
||||
|
||||
;; Automatically update hash for nix fetch functions
|
||||
(define-key nix-mode-map (kbd "C-c C-u") 'nix-update-fetch)
|
||||
|
||||
(define-key eglot-mode-map (kbd "C-c C-y") 'eglot-format-buffer)
|
||||
(define-key eglot-mode-map (kbd "C-c C-a") 'eglot-code-actions)
|
||||
(setq eglot-extend-to-xref t)
|
||||
(setq rustic-lsp-client 'eglot)
|
||||
|
||||
(setq rustic-treesitter-derive t)
|
||||
|
||||
(setq auto-mode-alist (rassq-delete-all 'rust-mode auto-mode-alist))
|
||||
(setq auto-mode-alist (rassq-delete-all 'rust-ts-mode auto-mode-alist))
|
||||
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rustic-mode))
|
||||
|
||||
(defvar separedit-preserve-string-indentation t)
|
||||
(global-set-key (kbd "C-c '") 'separedit)
|
||||
(add-hook 'separedit-buffer-creation-hook 'normal-mode)
|
||||
|
||||
(global-set-key (kbd "C-s") 'swiper)
|
||||
|
||||
(setq yas-snippet-dirs (list (expand-file-name "snippets" org-directory)))
|
||||
|
||||
;; Accept 'y' and 'n' rather than 'yes' and 'no'.
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
(provide 'init)
|
||||
;;; init.el ends here
|
|
@ -1,183 +0,0 @@
|
|||
(require 'cdlatex)
|
||||
(require 'citeproc)
|
||||
(require 'gnuplot)
|
||||
(require 'gnuplot-context)
|
||||
(require 'graphviz-dot-mode)
|
||||
(require 'htmlize)
|
||||
(require 'ivy-bibtex)
|
||||
(require 'ob-dot)
|
||||
(require 'ob-emacs-lisp)
|
||||
(require 'ob-gnuplot)
|
||||
(require 'ob-matlab)
|
||||
(require 'ob-python)
|
||||
(require 'ob-shell)
|
||||
(require 'oc)
|
||||
(require 'oc-basic)
|
||||
(require 'oc-csl)
|
||||
(require 'oc-natbib)
|
||||
(require 'org-auctex)
|
||||
(require 'org-contrib)
|
||||
(require 'org-download)
|
||||
(require 'ox-latex)
|
||||
(require 'ox-publish)
|
||||
(require 'pdf-tools)
|
||||
(require 'plantuml-mode)
|
||||
(require 'tex)
|
||||
|
||||
(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))
|
||||
|
||||
(define-key graphviz-dot-mode-map (kbd "C-c C-y") 'graphviz-dot-indent-graph)
|
||||
|
||||
(defvar zotero-bibliography (expand-file-name "zotero.bib" org-directory))
|
||||
|
||||
(defvar ivy-bibtex-bibliography (list zotero-bibliography))
|
||||
(setq reftex-default-bibliography (list zotero-bibliography))
|
||||
(setq bibtex-completion-pdf-field "file")
|
||||
|
||||
(add-hook 'LaTeX-mode-hook 'turn-on-cdlatex)
|
||||
(add-hook 'LaTeX-mode (lambda ()
|
||||
(turn-on-reftex)))
|
||||
(setq TeX-PDF-mode t
|
||||
TeX-auto-save t
|
||||
TeX-parse-self t)
|
||||
|
||||
(setq org-babel-octave-shell-command "octave -q")
|
||||
|
||||
(setq org-babel-python-command "python3.10")
|
||||
(setq-default python-indent-guess-indent-offset-verbose nil)
|
||||
(defun my/org-babel-execute:python-session (body params)
|
||||
"Initiate a python session before executing org babel blocks that use sessions.
|
||||
BODY is the content of the org-babel block and PARAMS are any parameters specified."
|
||||
(let ((session-name (cdr (assq :session params))))
|
||||
(when (not (eq session-name "none"))
|
||||
(org-babel-python-initiate-session session-name))))
|
||||
(advice-add #'org-babel-execute:python :before #'my/org-babel-execute:python-session)
|
||||
|
||||
(defun my/indent-org-block-automatically ()
|
||||
"Indent the current org code block."
|
||||
(interactive)
|
||||
(when (org-in-src-block-p)
|
||||
(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)
|
||||
(let ((org-link-frame-setup
|
||||
(quote
|
||||
((vm . vm-visit-folder)
|
||||
(vm-imap . vm-visit-imap-folder)
|
||||
(gnus . gnus)
|
||||
(file . find-file)
|
||||
(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."
|
||||
(interactive "P")
|
||||
(if arg
|
||||
(org-open-at-point)
|
||||
(my/org-force-open-current-window)))
|
||||
(defun krofna-hack ()
|
||||
"Toggle latex fragments after exiting closing them."
|
||||
(when (looking-back (rx "$ "))
|
||||
(save-excursion
|
||||
(backward-char 1)
|
||||
(org-latex-preview))))
|
||||
|
||||
|
||||
(global-set-key (kbd "C-c n a") 'org-agenda)
|
||||
|
||||
(setq org-agenda-start-on-weekday nil)
|
||||
|
||||
(define-key org-mode-map (kbd "C-c C-o") 'my/follow-org-link)
|
||||
(define-key org-mode-map (kbd "C-c C-y") 'my/indent-org-block-automatically)
|
||||
(define-key org-mode-map (kbd "C-c ]") 'org-cite-insert)
|
||||
|
||||
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
|
||||
(add-hook 'org-mode-hook 'visual-line-mode)
|
||||
(add-hook 'org-mode-hook 'org-cdlatex-mode)
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(add-hook 'post-self-insert-hook #'krofna-hack 'append 'local)))
|
||||
|
||||
(add-to-list 'org-latex-classes
|
||||
'("mla"
|
||||
"\\documentclass{mla}"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
||||
(add-to-list 'org-latex-classes
|
||||
'("letter"
|
||||
"\\documentclass{letter}"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
|
||||
|
||||
(plist-put org-format-latex-options :scale 3)
|
||||
|
||||
(setq org-agenda-files (list org-directory (expand-file-name "ubc" org-directory)))
|
||||
(setq org-agenda-tags-column 0)
|
||||
(setq org-auto-align-tags nil)
|
||||
(setq org-fold-catch-invisible-edits 'show-and-error)
|
||||
(setq org-cite-export-processors '((t basic)))
|
||||
(setq org-cite-global-bibliography (list zotero-bibliography))
|
||||
(setq org-confirm-babel-evaluate nil)
|
||||
(setq org-ellipsis "…")
|
||||
(setq org-export-with-tags nil)
|
||||
(setq org-hide-emphasis-markers t)
|
||||
(setq org-highlight-latex-and-related '(latex))
|
||||
(setq org-html-head-include-default-style nil)
|
||||
(setq org-html-head-include-scripts nil)
|
||||
(setq org-html-validation-link nil)
|
||||
(setq org-image-actual-width 300)
|
||||
(setq org-insert-heading-respect-content t)
|
||||
(setq org-latex-pdf-process '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
|
||||
(setq org-pretty-entities t)
|
||||
(setq org-preview-latex-default-process 'dvisvgm)
|
||||
(setq org-special-ctrl-a/e t)
|
||||
(setq org-src-fontify-natively t)
|
||||
(setq org-src-preserve-indentation t)
|
||||
(setq org-src-tab-acts-natively t)
|
||||
(setq org-src-window-setup 'current-window)
|
||||
(setq org-tags-column 0)
|
||||
|
||||
(setq org-agenda-time-grid
|
||||
'((daily today require-timed)
|
||||
(800 1000 1200 1400 1600 1800 2000)
|
||||
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄"))
|
||||
|
||||
(setq org-exports-dir (expand-file-name "exports" org-directory))
|
||||
|
||||
(setq org-publish-project-alist
|
||||
(list (cons "html"
|
||||
(list :base-directory org-directory
|
||||
:base-extension "org"
|
||||
:htmlized-source t
|
||||
:recursive t
|
||||
:publishing-directory org-exports-dir
|
||||
:publishing-function 'org-html-publish-to-html))
|
||||
(cons "pdf"
|
||||
(list :base-directory org-directory
|
||||
:base-extension "org"
|
||||
:recursive t
|
||||
:publishing-directory org-exports-dir
|
||||
:publishing-function 'org-latex-publish-to-pdf))
|
||||
(cons "all" '(:components ("html" "pdf")))))
|
||||
|
||||
(add-hook 'org-mode-hook 'org-auctex-mode)
|
||||
|
||||
(add-hook 'dired-mode-hook 'org-download-enable)
|
||||
(setq-default org-download-image-dir (expand-file-name "images" org-directory))
|
||||
|
||||
(add-hook 'org-mode-hook 'org-modern-mode)
|
||||
|
||||
(setq-default pdf-view-display-size 'fit-width)
|
||||
(defvar pdf-annot-activate-created-annotations t)
|
||||
|
||||
(setq plantuml-default-exec-mode 'executable)
|
|
@ -1,97 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.emacs = {
|
||||
orgTexConfigFile = ./org-tex-cfg.el;
|
||||
enableOrgTex = lib.mkDefault false;
|
||||
|
||||
texEmacsPackages = epkgs: (let
|
||||
org-auctex = epkgs.trivialBuild rec {
|
||||
pname = "org-auctex";
|
||||
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
|
||||
|
||||
buildInputs = [epkgs.auctex];
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "karthink";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw=";
|
||||
};
|
||||
};
|
||||
in (with epkgs; [
|
||||
org-auctex
|
||||
auctex
|
||||
cdlatex
|
||||
citeproc
|
||||
graphviz-dot-mode
|
||||
ivy-bibtex
|
||||
gnuplot
|
||||
htmlize
|
||||
org-auctex
|
||||
org-contrib
|
||||
org-download
|
||||
pdf-tools
|
||||
plantuml-mode
|
||||
]));
|
||||
|
||||
texPackages = let
|
||||
aspellPackage = pkgs.aspellWithDicts (d: [d.en d.en-science d.en-computers d.fr]);
|
||||
texliveset = pkgs.texlive.combine {
|
||||
inherit
|
||||
(pkgs.texlive)
|
||||
scheme-basic
|
||||
babel
|
||||
amscls
|
||||
amsmath
|
||||
biber
|
||||
biblatex
|
||||
biblatex-mla
|
||||
block
|
||||
cancel
|
||||
caption
|
||||
capt-of
|
||||
csquotes
|
||||
enotez
|
||||
enumitem
|
||||
etex
|
||||
etoolbox
|
||||
fancyhdr
|
||||
float
|
||||
fontaxes
|
||||
graphics
|
||||
hanging
|
||||
hyperref
|
||||
latex
|
||||
latexindent
|
||||
latexmk
|
||||
logreq
|
||||
metafont
|
||||
mlacls
|
||||
newtx
|
||||
pdflscape
|
||||
pdfpages
|
||||
preprint
|
||||
psnfss
|
||||
ragged2e
|
||||
titlesec
|
||||
tools
|
||||
translations
|
||||
ulem
|
||||
url
|
||||
wrapfig
|
||||
xstring
|
||||
xkeyval
|
||||
;
|
||||
};
|
||||
in
|
||||
with pkgs; [
|
||||
texliveset
|
||||
aspellPackage
|
||||
gnuplot
|
||||
plantuml
|
||||
];
|
||||
};
|
||||
}
|
|
@ -62,13 +62,9 @@
|
|||
ke = "kitten edit-in-kitty";
|
||||
cd = "z";
|
||||
dotd = "cd ${config.home.sessionVariables.DOTDIR} ";
|
||||
e = "emacsclient -c -nw";
|
||||
em = "emacs -nw";
|
||||
l = "ls -1";
|
||||
lh = "ls --hyperlink";
|
||||
np = "nix-shell -p";
|
||||
org = "cd ${config.home.sessionVariables.ORGDIR} ";
|
||||
ubc = "cd ${config.home.sessionVariables.UBCDIR} ";
|
||||
hmr = "nix run home-manager -- build --flake ${config.home.sessionVariables.DOTDIR}#";
|
||||
hms = "nix run home-manager -- switch --flake ${config.home.sessionVariables.DOTDIR}#";
|
||||
};
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
}: let
|
||||
home = config.home-manager.users.willem;
|
||||
homeDir = config.users.users.willem.home;
|
||||
emacsCfg = home.programs.emacs;
|
||||
alacrittyCfg = home.programs.alacritty;
|
||||
in {
|
||||
services.yabai = {
|
||||
|
@ -126,8 +125,6 @@ in {
|
|||
${yabai} -m window --toggle float; \
|
||||
${yabai} -m window --toggle border
|
||||
|
||||
# Open Emacs
|
||||
${ctrl} + shift - n : ${alacritty} msg create-window -e ${emacsCfg.finalPackage}/bin/emacsclient -nw || alacritty -e ${emacsCfg.finalPackage}/bin/emacsclient -nwOA
|
||||
# Open Firefox window
|
||||
${ctrl} + shift - b : /Applications/Firefox.app/Contents/MacOS/firefox -new-window
|
||||
'';
|
||||
|
|
Loading…
Add table
Reference in a new issue