From f5caccd7f763f74e4392f92cdf01ae19c698851a Mon Sep 17 00:00:00 2001 From: J S Date: Mon, 30 Oct 2023 13:07:22 -0400 Subject: [PATCH] feat[lsp,org,cite]: Added better citation icons I added some snazzy icons to citar. Corrected several org-latex classes to avoid hyperlink highlights. Added (potentially) better LSP settings with syntax flags --- config.el | 66 ++++++++++++++++++++++++++++++++++++--------- config.org | 78 +++++++++++++++++++++++++++++++++++++++++++----------- init.el | 8 +++--- 3 files changed, 121 insertions(+), 31 deletions(-) diff --git a/config.el b/config.el index d33edaf..1e25fd5 100644 --- a/config.el +++ b/config.el @@ -15,10 +15,6 @@ (setq fancy-splash-image (concat doom-private-dir "emacs.png")) (map! :desc "Switch to normal mode" :i "C-c" #'evil-normal-state) -(use-package! noCtrlC - :after org-mode) - -(setq org-pretty-entities 0) (defun bash () (interactive) @@ -579,8 +575,6 @@ If nil it defaults to `split-string-default-separators', normally (citar-file-note-extensions '(".org")) (org-cite-global-bibliography '("~/org/references.bib")) - - (org-cite-csl-styles-dir (expand-file-name "~/Zotero/styles/")) (org-cite-export-processors @@ -589,15 +583,61 @@ If nil it defaults to `split-string-default-separators', normally :hook (LaTeX-mode . citar-capf-setup) (org-mode . citar-capf-setup)) -(after! org-mode - (org-cite-global-bibliography '("~/org/references.bib")) - ) - (citar-org-roam-mode) +(after! citar + (setq citar-indicator-files-icons + (citar-indicator-create + :symbol (nerd-icons-faicon + "nf-fa-file_o" + :face 'nerd-icons-green + :v-adjust -0.1) + :function #'citar-has-files + :padding " " ; need this because the default padding is too low for these icons + :tag "has:files")) + + (setq citar-indicator-links-icons + (citar-indicator-create + :symbol (nerd-icons-faicon + "nf-fa-link" + :face 'nerd-icons-orange + :v-adjust 0.01) + :function #'citar-has-links + :padding " " + :tag "has:links")) + + (setq citar-indicator-notes-icons + (citar-indicator-create + :symbol (nerd-icons-codicon + "nf-cod-note" + :face 'nerd-icons-blue + :v-adjust -0.3) + :function #'citar-has-notes + :padding " " + :tag "has:notes")) + + (setq citar-indicator-cited-icons + (citar-indicator-create + :symbol (nerd-icons-faicon + "nf-fa-circle_o" + :face 'nerd-icon-green) + :function #'citar-is-cited + :padding " " + :tag "is:cited")) + +(setq citar-indicators + (list citar-indicator-files-icons + citar-indicator-links-icons + citar-indicator-notes-icons + citar-indicator-cited-icons))) + (add-to-list 'org-latex-classes '("student-apa7" - "\\documentclass[stu]{apa7}" + "\\documentclass[stu]{apa7} +\\hypersetup{hidelinks} +\\usepackage{times} +[NO-DEFAULT-PACKAGES] +[NO-PACKAGES]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") @@ -618,7 +658,9 @@ If nil it defaults to `split-string-default-separators', normally (add-to-list 'org-latex-classes '("student-mla" - "\\documentclass[stu]{mla}" + "\\documentclass[stu]{mla} +\\hypersetup{hidelinks} +\\usepackage{times} " ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") diff --git a/config.org b/config.org index 93c1872..c8a998a 100644 --- a/config.org +++ b/config.org @@ -45,13 +45,8 @@ Set a sweet splash image I want a non-ESC way to get back to normal mode: #+BEGIN_SRC emacs-lisp (map! :desc "Switch to normal mode" :i "C-c" #'evil-normal-state) -(use-package! noCtrlC - :after org-mode) #+END_SRC -#+BEGIN_SRC emacs-lisp - (setq org-pretty-entities 0) -#+END_SRC * Terminal setup I like to just use bash: #+BEGIN_SRC emacs-lisp @@ -785,8 +780,11 @@ We'll want a handy shortcut for this. : /home/user/.config/doom/ ** Automatic Citations with *citar* and *org-cite* -Citar is a sweet little package for managing citations. Right here we'll set it up -We want a general bibliography file, a styles directory, and a default set of styles. +Citar is a sweet little package for managing citations. +We want a general [[file:~/org/references.bib][bibliography file]], a [[file:~/Zotero/styles/][styles directory]], +and a default set of styles. +*** Citar setup +First of all, we must configure citar. #+BEGIN_SRC emacs-lisp (use-package! citar :ensure t @@ -796,8 +794,6 @@ We want a general bibliography file, a styles directory, and a default set of st (citar-file-note-extensions '(".org")) (org-cite-global-bibliography '("~/org/references.bib")) - - (org-cite-csl-styles-dir (expand-file-name "~/Zotero/styles/")) (org-cite-export-processors @@ -806,20 +802,70 @@ We want a general bibliography file, a styles directory, and a default set of st :hook (LaTeX-mode . citar-capf-setup) (org-mode . citar-capf-setup)) -(after! org-mode - (org-cite-global-bibliography '("~/org/references.bib")) - ) - (citar-org-roam-mode) #+END_SRC +*** Icons for some prettification +#+BEGIN_SRC emacs-lisp +(after! citar + (setq citar-indicator-files-icons + (citar-indicator-create + :symbol (nerd-icons-faicon + "nf-fa-file_o" + :face 'nerd-icons-green + :v-adjust -0.1) + :function #'citar-has-files + :padding " " ; need this because the default padding is too low for these icons + :tag "has:files")) + + (setq citar-indicator-links-icons + (citar-indicator-create + :symbol (nerd-icons-faicon + "nf-fa-link" + :face 'nerd-icons-orange + :v-adjust 0.01) + :function #'citar-has-links + :padding " " + :tag "has:links")) + + (setq citar-indicator-notes-icons + (citar-indicator-create + :symbol (nerd-icons-codicon + "nf-cod-note" + :face 'nerd-icons-blue + :v-adjust -0.3) + :function #'citar-has-notes + :padding " " + :tag "has:notes")) + + (setq citar-indicator-cited-icons + (citar-indicator-create + :symbol (nerd-icons-faicon + "nf-fa-circle_o" + :face 'nerd-icon-green) + :function #'citar-is-cited + :padding " " + :tag "is:cited")) + +(setq citar-indicators + (list citar-indicator-files-icons + citar-indicator-links-icons + citar-indicator-notes-icons + citar-indicator-cited-icons))) +#+END_SRC + + ** Scholarly Writing Environment with Org-mode I like to keep formatting simple. Let's use a package or two to set a decent document class: #+BEGIN_SRC emacs-lisp (add-to-list 'org-latex-classes '("student-apa7" - "\\documentclass[stu]{apa7}" + "\\documentclass[stu]{apa7} +\\hypersetup{hidelinks} +\\usepackage{times} +[NO-DEFAULT-PACKAGES] +[NO-PACKAGES]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") @@ -840,7 +886,9 @@ Let's use a package or two to set a decent document class: (add-to-list 'org-latex-classes '("student-mla" - "\\documentclass[stu]{mla}" + "\\documentclass[stu]{mla} +\\hypersetup{hidelinks} +\\usepackage{times} " ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") diff --git a/init.el b/init.el index 8e2e699..e0d0c62 100644 --- a/init.el +++ b/init.el @@ -80,13 +80,13 @@ ;;vterm ; the best terminal emulation in Emacs :checkers - syntax ; tasing you for every semicolon you forget + (syntax +flymake +childframe) ; tasing you for every semicolon you forget (spell +flyspell +everywhere) ; tasing you for misspelling mispelling grammar ; tasing grammar mistake every you make :tools ;;ansible - biblio ; Writes a PhD for you (citation needed) + (biblio +icons) ; Writes a PhD for you (citation needed) ;;debugger ; FIXME stepping through code, to help you add bugs ;;direnv ;;docker @@ -114,7 +114,7 @@ :lang ;;agda ; types of types of types of types... - ( beancount +lsp) ; mind the GAAP + (beancount +lsp) ; mind the GAAP (cc +lsp) ; C > C++ == 1 ;;clojure ; java with a lisp ;;common-lisp ; if you've seen one lisp, you've seen them all @@ -153,7 +153,7 @@ ;;nim ; python + lisp at the speed of c ;;nix ; I hereby declare "nix geht mehr!" ;;ocaml ; an objective camel - (org +roam2 +gnuplot +hugo +pomodoro +noter) ; organize your plain life in plain text + (org +roam2 +gnuplot +hugo +pomodoro +noter +present +pretty) ; organize your plain life in plain text ;;php ; perl's insecure younger brother ;;plantuml ; diagrams for confusing people more ;;purescript ; javascript, but functional