summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2023-06-08 21:30:12 +0100
committerYann Herklotz <git@yannherklotz.com>2023-06-08 21:32:28 +0100
commit5e74e49d4695e79664df8ce6792fa19d122808cc (patch)
tree07aeb8256f77b1e7b9deac976776474f16f65649
parentcb6f423b0fa82c09c370323bafa50ab6756efcdb (diff)
downloadymh-emacs-5e74e49d4695e79664df8ce6792fa19d122808cc.tar.gz
ymh-emacs-5e74e49d4695e79664df8ce6792fa19d122808cc.zip
Add ox-context to submodules
-rw-r--r--.gitmodules3
-rw-r--r--init.el75
m---------packages/ox-context0
-rw-r--r--vanilla.el205
4 files changed, 282 insertions, 1 deletions
diff --git a/.gitmodules b/.gitmodules
index e69de29..4f71ec1 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "packages/ox-context"]
+ path = packages/ox-context
+ url = https://git.sr.ht/~ymherklotz/ox-context
diff --git a/init.el b/init.el
index 671988d..dfb226a 100644
--- a/init.el
+++ b/init.el
@@ -1224,7 +1224,9 @@ https://yannherklotz.com"))
(merlin-command "ocamlmerlin"))
(use-package citeproc
- :ensure t)
+ :ensure t
+ :custom
+ (org-cite-csl-styles-dir (expand-file-name "styles" "~/projects")))
(use-package org-super-agenda
:ensure t
@@ -1285,6 +1287,77 @@ https://yannherklotz.com"))
(use-package lua-mode
:ensure t)
+(use-package ox-context
+ :init
+ (unless (package-installed-p 'ox-context)
+ (package-install-file (expand-file-name "packages/ox-context" user-emacs-directory)))
+ :config
+ (add-to-list 'org-context-snippets-alist '("ymh-abstract" . "\\definestartstop
+ [abstract]
+ [before={\\midaligned{\\bf Abstract}
+ \\startnarrower[2*middle]},
+ after={\\stopnarrower
+ \\blank[big]}]"))
+ (add-to-list 'org-context-snippets-alist '("ymh-colours" . "\\definecolor[red] [darkred]
+\\definecolor[green] [darkgreen]
+\\definecolor[blue] [darkblue]
+\\definecolor[yellow] [darkyellow]
+\\definecolor[magenta][darkmagenta]
+\\definecolor[cyan] [darkcyan]
+
+\\definecolor[maincolor] [darkcyan]
+\\definecolor[extracolor][darkmagenta]
+
+\\setuptyping
+ [color=extracolor]
+\\setuptype
+ [color=extracolor]
+
+\\setuphead [chapter] [color=maincolor]
+\\setuphead [section] [color=maincolor]
+\\setuphead [subsection] [color=maincolor]
+\\setuphead [subsubsection][color=maincolor]"))
+ (add-to-list 'org-context-snippets-alist '("ymh-fonts" . "\\definefontfeature[default]
+ [mode=node,kern=yes,
+ liga=yes,tlig=yes,dlig=yes,hlig=no,calt=yes,
+ ccmp=yes,language=dflt,
+ protrusion=quality,
+ expansion=quality]
+
+%\\definefontfeature[default][default][protrusion=quality,expansion=quality]
+\\setupalign[hz,hanging,lesshyphenation,verytolerant]
+\\setupbodyfont[libertinus,12pt]"))
+ (add-to-list 'org-context-snippets-alist '("ymh-bib" . "\\usebtxdefinitions[aps]
+\\setupbtx[default:cite][alternative=authoryear]"))
+ (add-to-list 'org-context-snippets-alist '("ymh-interaction" . "\\setupinteraction[
+ color=maincolor,
+ contrastcolor=maincolor,
+ openaction=ToggleViewer,
+ focus=height,
+ click=yes,
+ style=\\rm,
+]"))
+ (add-to-list 'org-context-snippets-alist '("ymh-titleframed" . "\\defineframed
+ [titlepageframed]
+ [frame=off,align=middle]"))
+ (add-to-list 'org-context-snippets-alist '("ymh-first-noheader" . "\\definelayout[1][header=0px]
+\\definelayout[2][reset]"))
+ (add-to-list 'org-context-inner-templates-alist '("ymh-article" . "\\startalignment[middle]
+ \\dontleavehmode \\titlepageframed[foregroundstyle=\\ss\\bfd\\setupinterlinespace]
+ {\\documentvariable{metadata:title}} \\par
+ \\dontleavehmode \\titlepageframed[foregroundstyle=\\ss\\rmb\\setupinterlinespace]
+ {\\documentvariable{metadata:author}} \\par
+\\stopalignment
+
+%t
+%f
+%c
+%a
+%i
+%b
+%o"))
+ (add-to-list 'org-context-presets-alist '("ymh-article" . (:literal "\\usemodule[art-01]" :template "ymh-article" :snippets ("ymh-abstract" "ymh-colours" "ymh-fonts" "ymh-bib" "ymh-interaction" "ymh-titleframed" "ymh-first-noheader")))))
+
(setq gc-cons-threshold (* 1024 1024 10))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
diff --git a/packages/ox-context b/packages/ox-context
new file mode 160000
+Subproject ed789ca9b6678719e4047fc60300308763ba6ef
diff --git a/vanilla.el b/vanilla.el
new file mode 100644
index 0000000..3d82003
--- /dev/null
+++ b/vanilla.el
@@ -0,0 +1,205 @@
+(setq user-full-name "Yann Herklotz")
+(setq user-mail-address "yann@yannherklotz.com")
+
+(setq gc-cons-threshold (* 1024 1024 1024))
+
+;; Set some global key rebindings, mainly trying to use `*-dwim' functions
+;; whenever possible and making other common functions more convenient. The
+;; main keybinding that conflicts with other modes is `C-.' or `C-,'.
+(global-set-key (kbd "M-u") #'upcase-dwim)
+(global-set-key (kbd "M-l") #'downcase-dwim)
+(global-set-key (kbd "M-c") #'capitalize-dwim)
+(global-set-key (kbd "C-c z") #'quick-calc)
+(global-set-key (kbd "<f5>") #'revert-buffer)
+(global-set-key (kbd "C-.") #'other-window)
+(global-set-key (kbd "C-,") #'ymh/prev-window)
+(global-set-key (kbd "C-\\") #'undo-only)
+(global-set-key (kbd "M-SPC") (lambda () (interactive) (insert " ")))
+(global-set-key (kbd "C-<tab>") #'tab-bar-switch-to-recent-tab)
+
+(global-set-key (kbd "C-c l") #'org-store-link)
+(global-set-key (kbd "C-c c") #'org-capture)
+
+(define-key global-map (kbd "M-Q") #'ymh/unfill-paragraph)
+
+;; Create my own keymap for other, less important but still useful commands
+;; which I want to have quick access to. This can be quite flexible, and it
+;; might change depending on what I need or how the configuration changes.
+(define-prefix-command 'ymh-map)
+(global-set-key (kbd "C-c y") 'ymh-map)
+(define-key ymh-map (kbd "o") #'ymh/reset-coq-windows)
+(define-key ymh-map (kbd "c") #'calendar)
+(define-key ymh-map (kbd "C-l") #'org-agenda-open-link)
+(define-key ymh-map (kbd "C-p") #'org-previous-link)
+(define-key ymh-map (kbd "C-n") #'org-next-link)
+
+;; Create variables which hold default locations for various things like my Org
+;; directory or the directory containing the bibliography. This makes it much
+;; easier to migrate the configuration.
+(defvar ymh/org-base-dir "~/Dropbox/org"
+ "Contains the base directory for Org files.")
+
+(defvar ymh/keyboard :default
+ "Define which keyboard is being used.
+
+Should be one of `:white-split', `:modified' or `:default'")
+
+(defvar ymh/bib-base-dir "~/Dropbox/bibliography"
+ "Contains the base directory for the bibliography related files.")
+
+;; Define functions using the previous variables and `expand-file-name' to
+;; calculate the full path for any file correctly.
+(defun ymh/expand-org-file (file)
+ "Expand FILE name relative to `ymh/org-base-dir'."
+ (expand-file-name file ymh/org-base-dir))
+
+(defun ymh/expand-bib-file (file)
+ "Expand FILE name relative to `ymh/bib-base-dir'."
+ (expand-file-name file ymh/bib-base-dir))
+
+;; Set registers for commonly accessed files, especially org-mode files that
+;; will be edited a lot. In general, I use `org-capture' to edit the Org files
+;; in particular though.
+(set-register ?l (cons 'file (expand-file-name "init.el" user-emacs-directory)))
+(set-register ?m (cons 'file (ymh/expand-org-file "meetings.org")))
+(set-register ?i (cons 'file (ymh/expand-org-file "inbox.org")))
+(set-register ?p (cons 'file (ymh/expand-org-file "projects.org")))
+(set-register ?c (cons 'file (ymh/expand-org-file
+ (format-time-string "%Y-%m.org"))))
+
+;; Emacs 29 contains some packages that otherwise need to be downloaded from
+;; Melpa, and in addition to that it also allows for the installation of
+;; packages using git.
+(defvar ymh/emacs-29-p (version<= "29" emacs-version)
+ "Checks if the current Emacs version is 29 or not.")
+
+;; There are also some changes that are means for MacOS only, so it's useful to
+;; have a flag for that as well.
+(defvar ymh/macos-p (eq system-type 'darwin)
+ "Checks if the current operating system is MacOS.")
+
+;; Add linker arguments when compiling for macos.
+(when ymh/macos-p (customize-set-variable 'native-comp-driver-options '("-Wl,-w")))
+
+;; I currently use 80 as the default fill column width as it works on low-res
+;; displays as well.
+(setq-default fill-column 80)
+
+(setq completion-cycle-threshold 3)
+(setq tab-always-indent 'complete)
+
+;; Some simple configurations which make using the interface a bit nicer.
+(setq use-short-answers t)
+(setq inhibit-startup-message t)
+(setq confirm-nonexistent-file-or-buffer nil)
+(setq ring-bell-function 'ignore)
+
+;; I always end sentences in two spaces so that emacs can detect them easier.
+(setq sentence-end-double-space t)
+
+;; Follow symlinks when opening a file.
+(setq find-file-visit-truename t)
+(setq vc-follow-symlinks t)
+
+;; When you have two dired buffers open, it will copy them from one to the
+;; other automatically.
+(setq dired-dwim-target t)
+(setq wdired-allow-to-change-permissions t)
+
+;; Some performance improvements because I do not use right-to-left text.
+(setq truncate-partial-width-windows nil)
+(setq-default bidi-paragraph-direction 'left-to-right)
+(if (version<= "27.1" emacs-version)
+ (setq bidi-inhibit-bpa t))
+
+(setq read-extended-command-predicate
+ #'command-completion-default-include-p)
+
+(setq enable-recursive-minibuffers t)
+
+;; Clean up backup directories.
+(defvar --backup-directory)
+(setq --backup-directory (expand-file-name "backups" user-emacs-directory))
+(if (not (file-exists-p --backup-directory))
+ (make-directory --backup-directory t))
+(setq backup-directory-alist
+ `(("^/dev/shm/" . nil)
+ ("^/tmp/" . nil)
+ ("." . ,--backup-directory)))
+(setq make-backup-files t)
+(setq backup-by-copying t)
+(setq version-control t)
+(setq delete-old-versions t)
+(setq delete-by-moving-to-trash t)
+(setq kept-old-versions 6)
+(setq kept-new-versions 9)
+(setq auto-save-default t)
+(setq auto-save-timeout 20)
+(setq auto-save-interval 200)
+
+;; Setup some options to be able to use changelog mode.
+(setq add-log-full-name user-full-name)
+(setq add-log-mailing-address "git@yannherklotz.com")
+(setq change-log-default-name "CHANGELOG")
+(add-hook 'change-log-mode-hook
+ (lambda ()
+ (make-local-variable 'tab-width)
+ (make-local-variable 'left-margin)
+ (setq tab-width 2
+ left-margin 2)))
+
+;; Set indentation settings for various languages.
+(setq-default indent-tabs-mode nil)
+(setq-default tab-width 4)
+(setq-default python-indent-offset 4)
+(setq-default c-basic-offset 4)
+
+(setq line-number-display-limit 2000000)
+
+;; Remove the emacs border when on Linux.
+(unless ymh/macos-p
+ (setq default-frame-alist '((undecorated . t)
+ (drag-internal-border . 1)
+ (internal-border-width . 5))))
+
+(setq auth-sources '("~/.authinfo" "~/.authinfo.gpg" "~/.netrc"))
+
+;; Set visual new line indicators when using `visual-line-mode'.
+(setq visual-line-fringe-indicators '(left-curly-arrow nil))
+
+(unless ymh/macos-p
+ (menu-bar-mode -1))
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+(column-number-mode 1)
+
+(global-display-fill-column-indicator-mode)
+
+(add-hook 'text-mode-hook #'visual-line-mode)
+(add-hook 'text-mode-hook #'auto-fill-mode)
+
+;; Enable those
+(dolist (c '(overwrite-mode narrow-to-region narrow-to-page upcase-region
+ downcase-region))
+ (put c 'disabled nil))
+
+(set-frame-font "Iosevka YMHG Semibold-10" nil t)
+
+(add-to-list 'mode-line-misc-info
+ '(t ("[t:" (:eval (alist-get 'name (tab-bar--current-tab))) "] ")))
+
+;; Mac configuration
+(when ymh/macos-p
+ (cl-case ymh/keyboard
+ (:white-split (setq mac-right-option-modifier 'hyper
+ mac-command-modifier 'meta
+ mac-option-modifier 'super))
+ (:modified (setq mac-right-option-modifier 'meta
+ mac-command-modifier 'super
+ mac-option-modifier 'hyper))
+ (:default (setq mac-right-option-modifier 'hyper
+ mac-command-modifier 'meta
+ mac-option-modifier 'super)))
+ (add-hook 'ns-system-appearance-change-functions #'ymh/apply-theme))
+
+(provide 'vanilla)