config/doom: add some org mappings

This commit is contained in:
xerus2000 2021-04-11 22:47:16 +02:00
parent 08c0dd9b95
commit 4eab2b7363
2 changed files with 44 additions and 16 deletions

View File

@ -142,13 +142,35 @@
(let ((current-prefix-arg '(4))) (call-interactively 'org-export-dispatch)) (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 (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 :localleader
"j" 'org-insert-heading "j" 'org-insert-heading
"t" 'org-todo-or-insert "t" 'org-todo-or-insert
"e" 'org-export-dispatch-custom-date
"E" 'org-export-repeat "E" 'org-export-repeat
"d=" 'org-timestamp-up-week "d=" 'org-timestamp-up-week
"rt" 'org-todo-region "rt" 'org-change-todo-in-region
"ra" 'org-change-tag-in-region "ra" 'org-change-tag-in-region
) )
@ -159,7 +181,7 @@
;; Toggle source blocks with C-c t ;; Toggle source blocks with C-c t
(defvar org-blocks-hidden nil) (defvar org-blocks-hidden nil)
(defun org-toggle-blocks () (defun org-toggle-blocks ()
"Toggle all source code blocks." "Toggle all org blocks."
(interactive) (interactive)
(if org-blocks-hidden (if org-blocks-hidden
(org-show-block-all) (org-show-block-all)
@ -185,14 +207,20 @@
; try to fold up elsewhere ; try to fold up elsewhere
(ct/org-foldup))) (ct/org-foldup)))
(define-key org-mode-map (kbd "S-<tab>") 'ct/org-shifttab) (define-key org-mode-map (kbd "S-<tab>") 'ct/org-shifttab)
)
;; https://emacs.stackexchange.com/questions/38529/make-multiple-lines-todos-at-once-in-org-mode (after! ox
(defun org-todo-region () ;; Insert linebreak after headings tagged with "newpage" when exporting through latex - https://emacs.stackexchange.com/a/30892
(interactive) (defun org/get-headline-string-element (headline backend info)
(let ((scope (if mark-active 'region 'tree)) (let ((prop-point (next-property-change 0 headline)))
(state (org-fast-todo-selection)) (if prop-point (plist-get (text-properties-at prop-point headline) :parent))))
(org-enforce-todo-dependencies nil)) (defun org/ensure-latex-clearpage (headline backend info)
(org-map-entries (lambda () (org-todo state)) nil scope))) (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 ;; Behavior

View File

@ -34,15 +34,15 @@
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra ;;hydra
indent-guides ; highlighted indent columns indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API 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 ;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows (popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs tabs ; a tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages ;;unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB vi-tilde-fringe ; fringe tildes to mark beyond EOB
@ -62,12 +62,12 @@
;;parinfer ; turn lisp into python, sort of ;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates ;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to 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 :emacs
dired ; making dired pretty [functional] dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree vc ; version-control and Emacs, sitting in a tree