emacs mla/apa formatting, start on citations, remove org-roam

This commit is contained in:
willemml 2023-01-14 09:17:35 -08:00
parent 6eb110370b
commit 131b727a1e
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD

149
emacs.nix
View file

@ -13,6 +13,7 @@ in {
usePackageVerbose = false; usePackageVerbose = false;
earlyInit = '' earlyInit = ''
; -*-emacs-lisp-*-
;; Disable Toolbar ;; Disable Toolbar
(tool-bar-mode -1) (tool-bar-mode -1)
;; Disable scrollbar ;; Disable scrollbar
@ -35,6 +36,7 @@ in {
(setq warning-minimum-level 'error) (setq warning-minimum-level 'error)
''; '';
prelude = '' prelude = ''
; -*-emacs-lisp-*-
;; Disable startup message. ;; Disable startup message.
(setq inhibit-startup-screen t (setq inhibit-startup-screen t
inhibit-startup-echo-area-message (user-login-name)) inhibit-startup-echo-area-message (user-login-name))
@ -311,6 +313,7 @@ in {
lsp-java = { lsp-java = {
enable = true; enable = true;
init = '' init = ''
; -*-emacs-lisp-*-
(setq lsp-java-format-settings-url (setq lsp-java-format-settings-url
"https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml") "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml")
(setq lsp-java-format-settings-profile (setq lsp-java-format-settings-profile
@ -359,6 +362,7 @@ in {
org = { org = {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
; -*-emacs-lisp-*-
:preface :preface
(defun my/indent-org-block-automatically () (defun my/indent-org-block-automatically ()
"Indent the current org code block." "Indent the current org code block."
@ -390,66 +394,89 @@ in {
(my/org-force-open-current-window))) (my/org-force-open-current-window)))
''; '';
init = '' init = ''
(defvar my/org-dir "~/Documents/org/") ; -*-emacs-lisp-*-
(defvar my/org-dir "~/Documents/org/")
(require 'oc) (require 'oc)
(require 'oc-basic)
(require 'oc-csl)
(require 'oc-natbib)
(setq org-src-window-setup 'current-window) (setq org-src-window-setup 'current-window)
(setq org-confirm-babel-evaluate nil) (setq org-confirm-babel-evaluate nil)
(setq org-src-fontify-natively t) (setq org-src-fontify-natively t)
(setq org-src-tab-acts-natively t) (setq org-src-tab-acts-natively t)
(setq org-src-preserve-indentation t) (setq org-src-preserve-indentation t)
(setq org-export-with-tags nil) (setq org-export-with-tags nil)
(setq org-publish-project-alist (setq org-publish-project-alist
'(("root" '(("root"
:base-directory (expand-file-name my/org-dir) :base-directory (expand-file-name my/org-dir)
:publishing-function org-html-publish-to-html :publishing-function org-html-publish-to-html
:publishing-directory (expand-file-name "~/public_html") :publishing-directory (expand-file-name "~/public_html")
:section-numbers nil :section-numbers nil
:with-author nil :with-author nil
:with-creator t :with-creator t
:with-toc t :with-toc t
:time-stamp-file nil))) :time-stamp-file nil)))
;; Configure HTML export ;; Configure HTML export
(setq org-html-validation-link nil) (setq org-html-validation-link nil)
(setq org-html-head-include-scripts nil) (setq org-html-head-include-scripts nil)
(setq org-html-head-include-default-style nil) (setq org-html-head-include-default-style nil)
(setq org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />") (setq org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
(setq org-html-section) (setq org-html-section)
(setq bibtex-completion-notes-path (expand-file-name "notes.org" my/org-dir)) (setq bibtex-completion-notes-path (expand-file-name "notes.org" my/org-dir))
(setq org-cite-follow-processor 'ivy-bibtex-org-cite-follow) (setq org-cite-global-bibliography '("~/Documents/org/zotero.bib"))
(setq bibtex-completion-pdf-open-function (setq org-cite-export-processors '((t basic)))
(lambda (fpath)
(call-process "open" nil 0 nil "-a" "/Applications/Preview.app" fpath)))
(defun org-export-latex-no-toc (depth) (setq org-cite-follow-processor 'ivy-bibtex-org-cite-follow)
(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)
(add-to-list 'org-latex-classes (setq bibtex-completion-pdf-open-function
'("apa6" (lambda (fpath)
"\\documentclass{apa6}" (call-process "open" nil 0 nil "-a" "/Applications/Preview.app" fpath)))
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(setq org-latex-pdf-process (defun org-export-latex-no-toc (depth)
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f")) (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")
(require 'ox-latex)
(add-to-list 'org-latex-classes
'("apa6"
"\\documentclass{apa6}"
("\\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
'("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 'exec-path "/Users/willem/.nix-profile/bin")
''; '';
hook = [ "(org-babel-after-execute . org-redisplay-inline-images)" ]; hook = [
"(org-babel-after-execute . org-redisplay-inline-images)"
"(org-mode . visual-line-mode)"
];
bind = { bind = {
"C-c n c" = "org-id-get-create"; "C-c n c" = "org-id-get-create";
@ -513,6 +540,7 @@ in {
]; ];
after = [ "org" ]; after = [ "org" ];
config = '' config = ''
; -*-emacs-lisp-*-
(setq org-babel-python-command "${pkgs.python310}/bin/python3.10") (setq org-babel-python-command "${pkgs.python310}/bin/python3.10")
(setq-default python-indent-guess-indent-offset-verbose nil) (setq-default python-indent-guess-indent-offset-verbose nil)
(defun my/org-babel-execute:python-session (body params) (defun my/org-babel-execute:python-session (body params)
@ -527,6 +555,7 @@ in {
enable = true; enable = true;
extraPackages = [ pkgs.sqlite ]; extraPackages = [ pkgs.sqlite ];
config = '' config = ''
; -*-emacs-lisp-*-
(setq calibredb-root-dir "~/Documents/calibre-library") (setq calibredb-root-dir "~/Documents/calibre-library")
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir)) (setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
(setq calibredb-library-alist '(("~/Documents/calibre-library"))) (setq calibredb-library-alist '(("~/Documents/calibre-library")))
@ -537,6 +566,7 @@ in {
meow = { meow = {
enable = true; enable = true;
config = '' config = ''
; -*-emacs-lisp-*-
(defun meow-setup () (defun meow-setup ()
(setq meow-cheatsheet-layout meow-cheatsheet-layout-colemak) (setq meow-cheatsheet-layout meow-cheatsheet-layout-colemak)
(meow-motion-overwrite-define-key (meow-motion-overwrite-define-key
@ -624,6 +654,7 @@ in {
separedit = { separedit = {
enable = true; enable = true;
bind = { "C-c '" = "separedit"; }; bind = { "C-c '" = "separedit"; };
hook = [ "(separedit-buffer-creation . normal-mode)" ];
}; };
editorconfig = { editorconfig = {
@ -647,6 +678,7 @@ in {
enable = false; enable = false;
init = '' init = ''
; -*-emacs-lisp-*-
(dolist (var '("LANG" "LC_CTYPE" "LC_MESSAGES" "NIX_SSL_CERT_FILE" "NIX_PROFILES" "JAVA_HOME" "GNUPGHOME")) (dolist (var '("LANG" "LC_CTYPE" "LC_MESSAGES" "NIX_SSL_CERT_FILE" "NIX_PROFILES" "JAVA_HOME" "GNUPGHOME"))
(add-to-list 'exec-path-from-shell-variables var)) (add-to-list 'exec-path-from-shell-variables var))
@ -660,11 +692,10 @@ in {
''; '';
}; };
ivy-bibtext = { ivy-bibtex = {
enable = true; enable = true;
init = '' init = ''
(autoload 'ivy-bibtex "ivy-bibtex" "" t) ; -*-emacs-lisp-*-
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which ;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
;; ignores the order of regexp tokens when searching for matching candidates. ;; ignores the order of regexp tokens when searching for matching candidates.
(setq ivy-re-builders-alist (setq ivy-re-builders-alist
@ -675,33 +706,35 @@ in {
(setq reftex-default-bibliography '("~/Documents/org/zotero.bib")) (setq reftex-default-bibliography '("~/Documents/org/zotero.bib"))
(setq bibtex-completion-pdf-field "file") (setq bibtex-completion-pdf-field "file")
''; '';
hook = [
''(Tex . (lambda () (define-key Tex-mode-map "C-ch" 'ivy-bibtex)))''
];
}; };
org-ref = { org-ref = {
enable = true; enable = true;
init = '' init = ''
; -*-emacs-lisp-*-
(setq org-ref-insert-cite-function (setq org-ref-insert-cite-function
(lambda () (lambda ()
(org-cite-insert nil))) (org-cite-insert nil)))
(setq org-ref-default-bibliography "~/Documents/org/zotero.bib") (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"; };
}; };
pdf-tools = { pdf-tools = {
enable = true; enable = true;
init = '' init = ''
(pdf-tools-install) ; -*-emacs-lisp-*-
(setq-default pdf-view-display-size 'fit-width) (setq-default pdf-view-display-size 'fit-width)
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
(setq pdf-annot-activate-created-annotations t) (setq pdf-annot-activate-created-annotations t)
''; '';