-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.el
2633 lines (2295 loc) · 106 KB
/
config.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(setq user-full-name "Stefan Lendl"
user-mail-address "[email protected]")
(remove-hook 'org-mode-hook #'+literate-enable-recompile-h)
(defun stfl/goto-private-config-file ()
"Open your private config.el file."
(interactive)
(find-file (expand-file-name "config.org" doom-private-dir)))
(define-key! help-map
"dc" #'stfl/goto-private-config-file
"dC" #'doom/open-private-config)
;; (global-auto-revert-mode 1)
(setq undo-limit 80000000
evil-want-fine-undo t
inhibit-compacting-font-caches t)
(setq auto-save-default t)
(run-with-idle-timer 60 t '(lambda () (save-some-buffers t)))
(when (executable-find "brave")
(setq! browse-url-browser-function 'browse-url-chromium
browse-url-chromium-program "brave"))
(global-set-key [M-drag-mouse-2] #'mouse-drag-vertical-line)
;; (defun mouse-drag-left-line (start-event)
;; "Change the width of a window by dragging on a vertical line.
;; START-EVENT is the starting mouse event of the drag action."
;; (interactive "e")
;; (mouse-drag-line start-event 'left))
;; (global-set-key [left-fringe drag-mouse-1] #'mouse-drag-left-line)
(after! evil-snipe
(setq evil-snipe-scope 'visible
evil-snipe-repeat-scope 'visible))
(map! :leader "f ." #'find-file-at-point)
(setq! tab-always-indent 'complete)
(setq doom-theme 'doom-one)
(setq! display-line-numbers-type t)
(setq! which-key-idle-delay 0.3)
(let ((font "JetBrains Mono Nerd Font Mono"))
(setq doom-font (font-spec :family font :size 13)
doom-variable-pitch-font (font-spec :family font)
doom-big-font (font-spec :family font :size 20)))
(custom-declare-face '+org-priority-a '((t)) "")
(custom-declare-face '+org-priority-b '((t)) "")
(custom-declare-face '+org-priority-c '((t)) "")
(custom-declare-face '+org-priority-d '((t)) "")
(custom-declare-face '+org-priority-e '((t)) "")
(custom-declare-face '+org-priority-f '((t)) "")
(custom-declare-face '+org-priority-g '((t)) "")
(custom-declare-face '+org-priority-h '((t)) "")
(custom-declare-face '+org-priority-i '((t)) "")
(custom-declare-face '+org-todo-active '((t (:inherit (bold font-lock-constant-face org-todo)))) "")
(custom-declare-face '+org-todo-project '((t (:inherit (bold font-lock-doc-face org-todo)))) "")
(custom-declare-face '+org-todo-epic '((t (:inherit (bold org-cite org-todo)))) "")
(custom-declare-face '+org-todo-onhold '((t (:inherit (bold warning org-todo)))) "")
(custom-declare-face '+org-todo-next '((t (:inherit (bold font-lock-keyword-face org-todo)))) "")
(custom-declare-face 'org-checkbox-statistics-todo '((t (:inherit (bold font-lock-constant-face org-todo)))) "")
(custom-set-faces!
'(org-date :foreground "dark goldenrod" :height 0.85)
'(org-document-title :foreground "#c678dd" :weight bold :height 1.8)
'(org-drawer :foreground "dark gray" :height 0.8)
'(org-property-value :height 0.85)
'(org-ql-view-due-date :foreground "dark goldenrod")
'(org-special-keyword :foreground "#83898d" :height 0.8)
'(org-tag :foreground "#83898d" :weight light :height 0.7)
`(org-code :foreground ,(doom-lighten (doom-color 'warning) 0.3) :extend t)
'(outline-1 :height 1.5)
'(outline-2 :height 1.25)
'(outline-3 :height 1.15)
`(whitespace-indentation :background ,(doom-color 'base4)) ; Visually highlight if an indentation issue was discovered which emacs already does for us
`(magit-branch-current :foreground ,(doom-color 'blue) :box t)
'(lsp-inlay-hint-face :height 0.85 :italic t :inherit font-lock-comment-face)
`(+org-todo-cancel :foreground ,(doom-blend (doom-color 'red) (doom-color 'base5) 0.35) :inherit (bold org-done))
'(+org-priority-a :foreground "red3" :weight bold :height .95)
'(+org-priority-b :foreground "OrangeRed2" :weight bold)
'(+org-priority-c :foreground "DarkOrange2" :weight bold)
'(+org-priority-d :foreground "gold3" :weight bold)
'(+org-priority-e :foreground "OliveDrab1" :weight bold)
'(+org-priority-f :foreground "SpringGreen3" :weight bold)
'(+org-priority-g :foreground "cyan4" :weight bold)
'(+org-priority-h :foreground "DeepSkyBlue4" :weight bold)
'(+org-priority-i :foreground "LightSteelBlue3" :weight bold)
)
(after! org
(setq org-priority-faces
'((?A . +org-priority-a)
(?B . +org-priority-b)
(?C . +org-priority-c)
(?D . +org-priority-d)
(?E . +org-priority-e)
(?F . +org-priority-f)
(?G . +org-priority-g)
(?H . +org-priority-h)
(?I . +org-priority-i))))
(after! org
(auto-fill-mode))
(custom-set-faces!
'(adoc-code-face :inherit org-block)
'(adoc-complex-replacement-face :inherit org-code :bold t)
'(adoc-meta-face :inherit org-meta-line)
'(adoc-typewriter-face :inherit org-code)
'(adoc-verbatim-face :inherit org-verbatim)
'(adoc-internal-reference-face :inherit org-link)
'(adoc-reference-face :inherit org-link)
`(adoc-emphasis-face :foreground ,(doom-lighten (doom-color 'green) 0.2) :slant italic)
'(adoc-bold-face :bold t)
`(adoc-command-face :foreground ,(doom-color 'base1) :background ,(doom-color 'base6))
'(adoc-warning-face :inherit org-warning))
(custom-set-faces!
'(notmuch-message-summary-face :foreground "#848d94") ;; between dooms base6 and base7
`(notmuch-wash-cited-text :foreground ,(doom-color 'base6))
`(notmuch-search-subject :foreground ,(doom-darken (doom-color 'fg) 0.05))
'(notmuch-search-unread-face :weight bold :slant italic)
`(notmuch-tree-match-tree-face :foreground ,(doom-color 'yellow))
`(notmuch-tree-no-match-tree-face :foreground ,(doom-color 'base5))
`(notmuch-tree-no-match-author-face :foreground ,(doom-darken (doom-color 'blue) 0.3))
`(notmuch-tree-no-match-date-face :foreground ,(doom-darken (doom-color 'numbers) 0.3))
`(notmuch-tree-no-match-tag-face :foreground ,(doom-darken (doom-color 'yellow) 0.4)))
;; (set-popup-rules!
;; '(("^\\*subject:" :ignore t) ; notmuch list view
;; ("^CAPTURE" :side 'bottom :size 0.40 :select t :ttl nil)
;; ("^\\*Org Note" :side 'bottom :size 0.40 :select t :ttl nil)
;; ("^\\*Org QL View" :side 'left :size 0.40 :select t :quit nil)))
(set-popup-rule! "^\\*ein:" :ignore t :quit nil)
(custom-set-faces!
`(blamer-face :italic t :height 90 :weight semi-light :foreground ,(doom-color 'base5)))
(custom-set-faces!
`(blamer-face :inherit font-lock-comment-face
:italic t
:font "JetBrains Mono"
:height 0.9
:background unspecified
;; :weight semi-light
;; :foreground ,(doom-color 'base5)
))
;; (after! (solaire-mode demap)
(use-package! demap
:commands demap-toggle
:config
(setq demap-minimap-window-width 15)
(let ((gray1 "#1A1C22")
(gray2 "#21242b")
(gray3 "#282c34")
(gray4 "#2b3038") )
(face-spec-set 'demap-minimap-font-face
`((t :background ,gray2
:inherit unspecified
:family "minimap"
:height 10 )))
(face-spec-set 'demap-visible-region-face
`((t :background ,gray4
:inherit unspecified )))
(face-spec-set 'demap-visible-region-inactive-face
`((t :background ,gray3
:inherit unspecified )))
(face-spec-set 'demap-current-line-face
`((t :background ,gray1
:inherit unspecified )))
(face-spec-set 'demap-current-line-inactive-face
`((t :background ,gray1
:inherit unspecified ))))
;; (defun my-track-window-update-p()
;; "my minimap update predicate function.
;; minimaps only show windows in the same frame"
;; (and (demap-track-w-mode-update-p-func-default)
;; (get-buffer-window) ))
;; (setq demap-track-window-mode-update-p-func #'my-track-window-update-p)
(map!
:leader
:prefix ("t" "+toggle")
:desc "Minimap" "m" #'demap-toggle)
)
(after! highlight-indent-guides
(setq! highlight-indent-guides-auto-character-face-perc 20))
(pixel-scroll-precision-mode)
(setq! tab-width 8)
(setq org-directory "~/.org")
(after! org
(setq org-hide-emphasis-markers t
org-hide-leading-stars t
org-list-demote-modify-bullet '(("+" . "-") ("1." . "a.") ("-" . "+"))
org-ellipsis " ▼"
))
(after! org-id
(setq org-id-link-to-org-use-id t
org-id-locations-file (doom-path doom-local-dir "org-id-locations")
org-id-track-globally t))
(after! org-id (run-with-idle-timer 20 nil 'org-id-update-id-locations))
(after! org-roam (run-with-idle-timer 25 nil 'org-roam-update-org-id-locations))
(after! org (run-with-idle-timer 60 t #'org-save-all-org-buffers))
(after! org
(set-company-backend! 'org-mode
'(:separate company-capf
:separate company-org-roam
:separate company-yasnippet
:separate company-files)))
(after! org
(setq org-startup-indented 'indent
org-startup-folded 'fold
org-startup-with-inline-images t
;; org-image-actual-width (round (* (font-get doom-font :size) 25))
org-image-actual-width (* (default-font-width) 40)
))
(add-hook 'org-mode-hook 'org-indent-mode)
;; (add-hook 'org-mode-hook 'turn-off-auto-fill)
(defadvice! no-errors/+org-inline-image-data-fn (_protocol link _description)
:override #'+org-inline-image-data-fn
"Interpret LINK as base64-encoded image data. Ignore all errors."
(ignore-errors
(base64-decode-string link)))
;; (bind-key "<f6>" #'link-hint-copy-link)
(map! :after org
:map org-mode-map
:leader
:prefix ("n" . "notes")
:desc "Revert all org buffers" "R" #'org-revert-all-org-buffers
:desc "Revert all org buffers" "R" #'org-revert-all-org-buffers
)
;; Die sind eigentlich nicht org spezifisch
;; :desc "Outline" "o" #'counsel-outline
;; :desc "Counsel ripgrep" "d" #'counsel-rg
;; :desc "Swiper All" "@" #'swiper-all
(map! :after org
:map org-mode-map
:localleader
:desc "Revert all org buffers" "R" #'org-revert-all-org-buffers
"F" #'+org-fix-blank-lines
"N" #'org-add-note
:prefix ("l" . "links")
"o" #'org-open-at-point
"g" #'eos/org-add-ids-to-headlines-in-file
:prefix ("d" . "dates/deadlines")
"c" #'org-cancel-repeater
)
(after! org
(setq org-priority-default ?E)
(setq org-priority-lowest ?I))
(after! org-fancy-priorities
(setq org-fancy-priorities-list '("⛔" "𐱄" "▲" "ᐱ" "Ⲷ" "ᐯ" "▼" "𐠠" "҉")))
(defun stfl/build-my-someday-files ()
(file-expand-wildcards (doom-path org-directory "gtd/someday/*.org")))
(after! org
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 4)
(stfl/build-my-someday-files :maxlevel . 4))
org-refile-use-outline-path 'buffer-name
org-outline-path-complete-in-steps nil
org-refile-allow-creating-parent-nodes 'confirm))
(defun stfl/build-my-roam-files () (file-expand-wildcards (doom-path org-directory "roam/**/*.org")))
(defun stfl/refile-to-roam ()
(interactive)
(let ((org-refile-targets '((stfl/build-my-roam-files :maxlevel . 1))))
(call-interactively 'org-refile)))
(defun org-roam-create-note-from-headline ()
"Create an Org-roam note from the current headline and jump to it.
Normally, insert the headline’s title using the ’#title:’ file-level property
and delete the Org-mode headline. However, if the current headline has a
Org-mode properties drawer already, keep the headline and don’t insert
‘#+title:'. Org-roam can extract the title from both kinds of notes, but using
‘#+title:’ is a bit cleaner for a short note, which Org-roam encourages."
(interactive)
(let ((title (nth 4 (org-heading-components)))
(has-properties (org-get-property-block)))
(org-cut-subtree)
(org-roam-find-file title nil nil 'no-confirm)
(org-paste-subtree)
(unless has-properties
(kill-line)
(while (outline-next-heading)
(org-promote)))
(goto-char (point-min))
(when has-properties
(kill-line)
(kill-line))))
(after! org
(setq org-capture-templates
`(("n" "capture to inbox" entry
(file ,stfl/org-gtd-inbox-absolute)
(file ,(doom-path doom-private-dir "templates/template-inbox.org"))
:empty-lines-after 1)
("p" "Project" entry
(file ,stfl/org-gtd-inbox-absolute)
(file ,(doom-path doom-private-dir "templates/template-projects.org"))
:empty-lines-after 1)
("s" "scheduled" entry
(file ,stfl/org-gtd-inbox-absolute)
(file ,(doom-path doom-private-dir "templates/template-scheduled.org"))
:empty-lines-after 1)
("v" "Versicherung" entry
(file+headline ,(doom-path org-directory "versicherung.org") "Einreichungen")
(function stfl/org-capture-template-versicherung)
:root "~/Documents/Finanzielles/Einreichung Versicherung")
("S" "deadline" entry
(file ,stfl/org-gtd-inbox-absolute)
(file ,(doom-path doom-private-dir "templates/template-deadline.org"))
:empty-lines-after 1)
("P" "Protocol" entry
(file ,stfl/org-gtd-inbox-absolute)
"* %^{Title}\nSource: [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n:PROPERTIES:\n:CREATED: %U\n:END:\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n%?"
:empty-lines-after 1)
("L" "Protocol Link" entry
(file ,stfl/org-gtd-inbox-absolute)
"* [[%:link][%:description]]\n:PROPERTIES:\n:CREATED: %U\n:END:\n%?"
:empty-lines-after 1)
("h" "Haushalt")
("hw" "Wäsche" entry
(file+headline ,stfl/org-gtd-todo-absolute "Haushalt")
(file ,(doom-path doom-private-dir "templates/template-wäsche.org")))
))
)
(after! org-roam
(setq! org-roam-capture-templates
`(("d" "default" plain "%?"
:target (file+head ,(doom-path stfl/org-roam-absolute "%<%Y%m%d%H%M%S>-${slug}.org")
"#+title: ${title}\n")
:unnarrowed t))))
(after! org
(defun stfl/org-capture-versicherung-post ()
(unless org-note-abort
(mkdir (org-capture-get :directory) t)))
(defun stfl/build-versicherung-dir (root date title)
(let ((year (nth 5 (parse-time-string date))))
(format "%s/%d/%s %s" root year date title)))
(defun stfl/org-capture-template-versicherung ()
(interactive)
(let* ((date (org-read-date nil nil nil "Datum der Behandlung" nil nil t))
(title (read-string "Title: "))
(directory (stfl/build-versicherung-dir (org-capture-get :root) date title)))
(org-capture-put :directory directory)
(add-hook! 'org-capture-after-finalize-hook :local #'stfl/org-capture-versicherung-post)
(format "* OEGK [%s] %s
:PROPERTIES:
:CREATED: %%U
:date: [%s]
:betrag: %%^{Betrag|0}
:oegk: nil
:generali: nil
:category: %%^{Kategorie|nil|Arzt|Alternativ|Internet|Psycho|Besonders|Apotheke|Vorsorge|Heilbehelfe|Brille|Transport}
:END:
[[file:%s]]
%%?" date title date directory)))
)
(after! org (setq org-archive-location (doom-path org-directory "archive/%s::datetree")))
(use-package! org-habit
:after org-agenda
:config
(add-to-list 'org-modules 'org-habit)
(setq org-habit-show-habits t
org-habit-preceding-days 14
org-habit-following-days 7
;; org-habit-graph-column 31 ;; Length of the habit graph
))
(after! org-clock
(setq! org-clock-rounding-minutes 15 ;; Org clock should clock in and out rounded to 5 minutes.
org-time-stamp-rounding-minutes '(0 15)
org-duration-format 'h:mm ;; format hours and don't Xd (days)
org-clock-report-include-clocking-task t ;; include current task in the clocktable
org-log-note-clock-out t
org-agenda-clockreport-parameter-plist '(:link t :maxlevel 2 :stepskip0 t :fileskip0 t :hidefiles t :tags t)
org-clock-continuously t ;; clock-in from previous clock-out time
))
(use-package org-clock-csv
:after org
:commands +org-clock-project-csv-to-file)
(setq +org-clock-export-dir "~/work/invoice.typ/invoices")
(defun +org-clock-project-csv-to-file (project)
(interactive
(list (completing-read "Select project: " stfl/org-gtd-projects)))
(let* ((org-agenda-files (list (doom-path org-directory project)
(doom-path org-directory "archive" project)))
(filename (format "%s-org-clock-%s.csv" (format-time-string "%Y-%m") (file-name-base project)))
(filepath (doom-path +org-clock-export-dir filename)))
(org-clock-csv-to-file filepath)))
(map! :map org-mode-map
:localleader
:prefix "c"
:desc "Export project clock entries" "C" #'+org-clock-project-csv-to-file)
(use-package! org-edna
:after org
;; :hook org-mode-hook ;; load package after hook
;; :config (org-edna-mode) ;; enable after load
)
(add-hook! 'org-mode-hook #'org-edna-mode)
(defun stfl/trigger-next-sibling-NEXT ()
(interactive)
(org-entry-put nil "TRIGGER" "next-sibling todo!(NEXT)"))
(defun stfl/blocker-previous-sibling ()
(interactive)
(org-entry-put nil "BLOCKER" "previous-sibling"))
(defun stfl/trigger-next-and-blocker-previous ()
(interactive)
(stfl/trigger-next-sibling-NEXT)
(stfl/blocker-previous-sibling))
(map! :after org
:map org-mode-map
:localleader
:prefix ("d" . "date/dateline/dependencies")
:desc "next-sibling NEXT" "n" 'stfl/trigger-next-sibling-NEXT
:desc "trigger NEXT and block prev" "b" 'stfl/trigger-next-and-blocker-previous
)
(after! org
(setq org-todo-keywords
'((sequence
"TODO(t)" ; A task that needs doing & is ready to do
"NEXT(n)" ; Task is next to be worked on.
"STRT(s)" ; A task that is in progress
"WAIT(w)" ; Something external is holding up this task
"HOLD(h)" ; This task is paused/on hold because of me
"IDEA(i)" ; An unconfirmed and unapproved task or notion
"LOOP(r)" ; A recurring task
"PROJ(p)" ; Project with multiple task items.
"EPIC(e)" ; A set of Projects
"|"
"DONE(d@)" ; Task successfully completed
"KILL(k@)") ; Task was cancelled, aborted or is no longer applicable
(sequence
"[ ](T)" ; A task that needs doing
"[-](S)" ; Task is in progress
"[?](W)" ; Task is being held up or paused
"|"
"[X](D)") ; Task was completed
(sequence
"|"
"OKAY(o)"
"YES(y)"
"NO(x)"))
org-todo-keyword-faces
'(("[-]" . +org-todo-active)
("STRT" . +org-todo-active)
("NEXT" . +org-todo-next)
("[?]" . +org-todo-onhold)
("WAIT" . +org-todo-onhold)
("HOLD" . +org-todo-onhold)
("PROJ" . +org-todo-project)
("EPIC" . +org-todo-epic)
("NO" . +org-todo-cancel)
("KILL" . +org-todo-cancel))))
(after! org (setq org-indent-indentation-per-level 2))
(after! org (setq org-log-state-notes-insert-after-drawers nil))
(after! org
(setq org-log-into-drawer t
org-log-done 'time+note
org-log-repeat 'time
org-log-redeadline 'time
org-log-reschedule 'time
))
(after! org
(setq org-use-property-inheritance t ; We like to inherit properties from their parents
org-catch-invisible-edits 'error ; Catch invisible edits
org-track-ordered-property-with-tag t
org-hierarchical-todo-statistics nil
))
;; (use-package! org-modern
;; :after org
;; :config
;; (setq org-auto-align-tags nil
;; org-tags-column 0
;; org-catch-invisible-edits 'show-and-error
;; org-special-ctrl-a/e t
;; org-insert-heading-respect-content t
;; ;; Org styling, hide markup etc.
;; org-hide-emphasis-markers t
;; org-pretty-entities t
;; org-ellipsis "…"
;; ;; Agenda styling
;; org-agenda-block-separator ?─
;; org-agenda-time-grid '((daily today require-timed)
;; (800 1000 1200 1400 1600 1800 2000)
;; " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
;; org-agenda-current-time-string "⭠ now ─────────────────────────────────────────────────")
;; )
;; (add-hook 'org-mode-hook #'org-modern-mode)
;; (add-hook 'org-agenda-finalize-hook #'org-modern-agenda)
(after! org
(setq org-tag-alist '((:startgrouptag)
("Context" . nil)
(:grouptags)
("@home" . ?h)
("@office". ?o)
("@sarah" . ?s)
("@kg" . ?k)
("@jg" . ?j)
;; ("@robert" . ?r)
;; ("@baudock_meeting" . ?b)
;; ("@PC" . ?p)
;; ("@phone" . ?f)
(:endgrouptag)
(:startgrouptag)
("Process" . nil)
(:grouptags)
("SOMEDAY" . ?S)
;; ("REFILE" . ?R)
("HABIT" . ?H)
("LASTMILE" . ?L)
("DRAG" . ?D)
(:endgrouptag)
(:startgrouptag)
("Areas" . nil)
(:grouptags)
("#work" . ?$)
("#personal" . ?_)
("emacs" . ?-)
)))
(after! org
(setq! org-tag-faces `(("LASTMILE" . (:foreground ,(doom-color 'red) :strike-through t))
("HABIT" . (:foreground ,(doom-darken (doom-color 'orange) 0.2)))
("SOMEDAY" . (:slant italic :bold t))
;; ("finance" . (:foreground "goldenrod"))
;; ("#inbox" . (:background ,(doom-color 'base4) :foregorund ,(doom-color 'base8)))
("#inbox" . (:strike-through t))
("3datax" . (:foreground ,(doom-color 'green)))
("oebb" . (:foreground ,(doom-color 'green)))
("pulswerk" . (:foreground ,(doom-color 'dark-blue)))
("#work" . (:foreground ,(doom-color 'blue)))
;; ("#work" . (:foreground ,(doom-color 'blue)))
("@ikea" . (:foreground ,(doom-color 'yellow)))
("@amazon" . (:foreground ,(doom-color 'yellow)))
;; ("emacs" . (:foreground "#c678dd"))
))
)
(after! org-roam
(setq org-roam-tag-sources '(prop last-directory)
org-roam-directory org-directory
org-roam-db-location (doom-path doom-local-dir "roam.db")
org-roam-file-exclude-regexp "\.org/\(?jira\\|\.stversions\)/"))
(after! org-roam
(setq +org-roam-open-buffer-on-find-file nil))
(after! org-roam
(setq org-roam-dailies-capture-templates
'(("d" "default"
entry "* %?\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n\n"
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))))
(use-package! websocket
:after org-roam)
(use-package! org-roam-ui
:after org-roam ;; or :after org
;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
;; a hookable mode anymore, you're advised to pick something yourself
;; if you don't care about startup time, use
;; :hook (after-init . org-roam-ui-mode)
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
(after! org-gcal
;; (use-package! org-gcal
(setq org-gcal-client-id (get-auth-info "org-gcal-client-id" "[email protected]")
org-gcal-client-secret (get-auth-info "org-gcal-client-secret" "[email protected]")
org-gcal-fetch-file-alist
`(("[email protected]" . ,(doom-path org-directory "gcal/stefan.org"))
("[email protected]" . ,(doom-path org-directory "gcal/oskar.org")))
org-gcal-token-file "~/.config/authinfo/org-gcal-token.gpg"
org-gcal-down-days 180
;; org-gcal-auto-archive nil ;; workaround for "rx "**" range error" https://github.com/kidd/org-gcal.el/issues/17
))
(map!
:after (org org-gcal)
:map org-mode-map
:leader
(:prefix ("n" . "notes")
(:prefix ("j" . "sync")
:desc "sync Google Calendar" "g" #'org-gcal-sync)))
(map!
:after (org org-gcal)
:map org-mode-map
:localleader
:prefix ("C" . "Google Calendar")
:desc "sync Google Calendar" "g" #'org-gcal-sync
"S" #'org-gcal-sync-buffer
"p" #'org-gcal-post-at-point
"d" #'org-gcal-delete-at-point
"f" #'org-gcal-fetch
"F" #'org-gcal-fetch-buffer)
(use-package! ob-mermaid
:after org
:init
(setq ob-mermaid-cli-path "/home/stefan/.yarn/bin/mmdc")
:config
(add-to-list 'org-babel-load-languages '(mermaid . t)))
(use-package! org-jira
:after org
:init (setq org-jira-working-dir (doom-path org-directory "jira/")
jiralib-url "https://pulswerk.atlassian.net")
;; (defconst org-jira-progress-issue-flow
;; '(("To Do" . "In Progress"
;; ("In Progress" . "Done"))))
:config
(setq org-jira-jira-status-to-org-keyword-alist '(("To Do" . "TODO")
("Planned" . "NEXT")
("In Progress" . "NEXT")
("Staging" . "DONE")
("Ready" . "DONE")
("Done" . "DONE")
("Released" . "DONE"))
org-jira-priority-to-org-priority-alist (list (cons "Highest" ?A)
(cons "High" ?C)
;; (cons "Medium" ?E) ;; no org priority for /default/
(cons "Low" ?E)
(cons "Lowest" ?F))
org-jira-custom-jqls '((:jql "
assignee='Stefan Lendl'
AND (Sprint in openSprints()
OR (Project = MD
AND status != Done))
ORDER BY priority, created DESC
"
:limit 300
:filename "active")))
(map!
:map org-mode-map
:localleader
:prefix ("j" . "Jira")
:desc "Get issues from JQL" "j" #'org-jira-get-issues-from-custom-jql
"n" #'org-jira-create-issue
"t" #'org-jira-progress-issue
"T" #'org-jira-progress-issue-next
"a" #'org-jira-assign-issue
"r" #'org-jira-refresh-issue
"b" #'org-jira-refresh-issues-in-buffer
"u" #'org-jira-update-issue
"S" #'org-jira-create-subtask
"s" #'org-jira-get-subtasks
"N" #'org-jira-todo-to-jira
(:prefix ("w" . "Worklogs")
"c" #'org-jira-update-worklogs-from-org-clocks
"u" #'org-jira-update-worklogs
"i" #'org-jira-update-worklogs-for-issue)
(:prefix ("c" . "Comments")
:desc "Add Comment" "c" #'org-jira-add-comment
:desc "Update Comment" "u" #'org-jira-update-comment))
(map!
:map org-jira-map
:leader
(:prefix ("n" . "notes")
(:prefix ("j" . "sync")
:desc "Get issues from JQL" "j" #'org-jira-get-issues-from-custom-jql))))
(add-transient-hook! #'org-babel-execute-src-block
(require 'ob-async))
(defvar org-babel-auto-async-languages '()
"Babel languages which should be executed asyncronously by default.")
(defadvice! org-babel-get-src-block-info-eager-async-a (orig-fn &optional light datum)
"Eagarly add an :async parameter to the src information, unless it seems problematic.
This only acts o languages in `org-babel-auto-async-languages'.
Not added when either:
+ session is not \"none\"
+ :sync is set"
:around #'org-babel-get-src-block-info
(let ((result (funcall orig-fn light datum)))
(when (and (string= "none" (cdr (assoc :session (caddr result))))
(member (car result) org-babel-auto-async-languages)
(not (assoc :async (caddr result))) ; don't duplicate
(not (assoc :sync (caddr result))))
(push '(:async) (caddr result)))
result))
(after! org
(defun individual-visibility-source-blocks ()
"Fold some blocks in the current buffer with property :hidden"
(interactive)
(org-show-block-all)
(org-block-map
(lambda ()
(let ((case-fold-search t))
(when (and
(save-excursion
(beginning-of-line 1)
(looking-at org-block-regexp))
(cl-assoc
':hidden
(cl-third
(org-babel-get-src-block-info))))
(org-hide-block-toggle))))))
(add-hook 'org-mode-hook #'individual-visibility-source-blocks))
;; (after! org
;; (setcar org-emphasis-regexp-components "-[:space:]('\"{[:alpha:]") ; post
;; (setcar (nthcdr 1 org-emphasis-regexp-components) "[:alpha:]-[:space:].,:!?;'\")}\\[") ; pre
;; (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
;; )
;; (use-package! org-pandoc-import :after org)
(after! org-tree-slide (setq org-tree-slide-heading-emphasis nil))
(after! org-tree-slide
(add-hook 'org-tree-slide-play-hook #'doom-disable-line-numbers-h)
(add-hook 'org-tree-slide-stop-hook #'doom-disable-line-numbers-h))
(after! org-tree-slide
(remove-hook 'org-tree-slide-play-hook #'+org-present-hide-blocks-h)
(remove-hook 'org-tree-slide-stop-hook #'+org-present-hide-blocks-h))
(map! :after org
:map org-mode-map
:leader
(:prefix ("n" . "notes")
(:prefix ("j" . "sync")
:desc "resolve syncthing conflicts" "c" #'stfl/resolve-orgzly-syncthing
)))
(defun stfl/resolve-orgzly-syncthing ()
(interactive)
(let ((org-startup-folded 'showeverything)
(org-inhibit-startup t)
(org-hide-drawer-startup nil))
(ibizaman/syncthing-resolve-conflicts org-directory)))
(defun ibizaman/syncthing-resolve-conflicts (directory)
"Resolve all conflicts under given DIRECTORY."
(interactive "D")
(let* ((all (ibizaman/syncthing--get-sync-conflicts directory))
(chosen (ibizaman/syncthing--pick-a-conflict all)))
(ibizaman/syncthing-resolve-conflict chosen)))
(defun ibizaman/syncthing-show-conflicts-dired (directory)
"Open dired buffer at DIRECTORY showing all syncthing conflicts."
(interactive "D")
(find-name-dired directory "*.sync-conflict-*"))
(defun ibizaman/syncthing-resolve-conflict-dired (&optional arg)
"Resolve conflict of first marked file in dired or close to point with ARG."
(interactive "P")
(let ((chosen (car (dired-get-marked-files nil arg))))
(ibizaman/syncthing-resolve-conflict chosen)))
(defun ibizaman/syncthing-resolve-conflict (conflict)
"Resolve CONFLICT file using ediff."
(let* ((normal (ibizaman/syncthing--get-normal-filename conflict)))
(ibizaman/ediff-files
(list conflict normal)
`(lambda ()
(when (y-or-n-p "Delete conflict file? ")
(kill-buffer (get-file-buffer ,conflict))
(delete-file ,conflict))))))
(defun ibizaman/syncthing--get-sync-conflicts (directory)
"Return a list of all sync conflict files in a DIRECTORY."
(seq-filter (lambda (o) (not (string-match "\\.stversions" o))) (directory-files-recursively directory "\\.sync-conflict-")))
(defvar ibizaman/syncthing--conflict-history nil
"Completion conflict history")
(defun ibizaman/syncthing--pick-a-conflict (conflicts)
"Let user choose the next conflict from CONFLICTS to investigate."
(completing-read "Choose the conflict to investigate: " conflicts
nil t nil ibizaman/syncthing--conflict-history))
(defun ibizaman/syncthing--get-normal-filename (conflict)
"Get non-conflict filename matching the given CONFLICT."
(replace-regexp-in-string "\\.sync-conflict-.*\\(\\..*\\)$" "\\1" conflict))
(defun ibizaman/ediff-files (&optional files quit-hook)
(interactive)
(lexical-let ((files (or files (dired-get-marked-files)))
(quit-hook quit-hook)
(wnd (current-window-configuration)))
(if (<= (length files) 2)
(let ((file1 (car files))
(file2 (if (cdr files)
(cadr files)
(read-file-name
"file: "
(dired-dwim-target-directory)))))
(if (file-newer-than-file-p file1 file2)
(ediff-files file2 file1)
(ediff-files file1 file2))
(add-hook 'ediff-after-quit-hook-internal
(lambda ()
(setq ediff-after-quit-hook-internal nil)
(when quit-hook (funcall quit-hook))
(set-window-configuration wnd))))
(error "no more than 2 files should be marked"))))
;;;###autoload
(defun +org-fix-blank-lines (&optional prefix)
"Ensure that blank lines exist between headings and between headings and their contents.
With prefix, operate on whole buffer. Ensures that blank lines
exist after each headings's drawers."
(interactive "P")
(org-map-entries (lambda ()
(let ((heading (org-get-heading t t t t)))
;; (message "Heading: %s" heading)
(org-with-wide-buffer
;; `org-map-entries' narrows the buffer, which prevents us from seeing
;; newlines before the current heading, so we do this part widened.
(cond ((looking-back "^\\*+[^\n]*\n+" nil)
(while (looking-back "\n\n" nil)
;; (message "deleting all empty line in empty subtree")
(backward-char 1)
(delete-char 1)))
((looking-back "\n\n\n+" nil)
(while (looking-back "\n\n\n" nil)
;; (message "deleting double empty lines")
(backward-char 1)
(delete-char 1)))
((not (looking-back "\n\n" nil))
;; (message "inserting newline before heading")
(insert "\n"))))
(let ((end (org-entry-end-position)))
;; (message "Insert blank lines before entry content")
(forward-line)
(if (and (org-at-planning-p)
(< (point) (point-max)))
;; Skip planning lines
(forward-line))
;; FIXME if there are ONLY planning lines, and now drawer, no \n is inserted
(while (re-search-forward org-drawer-regexp end t)
;; Skip drawers. You might think that `org-at-drawer-p' would suffice, but
;; for some reason it doesn't work correctly when operating on hidden text.
;; This works, taken from `org-agenda-get-some-entry-text'.
(re-search-forward "^[ \t]*:END:.*\n?" end t)
(goto-char (match-end 0)))
(unless (or (= (point) (point-max))
(org-at-heading-p)
(looking-at-p "\n"))
;; (message "Insert after drawer")
(insert "\n"))))
t (if prefix
nil
'tree)))
(save-excursion
(goto-char (point-max)) ; Move to end of buffer
(cond ((looking-back "^\\*+[^\n]*\n+" nil)
(while (looking-back "\n\n" nil)
(backward-char 1)
(delete-char 1)))
((looking-back "\n\n\n+" nil)
(while (looking-back "\n\n\n" nil)
(backward-char 1)
(delete-char 1)))
((not (looking-back "\n\n" nil))
(insert "\n"))))
(message "Fixed blank lines in org buffer"))
(after! org
(add-hook 'before-save-hook
(lambda ()
(when (and (eq major-mode 'org-mode))
(+org-fix-blank-lines 4)))))
(after! ws-butler
(pushnew! ws-butler-global-exempt-modes
'org-mode))
(map! :after org-agenda
:map org-agenda-mode-map
:desc "Prioity up" "C-S-k" #'org-agenda-priority-up
:desc "Prioity down" "C-S-j" #'org-agenda-priority-down
:localleader
"N" #'org-agenda-add-note
:desc "Filter" "f" #'org-agenda-filter
:desc "Follow" "F" #'org-agenda-follow-mode
"o" #'org-agenda-set-property
:prefix ("p" . "priorities")
:desc "Prioity" "p" #'org-agenda-priority
:desc "Prioity up" "u" #'org-agenda-priority-up
:desc "Prioity down" "d" #'org-agenda-priority-down
:desc "Someday/Maybe toggle" "s" #'stfl/org-agenda-toggle-someday
:desc "Add to Someday/Maybe" "S" #'stfl/org-agenda-set-someday
:desc "Tickler toggle" "t" #'stfl/org-agenda-toggle-tickler
:desc "Add to Tickler" "T" #'stfl/org-agenda-set-tickler
:desc "Remove Someday/Maybe" "r" #'stfl/org-agenda-remove-someday
:prefix ("v" . "View up to priority")
"v" #'stfl/org-agenda-show-priorities
"l" #'stfl/org-agenda-show-less-priorities
"m" #'stfl/org-agenda-show-more-priorities
"r" #'stfl/org-agenda-reset-show-priorities
)
(map! :after org-ql
:map org-ql-view-map
"z" #'org-ql-view-dispatch)
;; (after! org
(setq!
;; org-agenda-dim-blocked-tasks t
org-agenda-dim-blocked-tasks 'invisible
org-agenda-use-time-grid t
;; org-agenda-hide-tags-regexp "\\w+"
;; org-agenda-compact-blocks t
;; org-agenda-block-separator ?\n
org-agenda-block-separator ?-
org-agenda-tags-column 0
org-agenda-skip-scheduled-if-done t
org-agenda-skip-unavailable-files t
org-agenda-skip-deadline-if-done t
org-agenda-skip-timestamp-if-done t
org-agenda-window-setup 'current-window
org-agenda-start-on-weekday nil
org-agenda-span 'day
org-agenda-start-day "-0d"
org-deadline-warning-days 7
org-agenda-show-future-repeats t
org-agenda-skip-deadline-prewarning-if-scheduled t