diff --git a/.config/doom/config.el b/.config/doom/config.el index 7d12798..95a36d4 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -142,13 +142,35 @@ (let ((current-prefix-arg '(4))) (call-interactively 'org-export-dispatch)) ) + (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)) + ) + + ;; 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))) + (map! :map org-mode-map + :leader + "j" 'org-insert-heading + "e" 'org-export-dispatch-custom-date + "E" 'org-export-repeat + "\\" 'org-ctrl-c-ctrl-c :localleader "j" 'org-insert-heading "t" 'org-todo-or-insert + "e" 'org-export-dispatch-custom-date "E" 'org-export-repeat "d=" 'org-timestamp-up-week - "rt" 'org-todo-region + "rt" 'org-change-todo-in-region "ra" 'org-change-tag-in-region ) @@ -159,7 +181,7 @@ ;; Toggle source blocks with C-c t (defvar org-blocks-hidden nil) (defun org-toggle-blocks () - "Toggle all source code blocks." + "Toggle all org blocks." (interactive) (if org-blocks-hidden (org-show-block-all) @@ -185,14 +207,20 @@ ; try to fold up elsewhere (ct/org-foldup))) (define-key org-mode-map (kbd "S-") 'ct/org-shifttab) +) - ;; https://emacs.stackexchange.com/questions/38529/make-multiple-lines-todos-at-once-in-org-mode - (defun org-todo-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))) +(after! ox + ;; 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) ) ;; Behavior diff --git a/.config/doom/init.el b/.config/doom/init.el index 69434d5..4dd7474 100644 --- a/.config/doom/init.el +++ b/.config/doom/init.el @@ -34,15 +34,15 @@ hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW ;;hydra indent-guides ; highlighted indent columns - ;;ligatures ; ligatures and symbols to make your code pretty again - ;;minimap ; show a map of the code on the side + ligatures ; ligatures and symbols to make your code pretty again + minimap ; show a map of the code on the side modeline ; snazzy, Atom-inspired modeline, plus API - ;;nav-flash ; blink cursor line after big motions + nav-flash ; blink cursor line after big motions ;;neotree ; a project drawer, like NERDTree for vim ophints ; highlight the region an operation acts on (popup +defaults) ; tame sudden yet inevitable temporary windows - ;;tabs ; a tab bar for Emacs - ;;treemacs ; a project drawer, like neotree but cooler + tabs ; a tab bar for Emacs + treemacs ; a project drawer, like neotree but cooler ;;unicode ; extended unicode support for various languages vc-gutter ; vcs diff in the fringe vi-tilde-fringe ; fringe tildes to mark beyond EOB @@ -62,12 +62,12 @@ ;;parinfer ; turn lisp into python, sort of ;;rotate-text ; cycle region at point between text candidates snippets ; my elves. They type so I don't have to - ;;word-wrap ; soft wrapping with language-aware indent + word-wrap ; soft wrapping with language-aware indent :emacs dired ; making dired pretty [functional] electric ; smarter, keyword-based electric-indent - ;;ibuffer ; interactive buffer management + ibuffer ; interactive buffer management undo ; persistent, smarter undo for your inevitable mistakes vc ; version-control and Emacs, sitting in a tree