aboutsummaryrefslogtreecommitdiff
path: root/Emacs/.config/emacs/config.org
diff options
context:
space:
mode:
Diffstat (limited to 'Emacs/.config/emacs/config.org')
-rw-r--r--Emacs/.config/emacs/config.org608
1 files changed, 367 insertions, 241 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index 229aaa7..fb0e2c5 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -184,9 +184,12 @@ any buffers in ~+oreo/keep-buffer~ and kills the rest.
#+end_src
* Aesthetics
General look and feel of Emacs (mostly disabling stuff I don't like).
-** Custom theme
-Load my custom "personal-primary" theme which is stored in the Emacs
-lisp folder (look at [[file:elisp/personal-primary-theme.el][this file]]).
+** Themes
+*** Dark theme
+My preferred dark theme is my own "personal-primary" theme which is
+stored in the Emacs lisp folder (look at [[file:elisp/personal-primary-theme.el][this file]]). It tries to use
+the primary colours for everything, leading to a colour -> meaning
+relation.
I have an older version of this theme that uses a homogeneous colour
scheme ([[file:elisp/personal-theme.el][this file]])
@@ -199,6 +202,35 @@ scheme ([[file:elisp/personal-theme.el][this file]])
:config
(load-theme 'personal-primary t))
#+end_src
+*** Light theme
+I'm not very good at designing light themes as I don't really use
+them. However they are necessary in high light situations where a
+dark mode would strain the eyes too much. So I built a custom theme
+on top of the default Emacs theme, "personal-light" (look at [[file:elisp/personal-light-theme.el][this
+file]]).
+
+I don't use it by default but I may need to switch between light and
+dark easily, so here's a command to switch between them.
+
+#+begin_src emacs-lisp
+(use-package custom
+ :defer t
+ :straight nil
+ :commands +oreo/switch-theme
+ :init
+ (defvar +oreo/theme 'dark)
+ :config
+ (defun +oreo/switch-theme ()
+ (interactive)
+ (cond
+ ((eq +oreo/theme 'dark)
+ (load-theme 'personal-light t)
+ (setq +oreo/theme 'light))
+ ((eq +oreo/theme 'light)
+ (load-theme 'personal-primary t)
+ (setq +oreo/theme 'dark)))))
+
+#+end_src
** Font size
Set font size to 140 if on my desktop (oldboy) or 175 if on my laptop
(spiderboy).
@@ -393,8 +425,8 @@ code.
;; General which key definitions for leaders
(general-def
:states '(normal motion)
- "SPC" nil
- "SPC ," '(nil :which-key "Local leader")
+ "SPC" 'nil
+ "\\" '(nil :which-key "Local leader")
"SPC c" '(nil :which-key "Code")
"SPC f" '(nil :which-key "File")
"SPC t" '(nil :which-key "Shell")
@@ -413,7 +445,7 @@ code.
(general-create-definer local-leader
:states '(normal motion)
- :prefix "SPC ,")
+ :prefix "\\")
(general-create-definer code-leader
:states '(normal motion)
@@ -475,47 +507,46 @@ code.
*** Some binds in Emacs
Some bindings that I couldn't fit elsewhere easily.
#+begin_src emacs-lisp
-(use-package emacs
- :straight nil
- :general
- (general-def
- "C-x d" #'delete-frame)
-
- (nmmap
- "C--" #'text-scale-decrease
- "C-=" #'text-scale-increase)
-
- (leader
- "SPC" '(execute-extended-command :which-key "M-x")
- "'" '(browse-url-emacs :which-key "Open url in Emacs")
- "u" 'universal-argument
- ";" 'eval-expression
- ":" `(,(proc (interactive) (switch-to-buffer "*scratch*"))
- :which-key "Switch to *scratch*")
- "!" '(async-shell-command :which-key "Async shell command")
- "h" '(help-command :which-key "Help"))
-
- (code-leader
- "j" #'next-error
- "k" #'previous-error
- "c" #'compile
- "C" #'recompile
- "F" (list (proc (interactive) (find-file "~/Code/")) ':which-key "Open ~/Code/"))
-
- (file-leader
- "f" #'find-file
- "F" #'find-file-other-frame
- "s" #'save-buffer
- "p" (list (proc (interactive) (find-file (concat user-emacs-directory "config.org")))
- ':which-key "Open config.org"))
-
- (quit-leader
- "q" #'save-buffers-kill-terminal
- "c" #'+literate/compile-config
- "l" #'+literate/load-config
- "d" #'delete-frame)
-
- (search-leader "i" #'imenu))
+ (use-package emacs
+ :straight nil
+ :general
+ (general-def
+ "C-x d" #'delete-frame)
+
+ (nmmap
+ "C--" #'text-scale-decrease
+ "C-=" #'text-scale-increase)
+
+ (leader
+ "SPC" '(execute-extended-command :which-key "M-x")
+ "'" '(browse-url-emacs :which-key "Open url in Emacs")
+ "u" 'universal-argument
+ ";" 'eval-expression
+ ":" `(,(proc (interactive) (switch-to-buffer "*scratch*"))
+ :which-key "Switch to *scratch*")
+ "!" '(async-shell-command :which-key "Async shell command")
+ "h" '(help-command :which-key "Help"))
+
+ (mode-leader
+ "t" #'+oreo/switch-theme)
+
+ (code-leader
+ "F" (list (proc (interactive) (find-file "~/Code/")) ':which-key "Open ~/Code/"))
+
+ (file-leader
+ "f" #'find-file
+ "F" #'find-file-other-frame
+ "s" #'save-buffer
+ "p" (list (proc (interactive) (find-file (concat user-emacs-directory "config.org")))
+ ':which-key "Open config.org"))
+
+ (quit-leader
+ "q" #'save-buffers-kill-terminal
+ "c" #'+literate/compile-config
+ "l" #'+literate/load-config
+ "d" #'delete-frame)
+
+ (search-leader "i" #'imenu))
#+end_src
** Evil
My editor journey started off with Vim rather than Emacs, so my brain
@@ -698,7 +729,7 @@ Setup for counsel. Load after ivy and helpful.
[remap describe-bindings] #'counsel-descbinds
[remap load-theme] #'counsel-load-theme)
:config
- (setq ivy-initial-inputs-alist nil
+ (setq ivy-initial-inputs-alist '((org-insert-link . "^"))
counsel-describe-function-function #'helpful-callable
counsel-describe-variable-function #'helpful-variable
counsel-grep-swiper-limit 1500000
@@ -1000,36 +1031,27 @@ with abstracting a few things away.
(prog-mode-hook . abbrev-mode)
(text-mode-hook . abbrev-mode)
:init
- (defmacro +autotyping/deff-abbrev (ABBREV-TABLE ABBREV EXPANSION)
- "Wraps around define-abbrev to fill in some repeated stuff
-when expansion is a function."
- `(define-abbrev
- ,ABBREV-TABLE
- ,ABBREV
- ""
- (proc (insert ,EXPANSION))))
-
+ (defmacro +abbrev/define-abbrevs (abbrev-table &rest abbrevs)
+ `(progn
+ ,@(mapcar #'(lambda (abbrev)
+ `(define-abbrev
+ ,abbrev-table
+ ,(car abbrev)
+ ""
+ (proc (insert ,(cadr abbrev)))))
+ abbrevs)))
(setq save-abbrevs nil)
:config
- (+autotyping/deff-abbrev
+ (+abbrev/define-abbrevs
global-abbrev-table
- "sdate"
- (format-time-string "%Y-%m-%d" (current-time)))
-
- (+autotyping/deff-abbrev
- global-abbrev-table
- "stime"
- (format-time-string "%H:%M:%S" (current-time)))
-
- (+autotyping/deff-abbrev
- text-mode-abbrev-table
- "sday"
- (format-time-string "%A" (current-time)))
-
- (+autotyping/deff-abbrev
- text-mode-abbrev-table
- "smon"
- (format-time-string "%B" (current-time))))
+ ("sdate"
+ (format-time-string "%Y-%m-%d" (current-time)))
+ ("stime"
+ (format-time-string "%H:%M:%S" (current-time)))
+ ("sday"
+ (format-time-string "%A" (current-time)))
+ ("smon"
+ (format-time-string "%B" (current-time)))))
#+end_src
*** Skeletons
Defining some basic skeletons and a macro to help generate an abbrev
@@ -1225,8 +1247,9 @@ setups for programming without heavier packages like [[*Eglot][Eglot]].
Highlights the current line, much better than a blinking cursor.
#+begin_src emacs-lisp
(use-package hl-line
- :defer t
- :hook (text-mode-hook . hl-line-mode))
+ :straight t
+ :hook (text-mode-hook . hl-line-mode)
+ :hook (prog-mode-hook . hl-line-mode))
#+end_src
** Recentf
Recentf provides a method of keeping track of recently opened files.
@@ -2009,9 +2032,6 @@ don't need to write everything myself.
(display-buffer-same-window))
:general
(leader "g" '(magit-status :which-key "Magit"))
- (nmmap
- :keymaps 'magit-status-mode-map
- "TAB" #'magit-section-toggle)
:init
(setq vc-follow-symlinks t)
(with-eval-after-load "autoinsert"
@@ -2197,7 +2217,12 @@ flyspell-mode should be hooked to text-mode.
(nmmap
:keymaps 'text-mode-map
(kbd "M-C") #'flyspell-correct-word-before-point
- (kbd "M-c") #'flyspell-auto-correct-word))
+ (kbd "M-c") #'flyspell-auto-correct-word)
+ (local-leader
+ :keymaps 'flyspell-mode-map
+ "S" #'flyspell-region)
+ (mode-leader
+ "s" #'flyspell-mode))
#+end_src
*** Undo tree
Undo tree sits on top of the incredible Emacs undo capabilities.
@@ -2274,6 +2299,19 @@ context and easier to use.
(sp-local-pair sp-lisp-modes "(" ")" :unless '(:rem sp-point-before-same-p))
(require 'smartparens-config))
#+end_src
+*** Thesaurus
+=le-thesaurus= is a great extension for quickly searching up words for
+synonyms or antonyms. I may need it anywhere so I bind it to all
+keymaps.
+#+begin_src emacs-lisp
+(use-package le-thesaurus
+ :straight t
+ :general
+ (local-leader
+ :keymaps 'override
+ "[" #'le-thesaurus-get-synonyms
+ "]" #'le-thesaurus-get-antonyms))
+#+end_src
* Programming modes
Packages that help with programming in general, providing IDE like
capabilities.
@@ -2375,7 +2413,8 @@ I hook it to prog-mode.
:init
(setq hl-todo-keyword-faces
'(("TODO" . "#E50000")
- ("WAIT" . "#00CC00")
+ ("WIP" . "#ffa500")
+ ("NOTE" . "#00CC00")
("FIXME" . "#d02090"))))
#+end_src
** Hide-show mode
@@ -2398,160 +2437,135 @@ I give won't do it justice.
:hook
(prog-mode-hook . aggressive-indent-mode))
#+end_src
-* Languages
-Configuration for specific languages or file formats.
-** PDF
-I use PDFs mostly for reading reports or papers. Though Emacs isn't
-my preferred application for viewing PDFs (I highly recommend
-[[https://pwmt.org/projects/zathura/][Zathura]]), similar to most things with Emacs, having a PDF viewer
-builtin can be a very useful asset.
+* Org mode
+2023-03-30: finally decided to give org mode its own section.
+
+Org is, at its most basic, a markup language. Files use the ".org"
+extension and use =org-mode= to write text, with the ability to export
+to a few formats, all within Emacs. However, this is a massive
+disservice to its incredible capabilities:
++ Complete spreadsheet system, with formulas (including
+ [[*Calculator][calc-mode]] integration)
++ Evaluation of code blocks, even using the results of them in exports
+ (to, say, a $\LaTeX$ or HTML document)
+ + This includes exporting all code blocks of a document to a code
+ file, say all the emacs-lisp files in this document to ~config.el~
+ ([[file:elisp/literate.el][literate]])
++ Complete calendar/todo system with deadlines, scheduling and
+ repeaters
++ Export to a variety of formats or make your own export engine using
+ the org AST!
+ + Writing latex in document, with ability to render them on demand,
+ and exporting to PDFs through Latex
+** Aesthetic defaults
+Org has a ton of settings to tweak, which change your experience quite
+a bit. My setup should be as portable as possible and (/sometimes/) I
+need to access org mode files in other editors, so org files should be
+as close to clear text as possible. This is the guiding philosophy
+that essentially makes most of my options pretty immediate.
+
+Some arbitrary notes:
++ By default =~/Text= is my directory for text files. I actually have
+ a repository that manages this directory for agenda files and other
+ documents
++ Indentation in file should not be allowed, i.e. text indentation,
+ as that forces other editors to read it a certain way as well. It
+ seems obtrusive hence it's off.
++ Org startup indented is on by default as most documents do benefit
+ from the indentation, but I do turn it off for some files via
+ ~#+startup:noindent~
++ When opening an org document there can be a lot of headings, so I
+ set folding to just content
++ Org documents can also have a lot of latex previews, which make
+ opening some after a while a massive hassle. If I want to see the
+ preview, I'll do it myself, so turn it off.
++ Org manages windowing itself, to some extent, so I set those options
+ to be as unobtrusive as possible
-For example if I were editing an org document which I was eventually
-compiling into a PDF, my workflow would be much smoother with a PDF
-viewer within Emacs that I can open on another pane.
-*** PDF tools
-~pdf-tools~ provides the necessary functionality for viewing PDFs.
-There is no proper PDF viewing without this package.
-~evil-collection~ provides a setup for this mode, so use that.
#+begin_src emacs-lisp
-(use-package pdf-tools
- :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode)
- :straight t
+(use-package org
:defer t
- :display
- ("^.*pdf$"
- (display-buffer-same-window)
- (inhibit-duplicate-buffer . t))
- :config
- (pdf-tools-install-noverify)
- (with-eval-after-load "evil-collection"
- (evil-collection-pdf-setup)))
-#+end_src
-*** PDF grep
-PDF grep is a Linux tool that allows for searches against the text
-inside of PDFs similar to standard grep. This cannot be performed by
-standard grep due to how PDFs are encoded; they are not a clear text
-format.
-#+begin_src emacs-lisp
-(use-package pdfgrep
- :after pdf-tools
- :hook (pdf-view-mode-hook . pdfgrep-mode)
- :general
- (nmap
- :keymaps 'pdf-view-mode-map
- "M-g" #'pdfgrep))
-#+end_src
-** SQL
-The default SQL package provides support for connecting to common
-database types (sqlite, mysql, etc) for auto completion and query
-execution. I don't use SQL currently but whenever I need it it's
-there.
-#+begin_src emacs-lisp
-(use-package sql
- :straight nil
+ :straight t
:init
- (setq sql-display-sqli-buffer-function nil))
+ (setq
+ org-directory "~/Text"
+ org-adapt-indentation nil
+ org-indent-mode nil
+ org-startup-indented t
+ org-startup-folded 'content
+ org-startup-with-latex-preview nil
+ org-imenu-depth 10
+ org-src-window-setup 'current-window
+ org-indirect-buffer-display 'current-window
+ org-link-frame-setup '((vm . vm-visit-folder-other-frame)
+ (vm-imap . vm-visit-imap-folder-other-frame)
+ (file . find-file))))
#+end_src
-** Ada
-:PROPERTIES:
-:header-args:emacs-lisp: :tangle no
-:END:
-Check out [[file:elisp/ada-mode.el][ada-mode]], my custom ~ada-mode~ that replaces the default
-one. This mode just colourises stuff, and uses eglot and a language
-server to do the hard work.
-
+** Latex options
+Org mode has deep integration with latex, can export to PDF and even
+display latex fragments in the document directly. I setup the
+pdf-process, code listing options via minted and the format options
+for latex fragments.
#+begin_src emacs-lisp
-(use-package ada-mode
- :straight nil
- :load-path "elisp/"
+(use-package org
:defer t
- :config
- (with-eval-after-load "eglot"
- (add-hook 'ada-mode-hook #'eglot)))
-#+end_src
-** NHexl
-Hexl-mode is the inbuilt package within Emacs to edit hex and binary
-format buffers. There are a few problems with hexl-mode though,
-including an annoying prompt on /revert-buffer/.
-
-Thus, nhexl-mode! It comes with a few other improvements. Check out
-the [[https://elpa.gnu.org/packages/nhexl-mode.html][page]] yourself.
-#+begin_src emacs-lisp
-(use-package nhexl-mode
- :straight t
- :mode "\\.bin")
-#+end_src
-** Org
-Org mode
-*** Org Core Variables
+ :init
+ (setq org-format-latex-options '(:foreground default :background default :scale 2
+ :html-foreground "Black" :html-background "Transparent"
+ :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
+ org-latex-listings 'minted
+ org-latex-minted-langs '((emacs-lisp "common-lisp")
+ (ledger "text")
+ (cc "c++")
+ (cperl "perl")
+ (shell-script "bash")
+ (caml "ocaml"))
+ org-latex-packages-alist '(("" "minted"))
+ org-latex-pdf-process
+ '("latexmk -pdfxe -bibtex -f -shell-escape %f")
+ org-latex-minted-options '(("style" "colorful")
+ ("linenos")
+ ("frame" "single")
+ ("mathescape")
+ ("fontfamily" "courier")
+ ("samepage" "false")
+ ("breaklines" "true")
+ ("breakanywhere" "true"))))
+#+end_src
+** Org Core Variables
Tons of variables for org-mode, including a ton of latex ones. Can't
really explain because it sets up quite a lot of local stuff. Also I
copy pasted the majority of this, tweaking it till it felt good. Doom
Emacs was very helpful here.
#+begin_src emacs-lisp
(use-package org
- :defer t
- :custom
- (org-directory "~/Text")
- (org-edit-src-content-indentation 0)
- (org-goto-interface 'outline)
- (org-adapt-indentation nil)
- (org-indent-mode nil)
- (org-src-window-setup 'current-window)
- (org-indirect-buffer-display 'current-window)
- (org-export-backends '(ascii html latex odt icalendar))
- (org-imenu-depth 10)
- (org-link-frame-setup '((vm . vm-visit-folder-other-frame)
- (vm-imap . vm-visit-imap-folder-other-frame)
- (gnus . org-gnus-no-new-news)
- (file . find-file-other-frame)
- (wl . wl-other-frame)))
- (org-eldoc-breadcrumb-separator " → ")
- (org-enforce-todo-dependencies t)
- (org-fontify-quote-and-verse-blocks t)
- (org-fontify-whole-heading-line t)
- (org-footnote-auto-label 'plain)
- (org-hide-leading-stars t)
- (org-hide-emphasis-markers nil)
- (org-image-actual-width nil)
- (org-priority-faces '((?A . error) (?B . warning) (?C . success)))
- (org-startup-indented t)
- (org-startup-with-latex-preview t)
- (org-startup-folded 'content)
- (org-tags-column 0)
- (org-todo-keywords
- '((sequence "TODO" "DONE")
- (sequence "PROJ" "WAIT" "COMPLETE")))
- (org-use-sub-superscripts '{})
- (org-babel-load-languages '((emacs-lisp . t)
- (lisp . t)
- (C . t)
- (python . t)
- (shell . t)))
- (org-format-latex-options '(:foreground default :background default :scale 2
- :html-foreground "Black" :html-background "Transparent"
- :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
- (org-latex-listings 'minted)
- (org-latex-minted-langs '((emacs-lisp "common-lisp")
- (ledger "text")
- (cc "c++")
- (cperl "perl")
- (shell-script "bash")
- (caml "ocaml")))
- (org-latex-packages-alist '(("" "minted")))
- (org-latex-pdf-process
- '("latexmk -pdfxe -bibtex -f -shell-escape %f"))
- (setq org-latex-minted-options '(("style" "colorful")
- ("linenos")
- ("frame" "single")
- ("mathescape")
- ("fontfamily" "courier")
- ("samepage" "false")
- ("breaklines" "true")
- ("breakanywhere" "true")
- )))
-#+end_src
-*** Org Core Functionality
+ :init
+ (setq org-edit-src-content-indentation 0
+ org-goto-interface 'outline
+ org-imenu-depth 10
+ org-export-backends '(ascii html latex odt icalendar)
+ org-eldoc-breadcrumb-separator " → "
+ org-enforce-todo-dependencies t
+ org-fontify-quote-and-verse-blocks t
+ org-fontify-whole-heading-line t
+ org-footnote-auto-label t
+ org-hide-leading-stars t
+ org-hide-emphasis-markers nil
+ org-image-actual-width nil
+ org-priority-faces '((?A . error) (?B . warning) (?C . success))
+ org-link-descriptive nil
+ org-tags-column 0
+ org-todo-keywords
+ '((sequence "TODO" "WIP" "DONE")
+ (sequence "PROJ" "WAIT" "COMPLETE"))
+ org-use-sub-superscripts '{}
+ org-babel-load-languages '((emacs-lisp . t)
+ (lisp . t)
+ (C . t)
+ (python . t)
+ (shell . t))))
+#+end_src
+** Org Core Functionality
Hooks, prettify-symbols and records for auto insertion.
#+begin_src emacs-lisp
(use-package org
@@ -2574,7 +2588,7 @@ Hooks, prettify-symbols and records for auto insertion.
"#+date: " (format-time-string "%Y-%m-%d" (current-time)) "\n"
"* " _))))
#+end_src
-*** Org Core Bindings
+** Org Core Bindings
Some bindings for org mode.
#+begin_src emacs-lisp
(use-package org
@@ -2595,6 +2609,11 @@ Some bindings for org mode.
[remap imenu] #'+org/swiper-goto)
(local-leader
:keymaps 'org-mode-map
+ "l" '(nil :which-key "Links")
+ "'" '(nil :which-key "Tables")
+ "c" '(nil :which-key "Clocks"))
+ (local-leader
+ :keymaps 'org-mode-map
:infix "l"
"i" #'org-insert-link
"l" #'org-open-at-point)
@@ -2605,9 +2624,17 @@ Some bindings for org mode.
"f" #'org-table-edit-formulas
"t" #'org-table-toggle-coordinate-overlays
"s" #'org-table-sum
- "e" #'org-table-eval-formula)
+ "e" #'org-table-calc-current-TBLFM
+ "E" #'org-table-eval-formula)
+ (local-leader
+ :keymaps 'org-mode-map
+ "i" #'org-clock-clock-in
+ "o" #'org-clock-clock-out
+ "c" #'org-clock-in-last
+ "d" #'org-clock-display)
(local-leader
:keymaps 'org-mode-map
+ "d" #'org-date-from-calendar
"t" #'org-todo
"T" #'org-babel-tangle
"i" #'org-insert-structure-template
@@ -2616,17 +2643,17 @@ Some bindings for org mode.
"e" #'org-export-dispatch
"o" #'org-edit-special))
#+end_src
-*** Org agenda
+** Agenda
Org agenda provides a nice viewing for schedules. With org mode it's
a very tidy way to manage your time.
#+begin_src emacs-lisp
(use-package org-agenda
- :after (org evil)
+ :after org
:straight nil
:init
(defconst +org/agenda-root "~/Text"
"Root directory for all agenda files")
- (setq org-agenda-files (list (expand-file-name +org/agenda-root) (expand-file-name "~/Projects/lpv/"))
+ (setq org-agenda-files (list (expand-file-name +org/agenda-root))
org-agenda-window-setup 'current-window
org-agenda-skip-deadline-prewarning-if-scheduled t
org-agenda-skip-scheduled-if-done t
@@ -2641,7 +2668,7 @@ a very tidy way to manage your time.
:which-key "Open agenda directory"))
(app-leader
- "aa" #'org-agenda)
+ "a" #'org-agenda)
(nmmap
:keymaps 'org-agenda-mode-map
@@ -2658,7 +2685,7 @@ a very tidy way to manage your time.
"q" #'org-agenda-quit
"r" #'org-agenda-redo))
#+end_src
-*** Org clock-in
+** Org clock-in
Org provides a nice timekeeping system that allows for managing how
much time is taken per task. It even has an extensive reporting
system to see how much time you spend on specific tasks or overall.
@@ -2687,7 +2714,7 @@ time a clock out occurs.")
(setq-local +org/clock-out-toggle-report
(not +org/clock-out-toggle-report)))))
#+end_src
-*** Org on save
+** Org on save
If ~+org/compile-to-pdf-on-save-p~ is non-nil, then compile to
\(\LaTeX\) and run an async process to compile it to a PDF. Doesn't
make Emacs hang (like ~org-latex-export-to-pdf~) and doesn't randomly
@@ -2713,7 +2740,7 @@ crash (like the async handler for org-export). Works really well with
(start-process-shell-command "" "*pdflatex*" (concat "pdflatex -shell-escape "
(org-latex-export-to-latex)))))
#+end_src
-*** Org ref
+** Org ref
#+begin_src emacs-lisp
(use-package org-ref
:straight t
@@ -2723,7 +2750,17 @@ crash (like the async handler for org-export). Works really well with
bibtex-completion-bibliography '("~/Text/bibliography.bib")
bibtex-completion-additional-search-fields '(keywords)))
#+end_src
-*** Org message
+*** Org ref ivy integration
+Org ref requires ivy-bibtex to work properly with ivy, so we need to
+set that up as well
+#+begin_src emacs-lisp
+(use-package ivy-bibtex
+ :straight t
+ :after org-ref
+ :config
+ (require 'org-ref-ivy))
+#+end_src
+** Org message
Org message allows for the use of org mode when composing mails,
generating HTML multipart emails. This integrates the WYSIWYG
experience with mail in Emacs while also providing powerful text
@@ -2744,23 +2781,23 @@ learnt the basics of org).
preview-scale 1.4))))
(margin . "0 -0.35em")))))
#+end_src
-*** Org for evil
+** Org for evil
Evil org for some nice bindings.
#+begin_src emacs-lisp
(use-package evil-org
:hook (org-mode-hook . evil-org-mode))
#+end_src
-*** Org reveal
+** Org reveal
Org reveal allows one to export org files as HTML presentations via
reveal.js. Pretty nifty and it's easy to use.
#+begin_src emacs-lisp
(use-package ox-reveal
- :after org
+ :defer t
:init
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js"
org-reveal-theme "sky"))
#+end_src
-*** Org fragtog
+** Org fragtog
Toggle latex fragments in org mode so you get fancy maths symbols. I
use latex a bit in org mode as it is the premier way of getting
mathematical symbols rendered, but org mode > latex.
@@ -2772,13 +2809,96 @@ $\int_{-\infty}^{\infty}e^{-x^2}dx = \sqrt{\pi}$.
(use-package org-fragtog
:hook (org-mode-hook . org-fragtog-mode))
#+end_src
-*** Org superstar
+** Org superstar
Org superstar adds cute little Unicode symbols for headers, much
better than the default asterisks.
#+begin_src emacs-lisp
(use-package org-superstar
:hook (org-mode-hook . org-superstar-mode))
#+end_src
+* Languages
+Configuration for specific languages or file formats.
+** PDF
+I use PDFs mostly for reading reports or papers. Though Emacs isn't
+my preferred application for viewing PDFs (I highly recommend
+[[https://pwmt.org/projects/zathura/][Zathura]]), similar to most things with Emacs, having a PDF viewer
+builtin can be a very useful asset.
+
+For example if I were editing an org document which I was eventually
+compiling into a PDF, my workflow would be much smoother with a PDF
+viewer within Emacs that I can open on another pane.
+*** PDF tools
+~pdf-tools~ provides the necessary functionality for viewing PDFs.
+There is no proper PDF viewing without this package.
+~evil-collection~ provides a setup for this mode, so use that.
+#+begin_src emacs-lisp
+(use-package pdf-tools
+ :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode)
+ :straight t
+ :defer t
+ :display
+ ("^.*pdf$"
+ (display-buffer-same-window)
+ (inhibit-duplicate-buffer . t))
+ :config
+ (pdf-tools-install-noverify)
+ (with-eval-after-load "evil-collection"
+ (evil-collection-pdf-setup)))
+#+end_src
+*** PDF grep
+PDF grep is a Linux tool that allows for searches against the text
+inside of PDFs similar to standard grep. This cannot be performed by
+standard grep due to how PDFs are encoded; they are not a clear text
+format.
+#+begin_src emacs-lisp
+(use-package pdfgrep
+ :after pdf-tools
+ :hook (pdf-view-mode-hook . pdfgrep-mode)
+ :general
+ (nmap
+ :keymaps 'pdf-view-mode-map
+ "M-g" #'pdfgrep))
+#+end_src
+** SQL
+The default SQL package provides support for connecting to common
+database types (sqlite, mysql, etc) for auto completion and query
+execution. I don't use SQL currently but whenever I need it it's
+there.
+#+begin_src emacs-lisp
+(use-package sql
+ :straight nil
+ :init
+ (setq sql-display-sqli-buffer-function nil))
+#+end_src
+** Ada
+:PROPERTIES:
+:header-args:emacs-lisp: :tangle no
+:END:
+Check out [[file:elisp/ada-mode.el][ada-mode]], my custom ~ada-mode~ that replaces the default
+one. This mode just colourises stuff, and uses eglot and a language
+server to do the hard work.
+
+#+begin_src emacs-lisp
+(use-package ada-mode
+ :straight nil
+ :load-path "elisp/"
+ :defer t
+ :config
+ (with-eval-after-load "eglot"
+ (add-hook 'ada-mode-hook #'eglot)))
+#+end_src
+** NHexl
+Hexl-mode is the inbuilt package within Emacs to edit hex and binary
+format buffers. There are a few problems with hexl-mode though,
+including an annoying prompt on /revert-buffer/.
+
+Thus, nhexl-mode! It comes with a few other improvements. Check out
+the [[https://elpa.gnu.org/packages/nhexl-mode.html][page]] yourself.
+#+begin_src emacs-lisp
+(use-package nhexl-mode
+ :straight t
+ :mode "\\.bin")
+#+end_src
** C/C++
Setup for C and C++ modes via the cc-mode package. C and C++ are
great languages for general purpose programming. My preferred choice
@@ -2998,10 +3118,15 @@ Just setup a style and some pretty symbols.
** Haskell
Haskell is a static lazy functional programming language (what a
mouthful). It's quite a beautiful language and really learning it will
-change the way you think about programming.
+change the way you think about programming. However, my preferred
+functional language is still unfortunately Lisp so no extra brownie
+points there.
Here I configure the REPL for Haskell via the
-~haskell-interactive-mode~ as well.
+~haskell-interactive-mode~. I also load my custom package
+[[file:elisp/haskell-multiedit.el][haskell-multiedit]] which allows a user to create temporary
+~haskell-mode~ buffers that, upon completion, will run in the REPL.
+Even easier than making your own buffer.
#+begin_src emacs-lisp
(use-package haskell-mode
:hook
@@ -3150,7 +3275,8 @@ development on Emacs.
"s" #'+shell/toggle-sly
"c" #'sly-compile-file
"a" #'sly-apropos
- "d" #'sly-describe-symbol)
+ "d" #'sly-describe-symbol
+ "E" #'sly-eval-defun)
(local-leader
:keymaps 'lisp-mode-map
:infix "e"