2020-10-07 19:41:29 +00:00
|
|
|
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
|
|
|
;; clients, file templates and snippets.
|
2021-03-23 20:57:07 +00:00
|
|
|
(setq user-full-name "Janek"
|
2020-10-07 19:41:29 +00:00
|
|
|
user-mail-address "27jf@pm.me")
|
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
;;;; VISUALS
|
|
|
|
|
2020-10-07 19:41:29 +00:00
|
|
|
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
|
|
|
|
;; are the three important ones:
|
|
|
|
;;
|
|
|
|
;; + `doom-font'
|
|
|
|
;; + `doom-variable-pitch-font'
|
|
|
|
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
|
|
|
;; presentations or streaming.
|
|
|
|
;;
|
|
|
|
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
|
|
|
|
;; font string. You generally only need these two:
|
|
|
|
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
|
|
|
|
;; doom-variable-pitch-font (font-spec :family "sans" :size 13))
|
|
|
|
|
|
|
|
;; There are two ways to load a theme. Both assume the theme is installed and
|
|
|
|
;; available. You can either set `doom-theme' or manually load a theme with the
|
|
|
|
;; `load-theme' function. This is the default:
|
2021-02-25 17:36:51 +00:00
|
|
|
(setq doom-theme 'doom-one
|
2021-03-20 10:12:10 +00:00
|
|
|
doom-font (font-spec :family "monospace" :size 24 :weight 'semi-light)
|
|
|
|
doom-variable-pitch-font (font-spec :family "sans" :size 24))
|
2020-11-12 09:01:12 +00:00
|
|
|
|
2021-06-03 10:16:09 +00:00
|
|
|
(setq display-line-numbers-type 'relative
|
|
|
|
scroll-margin 7
|
|
|
|
hscroll-margin 20
|
|
|
|
)
|
|
|
|
|
2021-04-02 19:01:26 +00:00
|
|
|
(setq evil-respect-visual-line-mode nil)
|
|
|
|
(add-hook 'visual-line-mode-hook (lambda () (setq line-move-visual nil)))
|
2020-11-12 09:01:12 +00:00
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
;;;; BINDINGS
|
|
|
|
|
2021-05-07 10:32:04 +00:00
|
|
|
(defun xah-open-in-external-app (&optional @fname)
|
|
|
|
"Open the current file or dired marked files in external app.
|
|
|
|
When called in emacs lisp, if @fname is given, open that.
|
|
|
|
URL `http://ergoemacs.org/emacs/emacs_dired_open_file_in_ext_apps.html'
|
|
|
|
Version 2019-11-04 2021-02-16"
|
|
|
|
(interactive)
|
|
|
|
(let* (
|
|
|
|
($file-list
|
|
|
|
(if @fname
|
|
|
|
(progn (list @fname))
|
|
|
|
(if (string-equal major-mode "dired-mode")
|
|
|
|
(dired-get-marked-files)
|
|
|
|
(list (buffer-file-name)))))
|
|
|
|
($do-it-p (if (<= (length $file-list) 5)
|
|
|
|
t
|
|
|
|
(y-or-n-p "Open more than 5 files? "))))
|
|
|
|
(when $do-it-p
|
|
|
|
(cond
|
|
|
|
((string-equal system-type "windows-nt")
|
|
|
|
(mapc
|
|
|
|
(lambda ($fpath)
|
|
|
|
(shell-command (concat "PowerShell -Command \"Invoke-Item -LiteralPath\" " "'" (shell-quote-argument (expand-file-name $fpath )) "'")))
|
|
|
|
$file-list))
|
|
|
|
((string-equal system-type "darwin")
|
|
|
|
(mapc
|
|
|
|
(lambda ($fpath)
|
|
|
|
(shell-command
|
|
|
|
(concat "open " (shell-quote-argument $fpath)))) $file-list))
|
|
|
|
((string-equal system-type "gnu/linux")
|
|
|
|
(mapc
|
|
|
|
(lambda ($fpath) (let ((process-connection-type nil))
|
|
|
|
(start-process "" nil "xdg-open" $fpath))) $file-list))))))
|
2021-07-03 18:59:33 +00:00
|
|
|
|
2021-09-16 12:25:30 +00:00
|
|
|
(defun dragon (&optional file)
|
2021-07-03 18:59:33 +00:00
|
|
|
; Share file in current buffer via dragon
|
|
|
|
(interactive)
|
2021-09-16 12:25:30 +00:00
|
|
|
(shell-command (concat "dragon-drag-and-drop -a -x " (or file buffer-file-name)))
|
2021-07-03 18:59:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
;; rebing C-u - https://emacs.stackexchange.com/a/58320
|
|
|
|
(global-set-key (kbd "C-#") 'universal-argument)
|
|
|
|
(define-key universal-argument-map (kbd "C-#") 'universal-argument-more)
|
|
|
|
(global-set-key (kbd "C-*") 'universal-argument)
|
|
|
|
(define-key universal-argument-map (kbd "C-*") 'universal-argument-more)
|
|
|
|
|
2021-05-07 10:32:04 +00:00
|
|
|
(map! :leader
|
|
|
|
"u" 'evil-prev-buffer
|
|
|
|
"i" 'evil-next-buffer
|
|
|
|
"bq" 'doom/save-and-kill-buffer
|
|
|
|
"d" 'dragon
|
|
|
|
"#" 'xah-open-in-external-app
|
2021-03-30 16:15:44 +00:00
|
|
|
;; Buffer-local font resizing
|
2021-05-07 10:32:04 +00:00
|
|
|
:n
|
2021-07-04 16:20:36 +00:00
|
|
|
"M-C-+" 'text-scale-increase
|
2021-05-07 10:32:04 +00:00
|
|
|
"M-C--" 'text-scale-decrease
|
2021-03-30 16:15:44 +00:00
|
|
|
;; Frame-local font resizing
|
2021-07-04 16:20:36 +00:00
|
|
|
"C-=" 'doom/reset-font-size
|
|
|
|
"C-+" 'doom/increase-font-size
|
2021-05-07 10:32:04 +00:00
|
|
|
"C--" 'doom/decrease-font-size
|
2021-10-15 12:28:52 +00:00
|
|
|
:leader
|
|
|
|
"Se" '+snippets/edit
|
|
|
|
"Sm" 'smerge-mode
|
|
|
|
:map smerge-mode-map
|
|
|
|
:leader
|
|
|
|
"Ss" 'smerge-next
|
|
|
|
"Sn" 'smerge-next
|
|
|
|
"Sp" 'smerge-prev
|
|
|
|
"Sr" 'smerge-resolve
|
|
|
|
"SR" 'smerge-refine
|
|
|
|
"Su" 'smerge-keep-upper
|
|
|
|
"Si" 'smerge-keep-current
|
|
|
|
"So" 'smerge-keep-lower
|
2021-02-25 17:36:51 +00:00
|
|
|
)
|
2020-11-23 23:15:00 +00:00
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
;;;; GLOBAL SETUP
|
|
|
|
|
2021-02-25 17:36:51 +00:00
|
|
|
(setq confirm-kill-emacs nil)
|
2020-11-12 09:01:12 +00:00
|
|
|
|
2021-02-25 17:36:51 +00:00
|
|
|
(setq initial-major-mode 'org-mode)
|
2021-10-04 08:45:24 +00:00
|
|
|
(add-to-list 'auto-mode-alist '("/journal/" . org-mode))
|
2020-10-15 08:12:25 +00:00
|
|
|
|
2020-12-07 20:55:59 +00:00
|
|
|
(whitespace-mode 0)
|
2020-10-29 10:40:08 +00:00
|
|
|
|
2021-03-20 10:12:10 +00:00
|
|
|
(setq lazy-highlight-cleanup nil)
|
|
|
|
|
2021-10-04 08:45:24 +00:00
|
|
|
;;; UTF-8 encoding - https://zhangda.wordpress.com/2016/02/15/configurations-for-beautifying-emacs-org-mode/
|
|
|
|
;; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
|
|
|
|
(setq utf-translate-cjk-mode nil)
|
|
|
|
|
|
|
|
(set-language-environment 'utf-8)
|
|
|
|
(setq locale-coding-system 'utf-8)
|
|
|
|
|
|
|
|
;; set the default encoding system
|
|
|
|
(prefer-coding-system 'utf-8)
|
|
|
|
(setq default-file-name-coding-system 'utf-8)
|
|
|
|
(set-default-coding-systems 'utf-8)
|
|
|
|
(set-terminal-coding-system 'utf-8)
|
|
|
|
(set-keyboard-coding-system 'utf-8)
|
|
|
|
;; backwards compatibility as default-buffer-file-coding-system
|
|
|
|
;; is deprecated in 23.2.
|
|
|
|
(if (boundp buffer-file-coding-system)
|
|
|
|
(setq buffer-file-coding-system 'utf-8)
|
|
|
|
(setq default-buffer-file-coding-system 'utf-8))
|
|
|
|
|
|
|
|
;; Treat clipboard input as UTF-8 string first; compound text next, etc.
|
|
|
|
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
|
|
|
|
|
|
|
|
;; UNDO
|
2021-06-03 10:16:09 +00:00
|
|
|
(setq evil-want-fine-undo t)
|
|
|
|
(setq amalgamating-undo-limit 5)
|
|
|
|
|
2020-10-07 19:41:29 +00:00
|
|
|
;; Backups & auto-saves
|
2021-04-12 08:38:08 +00:00
|
|
|
;; Doom defaults: /home/janek/.config/emacs/core/core-editor.el::89
|
2021-02-24 11:19:09 +00:00
|
|
|
(setq auto-save-default t
|
|
|
|
auto-save-interval 40)
|
|
|
|
|
|
|
|
(setq make-backup-files t
|
|
|
|
backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/")))
|
|
|
|
delete-old-versions t
|
|
|
|
version-control t
|
|
|
|
vc-make-backup-files t
|
|
|
|
kept-new-versions 5
|
|
|
|
kept-old-versions 3
|
|
|
|
)
|
2020-10-07 19:41:29 +00:00
|
|
|
|
2020-11-12 09:01:12 +00:00
|
|
|
;; Data dirs
|
2020-10-07 19:41:29 +00:00
|
|
|
|
2021-10-11 08:01:22 +00:00
|
|
|
(defvar user-data-dir "~/data/" "Location of the main user data")
|
2020-10-07 19:41:29 +00:00
|
|
|
|
2020-10-12 20:13:22 +00:00
|
|
|
(load! "./local.el" nil t)
|
|
|
|
|
2021-05-05 06:49:50 +00:00
|
|
|
(setq org-directory (expand-file-name "2-standards/notes" user-data-dir)
|
|
|
|
default-directory org-directory
|
2021-05-19 19:47:57 +00:00
|
|
|
org-roam-directory (expand-file-name "roam" org-directory)
|
2021-05-05 06:49:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(setq org-journal-file-type 'weekly
|
|
|
|
org-journal-file-format "%Y%m%d.org"
|
|
|
|
org-journal-created-property-timestamp-format "[%Y-%m-%d]"
|
2021-05-19 19:47:57 +00:00
|
|
|
org-journal-carryover-delete-empty-journal 'always
|
2021-05-05 06:49:50 +00:00
|
|
|
)
|
2021-03-26 18:02:37 +00:00
|
|
|
|
2021-04-12 08:38:08 +00:00
|
|
|
(after! recentf
|
2021-10-13 17:13:07 +00:00
|
|
|
(setq recentf-keep '(or file-remote-p recentf-keep-default-predicate))
|
2021-04-12 08:38:08 +00:00
|
|
|
(add-to-list 'recentf-exclude "writing\\/tug")
|
2021-05-19 19:47:57 +00:00
|
|
|
(add-to-list 'recentf-exclude "\\.\\(sync\\|stversions\\|stfolder\\)")
|
2021-05-05 06:49:50 +00:00
|
|
|
)
|
2021-04-12 08:38:08 +00:00
|
|
|
|
2021-10-11 08:01:22 +00:00
|
|
|
(after! projectile
|
|
|
|
(push user-data-dir projectile-ignored-projects)
|
|
|
|
(let ((default-directory user-data-dir))
|
2021-10-13 17:13:07 +00:00
|
|
|
(add-to-list 'projectile-known-projects (expand-file-name "music/") t)
|
|
|
|
(add-to-list 'projectile-known-projects (expand-file-name "2-standards/notes/") t)
|
2021-10-11 08:01:22 +00:00
|
|
|
)
|
2021-06-30 16:25:43 +00:00
|
|
|
)
|
2021-10-11 08:01:22 +00:00
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
;;;; ORG
|
|
|
|
(after! org
|
2021-10-11 08:21:29 +00:00
|
|
|
;; Behavior
|
|
|
|
(set-file-template! 'org-mode :ignore t)
|
|
|
|
(setq org-read-date-prefer-future nil)
|
|
|
|
|
|
|
|
;; Visuals
|
|
|
|
; https?[0-z.\/-]*\.(png|jpg)\?[^?]*
|
|
|
|
(setq org-image-actual-width nil)
|
|
|
|
(setq org-ellipsis "↴")
|
|
|
|
|
|
|
|
;; Org startup - https://orgmode.org/manual/In_002dbuffer-Settings.html
|
|
|
|
(setq org-startup-folded 'show2levels
|
|
|
|
org-display-remote-inline-images 'cache)
|
|
|
|
|
|
|
|
;; Fix xdg-open & pdfs - https://depp.brause.cc/dotemacs/#orgd97f08c
|
|
|
|
(setq org-file-apps '((remote . emacs)
|
|
|
|
("\\.pdf\\'" . default)
|
|
|
|
(auto-mode . emacs)
|
|
|
|
(directory . emacs)
|
|
|
|
(system . "setsid -w xdg-open %s")
|
|
|
|
(t . system)))
|
|
|
|
|
|
|
|
;; Automated logging for todos - https://stackoverflow.com/questions/12262220/add-created-date-property-to-todos-in-org-mode/52815573#52815573
|
|
|
|
(setq org-log-done 'time
|
|
|
|
org-log-into-drawer t
|
|
|
|
org-treat-insert-todo-heading-as-state-change t)
|
2021-10-04 08:45:24 +00:00
|
|
|
|
|
|
|
;; https://stackoverflow.com/a/32353255/6723250
|
|
|
|
(defun org-convert-csv-table (beg end)
|
|
|
|
; convert csv to org-table considering "12,12"
|
|
|
|
(interactive (list (point) (mark)))
|
|
|
|
(replace-regexp "\\(^\\)\\|\\(\".*?\"\\)\\|," (quote (replace-eval-replacement
|
|
|
|
replace-quote (cond ((equal "^" (match-string 1)) "|")
|
|
|
|
((equal "," (match-string 0)) "|")
|
|
|
|
((match-string 2))) )) nil beg end))
|
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
(setq org-agenda-files
|
|
|
|
(apply 'append
|
|
|
|
(mapcar
|
|
|
|
(lambda (directory) (directory-files-recursively (expand-file-name directory user-data-dir) org-agenda-file-regexp))
|
2021-04-12 08:38:08 +00:00
|
|
|
'("1-projects" "2-standards")
|
2021-03-26 18:02:37 +00:00
|
|
|
)))
|
|
|
|
|
2021-03-30 18:29:08 +00:00
|
|
|
(defun org-todo-or-insert (&optional arg)
|
|
|
|
(interactive "P")
|
|
|
|
(if (org-at-heading-p) (org-todo arg) (org-insert-todo-heading arg t)))
|
|
|
|
|
2021-03-30 16:15:44 +00:00
|
|
|
(defun org-timestamp-up-week ()
|
|
|
|
(interactive)
|
2021-04-02 19:01:26 +00:00
|
|
|
(let ((current-prefix-arg '(7))) (call-interactively 'org-timestamp-up-day))
|
2021-03-30 18:29:08 +00:00
|
|
|
)
|
2021-03-30 16:15:44 +00:00
|
|
|
|
2021-04-07 18:27:22 +00:00
|
|
|
(defun org-export-repeat ()
|
|
|
|
(interactive)
|
|
|
|
(let ((current-prefix-arg '(4))) (call-interactively 'org-export-dispatch))
|
|
|
|
)
|
|
|
|
|
2021-04-19 08:39:08 +00:00
|
|
|
;; TODO name file according to subtree headline
|
2021-04-11 20:47:16 +00:00
|
|
|
(defun org-export-dispatch-custom-date ()
|
|
|
|
(interactive)
|
|
|
|
(let ((org-time-stamp-custom-formats
|
|
|
|
'("<%d.%m.%Y>" . "<%d.%m.%Y>"))
|
|
|
|
(org-display-custom-times 't))
|
|
|
|
(org-export-dispatch))
|
2021-07-29 10:03:31 +00:00
|
|
|
)
|
2021-04-11 20:47:16 +00:00
|
|
|
|
|
|
|
;; https://emacs.stackexchange.com/questions/38529/make-multiple-lines-todos-at-once-in-org-mode
|
|
|
|
(defun org-change-todo-in-region ()
|
|
|
|
(interactive)
|
|
|
|
(let ((scope (if mark-active 'region 'tree))
|
|
|
|
(state (org-fast-todo-selection))
|
|
|
|
(org-enforce-todo-dependencies nil))
|
|
|
|
(org-map-entries (lambda () (org-todo state)) nil scope)))
|
|
|
|
|
2021-09-20 19:29:19 +00:00
|
|
|
(defun org-yank-visible ()
|
|
|
|
(interactive)
|
|
|
|
(if mark-active (org-copy-visible) (org-copy-visible (point) (progn (end-of-line) (point)))))
|
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
(map! :map org-mode-map
|
2021-04-11 20:47:16 +00:00
|
|
|
:leader
|
|
|
|
"j" 'org-insert-heading
|
|
|
|
"e" 'org-export-dispatch-custom-date
|
|
|
|
"E" 'org-export-repeat
|
|
|
|
"\\" 'org-ctrl-c-ctrl-c
|
2021-03-26 18:02:37 +00:00
|
|
|
:localleader
|
|
|
|
"j" 'org-insert-heading
|
2021-04-12 17:22:58 +00:00
|
|
|
"k" 'org-latex-export-to-pdf
|
2021-03-30 16:15:44 +00:00
|
|
|
"t" 'org-todo-or-insert
|
2021-04-11 20:47:16 +00:00
|
|
|
"e" 'org-export-dispatch-custom-date
|
2021-04-07 18:27:22 +00:00
|
|
|
"E" 'org-export-repeat
|
2021-04-19 08:39:08 +00:00
|
|
|
"n" 'org-add-note
|
2021-09-20 19:29:19 +00:00
|
|
|
"y" 'org-yank-visible
|
2021-04-02 19:01:26 +00:00
|
|
|
"d=" 'org-timestamp-up-week
|
2021-04-11 20:47:16 +00:00
|
|
|
"rt" 'org-change-todo-in-region
|
2021-04-02 19:01:26 +00:00
|
|
|
"ra" 'org-change-tag-in-region
|
2021-06-14 18:37:10 +00:00
|
|
|
"lk" 'counsel-org-link
|
2021-07-06 00:01:11 +00:00
|
|
|
:desc "Set ID property" "lI" '(lambda () (interactive) (org-set-property "ID" nil))
|
2021-10-08 10:26:35 +00:00
|
|
|
:desc "Set Roam Aliases" "la" '(lambda () (interactive) (org-set-property "ROAM_ALIASES" nil))
|
2021-07-02 16:36:48 +00:00
|
|
|
"gR" 'org-mode-restart
|
2021-04-02 19:01:26 +00:00
|
|
|
)
|
2021-03-30 16:15:44 +00:00
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
(define-key org-mode-map (kbd "C-c .") 'org-time-stamp-inactive)
|
2021-09-16 12:25:30 +00:00
|
|
|
(define-key org-mode-map (kbd "C-c C-.") 'org-time-stamp)
|
2021-03-30 16:15:44 +00:00
|
|
|
(define-key org-mode-map (kbd "M-C-+") 'org-timestamp-up)
|
|
|
|
(define-key org-mode-map (kbd "M-C--") 'org-timestamp-down)
|
2021-03-26 18:02:37 +00:00
|
|
|
|
|
|
|
;; Toggle source blocks with C-c t
|
|
|
|
(defvar org-blocks-hidden nil)
|
|
|
|
(defun org-toggle-blocks ()
|
2021-04-11 20:47:16 +00:00
|
|
|
"Toggle all org blocks."
|
2021-03-26 18:02:37 +00:00
|
|
|
(interactive)
|
|
|
|
(if org-blocks-hidden
|
|
|
|
(org-show-block-all)
|
|
|
|
(org-hide-block-all))
|
|
|
|
(setq-local org-blocks-hidden (not org-blocks-hidden)))
|
|
|
|
(define-key org-mode-map (kbd "C-c t") 'org-toggle-blocks)
|
|
|
|
|
|
|
|
;; https://christiantietze.de/posts/2019/06/org-fold-heading/
|
|
|
|
(defun ct/org-foldup ()
|
|
|
|
"Hide the entire subtree from root headline at point."
|
|
|
|
(interactive)
|
|
|
|
(while (ignore-errors (outline-up-heading 1)))
|
|
|
|
(org-flag-subtree t))
|
|
|
|
|
|
|
|
(defun ct/org-shifttab (&optional arg)
|
|
|
|
(interactive "P")
|
|
|
|
(if (or (null (org-current-level)) ; point is before 1st heading, or
|
|
|
|
(and (= 1 (org-current-level)) ; at level-1 heading, or
|
|
|
|
(org-at-heading-p))
|
|
|
|
(org-at-table-p)) ; in a table (to preserve cell movement)
|
|
|
|
; perform org-shifttab at root level elements and inside tables
|
|
|
|
(org-shifttab arg)
|
|
|
|
; try to fold up elsewhere
|
|
|
|
(ct/org-foldup)))
|
|
|
|
(define-key org-mode-map (kbd "S-<tab>") 'ct/org-shifttab)
|
2021-04-11 20:47:16 +00:00
|
|
|
)
|
2021-03-30 18:29:08 +00:00
|
|
|
|
2021-04-11 20:47:16 +00:00
|
|
|
(after! ox
|
2021-06-24 10:46:58 +00:00
|
|
|
(setq org-latex-toc-command "\\tableofcontents*\n\n")
|
2021-04-11 20:47:16 +00:00
|
|
|
;; Insert linebreak after headings tagged with "newpage" when exporting through latex - https://emacs.stackexchange.com/a/30892
|
|
|
|
(defun org/get-headline-string-element (headline backend info)
|
|
|
|
(let ((prop-point (next-property-change 0 headline)))
|
|
|
|
(if prop-point (plist-get (text-properties-at prop-point headline) :parent))))
|
|
|
|
(defun org/ensure-latex-clearpage (headline backend info)
|
|
|
|
(when (org-export-derived-backend-p backend 'latex)
|
|
|
|
(let ((elmnt (org/get-headline-string-element headline backend info)))
|
|
|
|
(when (member "newpage" (org-element-property :tags elmnt))
|
|
|
|
(concat "\\clearpage\n" headline)))))
|
|
|
|
(add-to-list 'org-export-filter-headline-functions
|
|
|
|
'org/ensure-latex-clearpage)
|
2021-06-24 10:46:58 +00:00
|
|
|
|
|
|
|
;; Exporting - https://orgmode.org/manual/Export-Settings.html
|
2021-06-30 16:25:43 +00:00
|
|
|
(setq org-latex-pdf-process '("latexmk -shell-escape -outdir=/tmp/latexmk -f -pdf %F; mv %f /tmp/latexmk; mv /tmp/latexmk/%b.pdf %o") ; https://emacs.stackexchange.com/a/48351
|
2021-07-05 17:59:47 +00:00
|
|
|
org-latex-packages-alist '(("" "fullpage") ("avoid-all" "widows-and-orphans") ("" "svg"))
|
2021-06-30 16:25:43 +00:00
|
|
|
org-export-with-tags nil
|
2021-06-24 10:46:58 +00:00
|
|
|
org-export-with-tasks 'done
|
|
|
|
org-export-with-todo-keywords nil
|
|
|
|
org-export-with-toc nil
|
|
|
|
org-export-with-section-numbers nil
|
2021-10-11 08:21:29 +00:00
|
|
|
org-ascii-text-width 999999
|
2021-06-24 10:46:58 +00:00
|
|
|
)
|
2021-07-05 17:59:47 +00:00
|
|
|
|
2021-10-14 13:53:28 +00:00
|
|
|
(require 'ox-extra)
|
|
|
|
(ox-extras-activate '(ignore-headlines))
|
|
|
|
(require 'ox-latex)
|
2021-06-24 10:46:58 +00:00
|
|
|
(add-to-list 'org-latex-classes
|
|
|
|
'("shortreport" "\\documentclass[oneside]{memoir} \\chapterstyle{article}"
|
|
|
|
("\\chapter{%s}" . "\\chapter*{%s}")
|
|
|
|
("\\section{%s}" . "\\section*{%s}")
|
|
|
|
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
|
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
|
|
|
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
|
|
|
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
2020-10-12 20:13:22 +00:00
|
|
|
)
|
2021-02-25 11:24:50 +00:00
|
|
|
;; https://discord.com/channels/406534637242810369/406554085794381833/814175445004189706
|
2021-10-11 08:21:29 +00:00
|
|
|
;; Fix xdg-open after setting process-connection-type
|
|
|
|
;(setq process-connection-type nil)
|
2021-02-25 11:24:50 +00:00
|
|
|
;(after! org
|
|
|
|
; (add-to-list 'org-file-apps '(system . "setsid -w xdg-open %s"))
|
2021-02-24 11:19:09 +00:00
|
|
|
|
2021-03-26 18:02:37 +00:00
|
|
|
;;;; PACKAGES
|
2021-03-23 20:57:07 +00:00
|
|
|
|
2021-06-14 18:37:10 +00:00
|
|
|
(map! :map special-mode-map
|
2021-10-08 10:26:35 +00:00
|
|
|
"<tab>" 'other-window
|
|
|
|
"q" 'kill-this-buffer
|
|
|
|
:map nov-mode-map
|
2021-06-14 18:37:10 +00:00
|
|
|
"<tab>" 'other-window
|
|
|
|
"q" 'kill-this-buffer
|
|
|
|
:map image-mode-map
|
|
|
|
"<tab>" 'other-window
|
|
|
|
:n "+" 'image-increase-size
|
|
|
|
:n "-" 'image-decrease-size)
|
|
|
|
|
2021-10-11 08:01:22 +00:00
|
|
|
(setq eww-search-prefix "https://safe.duckduckgo.com/html/?q=")
|
|
|
|
|
|
|
|
(after! ivy
|
|
|
|
(ivy-define-key ivy-minibuffer-map (kbd "<S-return>") 'ivy-immediate-done)
|
|
|
|
)
|
|
|
|
|
2021-05-19 19:47:57 +00:00
|
|
|
(after! dired
|
2021-06-14 18:37:10 +00:00
|
|
|
;; Make dired open certain file types externally when pressing RET on a file https://pastebin.com/8QWYpCA2
|
|
|
|
;; Alternative: https://www.emacswiki.org/emacs/OpenWith
|
|
|
|
(defvar unsupported-mime-types
|
2021-09-16 12:25:30 +00:00
|
|
|
'("image/x-xcf")) ; "application/zip"))
|
2021-06-14 18:37:10 +00:00
|
|
|
(load "subr-x")
|
|
|
|
(defun get-mimetype (filepath)
|
|
|
|
(string-trim
|
2021-09-29 16:37:59 +00:00
|
|
|
(shell-command-to-string (concat "file -b --mime-type '" filepath "'"))))
|
2021-06-14 18:37:10 +00:00
|
|
|
|
2021-10-13 17:13:07 +00:00
|
|
|
(setq image-dired-external-viewer "gimp"
|
|
|
|
image-dired-thumb-size 300
|
|
|
|
image-dired-show-all-from-dir-max-files 300)
|
2021-10-11 08:01:22 +00:00
|
|
|
|
2021-07-29 10:03:31 +00:00
|
|
|
;;(let ((mime "image/x-xcf")) (msg mime))
|
|
|
|
|
2021-06-14 18:37:10 +00:00
|
|
|
(defun dired-find-file-dwim ()
|
|
|
|
(interactive)
|
|
|
|
(let* ((file (dired-get-filename nil t))
|
|
|
|
(mime (get-mimetype file)))
|
2021-09-29 16:37:59 +00:00
|
|
|
(if (or (string-prefix-p "audio" mime) (string-prefix-p "video" mime) (member mime unsupported-mime-types))
|
2021-06-14 18:37:10 +00:00
|
|
|
(call-process "xdg-open" nil 0 nil file)
|
|
|
|
(find-file file))))
|
|
|
|
|
2021-06-05 18:25:46 +00:00
|
|
|
(map! :map dired-mode-map
|
2021-06-14 18:37:10 +00:00
|
|
|
:n "RET" 'dired-find-file-dwim
|
2021-10-14 13:53:28 +00:00
|
|
|
:n "r" 'ranger
|
2021-09-16 12:25:30 +00:00
|
|
|
:leader
|
2021-10-14 13:53:28 +00:00
|
|
|
:desc "Dragon marked files" "d"
|
2021-10-13 17:13:07 +00:00
|
|
|
(lambda () (interactive) (dragon (s-join " " (dired-get-marked-files))))
|
2021-06-05 18:25:46 +00:00
|
|
|
:localleader
|
2021-10-11 08:01:22 +00:00
|
|
|
:desc "Compress/Extract" "c" 'dired-do-compress
|
2021-10-13 17:13:07 +00:00
|
|
|
:desc "Size information" "s"
|
|
|
|
(lambda () (interactive) (dired-smart-shell-command "s"))
|
2021-09-16 12:25:30 +00:00
|
|
|
:desc "Symlink to this" "l" 'dired-do-symlink
|
2021-10-13 17:13:07 +00:00
|
|
|
:desc "Open image-dired" "i"
|
|
|
|
(lambda () (interactive) (image-dired buffer-file-name))
|
2021-10-11 08:01:22 +00:00
|
|
|
:desc "Open image externally" "I" 'image-dired-dired-display-external
|
2021-10-14 13:53:28 +00:00
|
|
|
:desc "Start ranger" "r" 'ranger
|
|
|
|
:map wdired-mode-map
|
2021-07-06 00:01:11 +00:00
|
|
|
:n "RET" (lambda () (interactive) (progn
|
|
|
|
(wdired-exit)
|
|
|
|
(dired-find-file-dwim)))
|
2021-10-14 13:53:28 +00:00
|
|
|
:map ranger-mode-map
|
|
|
|
:n "r" 'ranger
|
2021-06-14 18:37:10 +00:00
|
|
|
)
|
|
|
|
|
2021-06-05 18:25:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(after! spell-fu
|
|
|
|
(remove-hook 'text-mode-hook #'spell-fu-mode)
|
2021-05-19 19:47:57 +00:00
|
|
|
)
|
2021-09-16 12:25:30 +00:00
|
|
|
(after! json-mode
|
|
|
|
(defconst json-mode-comments-re (rx (group "//" (zero-or-more nonl) line-end)))
|
|
|
|
(push (list json-mode-comments-re 1 font-lock-comment-face) json-font-lock-keywords-1)
|
|
|
|
)
|
|
|
|
|
|
|
|
(global-activity-watch-mode)
|
2021-05-19 19:47:57 +00:00
|
|
|
|
2021-10-11 08:01:22 +00:00
|
|
|
(after! tramp
|
|
|
|
(setq tramp-default-method "scpx")
|
|
|
|
(add-to-list 'tramp-methods
|
|
|
|
'("yadm"
|
|
|
|
(tramp-login-program "yadm")
|
|
|
|
(tramp-login-args (("enter")))
|
|
|
|
(tramp-login-env (("SHELL") ("/bin/sh")))
|
|
|
|
(tramp-remote-shell "/bin/sh")
|
|
|
|
(tramp-remote-shell-args ("-c"))))
|
|
|
|
(map! :leader
|
|
|
|
:desc "Yadm status" "gT" (lambda () (interactive) (magit-status "/yadm::")))
|
2021-05-02 18:32:42 +00:00
|
|
|
)
|
2020-11-26 19:34:08 +00:00
|
|
|
|
2021-02-23 19:15:42 +00:00
|
|
|
(use-package! evil-replace-with-register ; gr
|
|
|
|
:init
|
|
|
|
(setq evil-replace-with-register-key (kbd "gr"))
|
|
|
|
(evil-replace-with-register-install)
|
|
|
|
:config
|
2021-04-07 18:27:22 +00:00
|
|
|
(defun eval-paragraph ()
|
|
|
|
(interactive)
|
|
|
|
(er/mark-paragraph)
|
|
|
|
(call-interactively '+eval:region)
|
|
|
|
)
|
|
|
|
(map! :n "gR" 'eval-paragraph
|
|
|
|
:v "gR" '+eval/region)
|
2021-02-23 19:15:42 +00:00
|
|
|
)
|
2021-04-07 18:27:22 +00:00
|
|
|
|
2021-02-25 11:24:50 +00:00
|
|
|
(use-package! evil-args ; https://github.com/wcsmith/evil-args
|
|
|
|
:config
|
|
|
|
;; bind evil-args text objects
|
|
|
|
(define-key evil-inner-text-objects-map "a" 'evil-inner-arg)
|
|
|
|
(define-key evil-outer-text-objects-map "a" 'evil-outer-arg)
|
|
|
|
|
|
|
|
;; bind evil-forward/backward-args
|
|
|
|
(define-key evil-normal-state-map "L" 'evil-forward-arg)
|
|
|
|
(define-key evil-normal-state-map "H" 'evil-backward-arg)
|
|
|
|
(define-key evil-motion-state-map "L" 'evil-forward-arg)
|
|
|
|
(define-key evil-motion-state-map "H" 'evil-backward-arg)
|
|
|
|
|
|
|
|
;; bind evil-jump-out-args
|
|
|
|
(define-key evil-normal-state-map "K" 'evil-jump-out-args)
|
|
|
|
)
|
2021-05-19 19:47:57 +00:00
|
|
|
|
2021-04-02 19:01:26 +00:00
|
|
|
; (use-package evil-better-visual-line
|
|
|
|
; :ensure t
|
|
|
|
; :config
|
|
|
|
; (evil-better-visual-line-on))
|
2021-02-23 19:15:42 +00:00
|
|
|
|
2021-02-25 11:24:50 +00:00
|
|
|
(use-package! direnv ; nix-shell stuffs
|
2021-06-03 10:08:43 +00:00
|
|
|
:defer t
|
2021-02-25 11:24:50 +00:00
|
|
|
:config
|
|
|
|
(setq direnv-always-show-summary nil)
|
|
|
|
(direnv-mode)
|
|
|
|
)
|
2021-06-19 19:26:23 +00:00
|
|
|
|
2021-02-23 19:15:42 +00:00
|
|
|
(use-package! plantuml-mode ; Diagrams
|
2021-06-03 10:08:43 +00:00
|
|
|
:defer t
|
2021-02-23 19:15:42 +00:00
|
|
|
:config
|
2021-03-26 18:02:37 +00:00
|
|
|
(setq plantuml-executable-path "nostderr"
|
|
|
|
plantuml-executable-args '("plantuml" "-headless")
|
2021-05-02 17:38:09 +00:00
|
|
|
plantuml-default-exec-mode 'jar
|
2021-03-26 18:02:37 +00:00
|
|
|
plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar"
|
|
|
|
org-plantuml-jar-path plantuml-jar-path
|
|
|
|
plantuml-java-args '("-Djava.awt.headless=true" "-jar")
|
|
|
|
)
|
|
|
|
(after! org
|
2021-05-02 17:38:09 +00:00
|
|
|
(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))
|
2021-02-24 11:19:09 +00:00
|
|
|
)
|
2021-02-23 19:15:42 +00:00
|
|
|
)
|
|
|
|
(use-package! adoc-mode ; Asciidoc, a md alternative
|
2021-06-03 10:08:43 +00:00
|
|
|
:mode "\\.adoc\\'"
|
|
|
|
)
|
2021-05-31 16:48:18 +00:00
|
|
|
(use-package! nov
|
2021-06-03 10:08:43 +00:00
|
|
|
:mode ("\\.epub\\'" . nov-mode)
|
|
|
|
)
|
2021-09-16 12:25:30 +00:00
|
|
|
|
2021-08-09 22:34:14 +00:00
|
|
|
(use-package! chordpro-mode
|
2021-09-16 12:25:30 +00:00
|
|
|
:mode "\\.cho"
|
|
|
|
:config
|
|
|
|
(define-key chordpro-mode-map (kbd "C-c C-c") 'chordpro-insert-chord)
|
2021-08-09 22:34:14 +00:00
|
|
|
)
|
2021-05-19 19:47:57 +00:00
|
|
|
(use-package! lilypond-mode
|
2021-06-03 10:08:43 +00:00
|
|
|
:mode ("\\.ly\\'" . LilyPond-mode)
|
2021-05-19 19:47:57 +00:00
|
|
|
:config
|
|
|
|
(setq LilyPond-pdf-command "xdg-open")
|
|
|
|
(add-hook 'LilyPond-mode-hook 'turn-on-font-lock)
|
|
|
|
(add-hook 'pdf-view-mode-hook 'auto-revert-mode)
|
|
|
|
(setq auto-revert-interval 2)
|
2021-02-23 19:15:42 +00:00
|
|
|
)
|
2021-03-26 18:02:37 +00:00
|
|
|
|
2021-09-27 09:18:37 +00:00
|
|
|
(setq pdf-misc-print-programm "/usr/bin/lpr")
|
|
|
|
|
2021-05-19 19:47:57 +00:00
|
|
|
(setq custom-emacs-data-dir (expand-file-name "data" doom-private-dir))
|
|
|
|
(setq ispell-personal-dictionary (expand-file-name "personal-dictionary" custom-emacs-data-dir))
|
|
|
|
|
|
|
|
;(with-eval-after-load "ispell"
|
|
|
|
; (setq ispell-program-name "hunspell")
|
|
|
|
; (setq hunspell-default-dict "en_US")
|
|
|
|
; (setq ispell-dictionary "en_US,de_DE")
|
|
|
|
; ;; ispell-set-spellchecker-params has to be called
|
|
|
|
; ;; before ispell-hunspell-add-multi-dic will work
|
|
|
|
; (ispell-set-spellchecker-params)
|
|
|
|
; (ispell-hunspell-add-multi-dic ispell-dictionary)
|
|
|
|
; )
|
|
|
|
|
2020-10-07 19:41:29 +00:00
|
|
|
;; Here are some additional functions/macros that could help you configure Doom:
|
|
|
|
;;
|
|
|
|
;; - `load!' for loading external *.el files relative to this one
|
|
|
|
;; - `use-package!' for configuring packages
|
|
|
|
;; - `after!' for running code after a package has loaded
|
|
|
|
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
|
|
|
;; this file. Emacs searches the `load-path' when you load packages with
|
|
|
|
;; `require' or `use-package'.
|
|
|
|
;; - `map!' for binding new keys
|
|
|
|
;;
|
|
|
|
;; To get information about any of these functions/macros, move the cursor over
|
|
|
|
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
|
|
|
;; This will open documentation for it, including demos of how they are used.
|
|
|
|
;;
|
|
|
|
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
|
|
|
;; they are implemented.
|