-
Notifications
You must be signed in to change notification settings - Fork 1
/
.spacemacs
1981 lines (1753 loc) · 80.9 KB
/
.spacemacs
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
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(cl-defun ap/org-capture-web-page-with-eww-readable
(&optional url
(filter-fns '(remove-dos-crlf ; This function should always be first and should always be included
ap/org-remove-html-blocks-from-string)))
(let* ((url (or url (ap/get-first-url-in-kill-ring)))
(html (ap/url-html url))
(result (ap/eww-readable html))
(title (cdr result))
(title-linked (org-make-link-string url title))
(content (with-temp-buffer
(insert (car result))
;; Convert to Org with Pandoc
(unless (= 0 (call-process-region (point-min) (point-max)
"pandoc" t t nil "--no-wrap"
"-f" "html" "-t" "org"))
(error "Pandoc failed."))
;; Demote page headings in capture buffer to below the
;; top-level Org heading and "Article" 2nd-level heading
(save-excursion
(goto-char (point-min))
(while (re-search-forward (rx bol (1+ "*") (1+ space)) nil t)
(beginning-of-line)
(insert "**")
(end-of-line)))
(buffer-string)))
(timestamp (format-time-string (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]"))))
(when filter-fns
(dolist (fn filter-fns)
(setq content (funcall fn content))))
(concat title-linked " :website:\n\n" timestamp "\n\n** Article\n\n" content)))
(defun remove-dos-crlf (&optional s)
"Remove all DOS CRLF (^M) in buffer or in string S."
(interactive)
(if s
(replace-regexp-in-string (string ?\C-m) "" s
'fixedcase 'literal)
(save-excursion
(goto-char (point-min))
(while (search-forward (string ?\C-m) nil t)
(replace-match "")))))
(defun ap/org-remove-html-blocks-from-string (s)
"Remove \"#+BEGIN_HTML...#+END_HTML\" blocks from Org-formatted string S."
(replace-regexp-in-string (rx (optional "\n") "#+BEGIN_HTML" (minimal-match (1+ anything)) "#+END_HTML" (optional "\n"))
"" s 'fixedcase 'literal))
(defun org-mpv-complete-link (&optional arg)
(replace-regexp-in-string
"^file:" "mpv:"
(org-file-complete-link arg)
t t))
;; (org-link-set-parameters
;; "mpv"
;; :follow #'mpv-play
;; :complete #'org-mpv-complete-link)
(defun org-timer-item--mpv-insert-playback-position (fun &rest args)
"When no org timer is running but mpv is alive, insert playback position."
(if (and
(not org-timer-start-time)
(mpv-live-p))
(mpv-insert-playback-position t)
(apply fun args)))
(defun org-ioslide-publish-to-html (plist filename pub-dir)
"Publish an Org file to google io slide.
FILENAME is the filename of the Org file to be published. PLIST
is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
;; Unlike to `org-latex-publish-to-latex', HTML file is generated
;; in working directory and then moved to publishing directory.
(org-publish-attachment
plist
(org-latex-compile
(org-publish-org-to
'ioslide filename ".html" plist (file-name-directory filename)))
pub-dir))
(defun init-org-agenda()
;; Common settings for all reviews
(setq efs/org-agenda-review-settings
'((org-agenda-files '("~/org"
"~/Nextcloud/org"
"~/Calendars"))
;; "~/org/wiki/regelwerk"
;; "~/org/wiki/pe" ))
(org-agenda-show-all-dates t)
(org-agenda-start-with-log-mode t)
(org-agenda-start-with-clockreport-mode t)
(org-agenda-archives-mode t)
;; I don't care if an entry was archived
(org-agenda-hide-tags-regexp
(concat org-agenda-hide-tags-regexp
"\\|ARCHIVE"))
))
;; Show the agenda with the log turn on, the clock table show and
;; archived entries shown. These commands are all the same exept for
;o the time period.
(add-to-list 'org-agenda-custom-commands
`("Rw" "Week in review"
agenda ""
;; agenda settings
,(append
efs/org-agenda-review-settings
'((org-agenda-span 'week)
(org-agenda-start-on-weekday 0)
(org-agenda-overriding-header "Week in Review"))
)
("~/org/review/week.html")
))
(add-to-list 'org-agenda-custom-commands
`("Rd" "Day in review"
agenda ""
;; agenda settings
,(append
efs/org-agenda-review-settings
'((org-agenda-span 'day)
(org-agenda-overriding-header "Week in Review"))
)
("~/org/review/day.html")
))
(add-to-list 'org-agenda-custom-commands
`("Rm" "Month in review"
agenda ""
;; agenda settings
,(append
efs/org-agenda-review-settings
'((org-agenda-span 'month)
(org-agenda-start-day "01")
(org-read-date-prefer-future nil)
(org-agenda-overriding-header "Month in Review"))
)
("~/org/review/month.html")
))
)
;; (require 'ox-confluence)
(defun init-org-export()
(eval-after-load 'ox
'(progn
(require 'ox-koma-letter)
(require 'ox-deck)
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines)))
))
(defun init-org-templates()
(setq org-capture-templates
'(("ort/checkitem" "Org Repo Checklist Item" checkitem
(file+headline
(ort/todo-file)
"Checklist"))
("ort/todo" "Org Repo Todo" entry
(file+headline
(ort/todo-file)
"Todos")
"* TODO %? %T\n %i\n Link: %l\n")
("a" "Appointment" entry
(file+headline "~/org/taskdiary.org" "Calendar")
"* APPT %^{Description} %^g\n%?\nAdded: %U")
("n" "Notes" entry
(file+datetree "~/org/taskdiary.org")
"* %^{Description} %^g %?\nAdded: %U")
("t" "todo" entry (file+headline "~/org/TODO.org" "Tasks")
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")
("T" "Task Diary" entry
(file+datetree "~/org/taskdiary.org")
"* TODO %^{Description} %^g\n%?\nAdded: %U")
("j" "Journal entry" plain
(file+otp+datetree+prompt "~/org/personal/journal.org")
"%K - %a\n%i\n%?\n")
("J" "Work Journal" entry
(file+datetree "~/org/workjournal.org")
"** %^{Heading}")
("b" "capture through org protocol" entry
(file+headline org-board-capture-file "Unsorted")
"* %?%:description\n:PROPERTIES:\n:URL: %:link\n:END:\n\n Added %U")
;; (file+olp (concat org-directory "/ff-notes.org") "Web")
;; (file+olp "~/org/ff-notes.org" "Web")
;; "* %c :website:\n%U %?%:initial")
("v" "Capture Web site with eww-readable" entry
(file "~/org/articles.org")
"%(org-web-tools--url-as-readable-org)")
("w" "Web site" entry
(file "~/org/ff-notes.org")
"* %a :website:\n\n%U %?\n\n%:initial")
;; ("w" "Firefox Capture Template" entry
;; (file+headline "ff-notes.org" "Firefox")
;; "* BOOKMARKS %T\n%c\%a\n%i\n Notes:%?" :prepend t :jump-to-captured t :empty-lines-after 1 :unnarrowed t)
("l" "Log Time" entry
(file+datetree "~/org/timelog.org")
"** %U - %^{Activity} :TIME:")))
(eval-after-load 'ox-koma-letter
'(progn
(add-to-list 'org-latex-classes
'("my-letter"
"\\documentclass\{scrlttr2\}
\\usepackage[ngerman]{babel}
\\setkomavar{frombank}{(1234)\\,567\\,890}
\[DEFAULT-PACKAGES]
\[PACKAGES]
\[EXTRA]"))
(add-to-list 'org-latex-classes
'("anotherletter"
"\\documentclass\{scrlttr2\}
\\usepackage[ngerman]{babel}
\\setkomavar{frombank}{(1234)\\,567\\,890}
\[DEFAULT-PACKAGES]
\[PACKAGES]
\[EXTRA]"))
(setq org-koma-letter-default-class "my-letter")))
(eval-after-load 'ox-cv
'(progn
(add-to-list 'org-latex-classes
'("mymoderncv"
"\\documentclass\{moderncv\}
\\moderncvtheme[blue]{banking}
\[NO-DEFAULT-PACKAGES]
\[NO-PACKAGES]
\[EXTRA]"))
(setq org-export-before-parsing-hook '(ox-cv-export-parse-employment))))
(eval-after-load 'ox-latex
'(progn
(setq org-latex-listings 'minted)
(add-to-list 'org-latex-packages-alist '("" "minted"))
;; export single chapter
(add-to-list 'org-latex-classes
'("chapter" "\\documentclass[11pt]{report}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(add-to-list 'org-latex-classes
'("titledblocks" "\\documentclass[11pt]{scrartcl}"
("\\paragraph{%s}" . "\\paragraph*{%s}")))
(add-to-list 'org-latex-classes
'("scrartcl" "\\documentclass[11pt]{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(add-to-list 'org-latex-classes
'("scrreprt" "\\documentclass[11pt]{scrreprt}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(add-to-list 'org-latex-classes
'("scrbook" "\\documentclass[11pt]{scrbook}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(add-to-list 'org-latex-classes
`("scrlttr2"
,(concat "\\documentclass\[a4paper\]\{scrlttr2\}\n"
"\[NO-DEFAULT-PACKAGES]\n"
"\[NO-PACKAGES]\n"
"\\usepackage\{fixltx2e\}\n"
"\\usepackage\{fontspec\}\n"
"\\usepackage\{microtype\}\n"
"\\usepackage\{polyglossia\}\n"
"\\setdefaultlanguage[variant=british]\{english\}\n"
"\\usepackage\{libertine\}\n"
"\\usepackage\[normalem\]\{ulem\}\n"
"\\usepackage\{amsmath\}\n"
"\\usepackage\{hyperref\}\n")
("\\section\{%s\}" . "\\section*\{%s\}")
("\\subsection\{%s\}" . "\\subsection*\{%s\}")
("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}")))
(add-to-list 'org-latex-classes
`("cheatsheet"
, (concat
"\\documentclass[10pt,landscape]\{article\}\n"
"\[NO-DEFAULT-PACKAGES]\n"
"\[NO-PACKAGES]\n"
"\\usepackage\{multicol\}\n"
"\\usepackage\{calc\}\n"
"\\usepackage\{ifthen\}\n"
"\\usepackage[landscape]\{geometry\}\n"
"\\usepackage\{amsmath,amsthm,amsfonts,amssymb\}\n"
"\\usepackage\{color,graphicx,overpic\}\n"
"\\usepackage\{hyperref\}\n"
"\\ifthenelse\{\\lengthtest \{ \\paperwidth = 11in\}\}\n"
"\{ \\geometry\{top=.5in,left=.5in,right=.5in,bottom=.5in\} \}\n"
"\{\\ifthenelse\{ \\lengthtest\{ \\paperwidth = 297mm\}\}\n"
"\{\\geometry\{top=1cm,left=1cm,right=1cm,bottom=1cm\} \}\n"
"\{\\geometry\{top=1cm,left=1cm,right=1cm,bottom=1cm\} \}\n"
"\}\n"
"% Turn off header and footer\n"
"\\pagestyle\{empty\}\n"
"% Redefine section commands to use less space\n"
"\\makeatletter\n"
"\\renewcommand\{\\section\}\{\\@startsection\{section\}\{1\}\{0mm\}%\n"
"\{-1ex plus -.5ex minus -.2ex\}%\n"
"\{0.5ex plus .2ex\}%x\n"
"\{\\normalfont\\large\\bfseries\}\}\n"
"\\renewcommand\{\\subsection\}\{\\@startsection\{subsection\}\{2\}\{0mm\}%\n"
"\{-1explus -.5ex minus -.2ex\}%\n"
"\{0.5ex plus .2ex\}%\n"
"\{\\normalfont\\normalsize\\bfseries\}\}\n"
"\\renewcommand\{\\subsubsection\}\{\\@startsection\{subsubsection\}\{3\}\{0mm\}%\n"
"\{-1ex plus -.5ex minus -.2ex\}%\n"
"\{1ex plus .2ex\}%\n"
"\{\\normalfont\\small\\bfseries\}\}\n"
"\\makeatother\n"
"% Define BibTeX command\n"
"\\def\\BibTeX\{\{\\rm B\\kern-.05em\{\\sc i\\kern-.025em b\}\\kern-.08em\n"
"T\\kern-.1667em\\lower.7ex\\hbox\{E\}\\kern-.125emX\}\}\n"
"% Don't print section numbers\n"
"\\setcounter\{secnumdepth\}\{0\}\n"
"\\setlength\{\\parindent\}\{0pt\}\n"
"\\setlength\{\\parskip\}\{0pt plus 0.5ex\}\n")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
))
)
(defun config-org ()
;; (org-alert-enable)
(setq org-log-done t)
(setq org-latex-pdf-process (list "latexmk -f -pdf %f"))
(setq org-directory "~/org")
(setq org-default-notes-file (concat org-directory "/notes.org"))
;; default options for all output formats
(setq org-pandoc-options '((standalone . t)))
;; cancel above settings only for 'docx' format
(setq org-pandoc-options-for-docx '((standalone . nil)))
;; special settings for beamer-pdf and latex-pdf exporters
(setq org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))
(setq org-pandoc-options-for-latex-pdf '((pdf-engine . "xelatex")))
(setq org-publish-project-alist
'(("html"
:base-directory "~/org/"
:base-extension "org"
:publishing-directory "~/org/exports"
:publishing-function org-html-publish-to-html
:recursive nil)
("books"
:base-directory "~/org/books"
:base-extension "org"
:publishing-directory "~/org/exports/books"
:publishing-function org-html-publish-to-html)
("wiki"
:base-directory "~/org/wiki"
:base-extension "org"
:publishing-directory "~/org/exports/wiki"
:publishing-function org-html-publish-to-html)
("wikipdf"
:base-directory "~/org/wiki"
:base-extension "org"
:publishing-directory "~/org/exports/wiki"
:publishing-function org-latex-publish-to-pdf)
("pdf"
:base-directory "~/org/"
:base-extension "org"
:publishing-directory "~/org/exports"
:publishing-function org-latex-publish-to-pdf
:recursive nil)
("letters"
:base-directory "~/org/letters"
:base-extension "org"
:publishing-directory "~/org/exports/letters"
:publishing-function org-koma-letter-export-to-pdf)
("slides"
:base-directory "~/org/slides"
:base-extension "org"
:publishing-directory "~/org/exports/slides"
:publishing-function org-ioslide-export-as-html)
("all" :components ("html" "pdf"))))
(setq org-mobile-inbox-for-pull (concat org-directory "/flagged.org"))
(setq org-mobile-directory "~/Dropbox/MobileOrg")
(setq org-plantuml-jar-path "~/.emacs.d/plantuml.jar")
(setq org-ditaa-jar-path "~/.emacs.d/ditaa.jar")
(setq org-caldav-url "https://box.jelveh.me/cloud/remote.php/caldav/calendars/[email protected]")
(setq org-caldav-calendars
'((:calendar-id "workkvh" :files ("~/org/work.org")
:inbox "~/org/fromwork.org")))
(setq org-board-capture-file (concat org-directory "/my-org-board.org"))
(setq org-ref-bibliography-notes "~/org/bibliography/notes.org"
org-ref-default-bibliography '("~/org/bibliography/references.bib")
org-ref-pdf-directory "~/Documents/References/")
(setq org-agenda-custom-commands
'(("x" agenda)
("y" agenda*)
("w" todo "WAITING")
("W" todo-tree "WAITING")
("s" todo "STARTED")
("S" todo-tree "STARTED")
("c" tags "+COMPUTER")
("t" tags "+TELEPHONE")
("o" . "OFFICE tag searches")
("os" tags "+OFFICE+ITIN")
("op" tags "+OFFICE+ITE")
("oc" tags "+OFFICE+ITA")
("ol" tags "+OFFICE+LUNCHTIME")
("ot" tags "+OFFICE+TELEPHONE")
("or" tags "+OFFICE+RETROSPECTIVE")
("od" tags "+OFFICE+DAILYSCRUM")
("oa" tags "+OFFICE+ASAP")
("h" . "HOME tag searches")
("hi" tags "+HOME+MA")
("hc" tags "+HOME+COMPUTER")
("hp" tags "+HOME+TELEPHONE")
("hr" tags "+HOME+VIKI")
("W" "Completed and/or deferred tasks from previous week"
((agenda "" ((org-agenda-span 7)
(org-agenda-start-day "-7d")
(org-agenda-entry-types '(:timestamp))
(org-agenda-show-log t)))))))
(setq restclient-use-org t)
(defvar yt-iframe-format
(concat "<iframe width=\"440\""
" height=\"335\""
" src=\"https://www.youtube.com/embed/%s\""
" frameborder=\"0\""
" allowfullscreen>%s</iframe>"))
(let ((org-time-stamp-custom-formats
'("<%A, %B %d, %Y>" . "<%A, %B %d, %Y %H:%M>"))
(org-display-custom-times 't)))
(org-link-set-parameters
"yt"
:follow (lambda (handle)
(browse-url
(concat "https://www.youtube.com/embed/" handle)))
:export (lambda (path desc backend)
(cl-case backend
(html (format yt-iframe-format
path (or desc "")))
(latex (format "\href{%s}{%s}"
path (or desc "video"))))))
(with-eval-after-load 'org
;; (use-package org-protocol)
(add-to-list 'org-modules 'org-protocol)
(add-to-list 'org-modules 'org-protocol-capture-html)
(add-to-list 'org-modules 'org-web-tools)
(setq org-confirm-babel-evaluate nil)
;; (use-package ox-asciidoc)
(advice-add 'org-timer-item :around
#'org-timer-item--mpv-insert-playback-position)
;; (add-hook 'org-open-at-point-functions #'mpv-seek-to-position-at-point)
;; active Babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((java . t)
;; (ipython . t)
(python . t)
;; (R . t)
;; (hledger . t)
(calc . t)
(http . t)
(dot . t)
(haskell . t)
(js . t)
(latex . t)
(ruby . t)
;; (sh . t)
(emacs-lisp . t)
(C . t)
(plantuml . t)
(gnuplot . t)
(ditaa . t)
))
)
(setq org-reveal-root (concat "file:///" (expand-file-name "~/git/reveal.js")))
(init-org-agenda)
(init-org-export))
(defun init-local-org ()
(add-hook 'org-mode-hook (lambda ()
(push '(?s . ("#+BEGIN_SRC sh" . "#+END_SRC")) evil-surround-pairs-alist)))
;; (setq initial-major-mode 'org-mode)
(use-package org-alert)
;; convert websites to org mode
(use-package org-eww)
(use-package org-web-tools)
(require 'org-web-tools)
(require 'eww)
(require 'org-protocol-capture-html)
;; (use-package org-board)
;; (defun do-org-board-dl-hook ()
;; (when (equal (buffer-name)
;; (concat "CAPTURE-" org-board-capture-file))
;; (org-board-archive)))
;; (add-hook 'org-capture-before-finalize-hook 'do-org-board-dl-hook)
;; see org-ref for use of these variables
;; (use-package toc-org
;; :config
;; (progn
;; (add-hook 'org-mode-hook 'toc-org-enable)
;; ))
)
(defun add-word-to-personal-dictionary ()
(interactive)
(let ((current-location (point))
(word (flyspell-get-word)))
(when (consp word)
(flyspell-do-correct 'save nil (car word) current-location (cadr word) (caddr word) current-location))))
(defun init-spellcheck ()
;; (setq ispell-hunspell-dict-paths-alist '("c:/msys64/mingw64/share"))
(setq ispell-program-name "hunspell"
ispell-dictionary "de_DE")
(setq ispell-local-dictionary-alist
'(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)
("de_DE" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))
;; (ispell-set-spellchecker-params)
(add-to-list 'ispell-local-dictionary-alist
'(("english" "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-d" "en_US") nil utf-8)))
(add-to-list 'ispell-local-dictionary-alist
'(("german" "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-d" "de_DE") nil utf-8)))
(setq ispell-hunspell-dictionary-alist ispell-local-dictionary-alist)
(setq ispell-hunspell-add-multi-dic "en_US,de_DE")
;; (setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
;; ispell-dictionary "german") ; Default dictionary to use
;; (setq ispell-program-name "hunspell")
;; (setq ispell-dictionary "german,english")
;; (setq ispell-dictionary "english")
;; 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 "german,english")
(let ((langs '("english" "german")))
(setq lang-ring (make-ring (length langs)))
(dolist (elem langs) (ring-insert lang-ring elem)))
(defun cycle-ispell-languages ()
(interactive)
(let ((lang (ring-ref lang-ring -1)))
(ring-insert lang-ring lang)
(ispell-change-dictionary lang)))
(global-set-key [f7] 'cycle-ispell-languages)
)
;; Constants I use to refer to my system
(defconst tbh-hostname
(car (split-string system-name "\\." t))
"The hostname for the current system.")
(defconst tbh-home-dir
(getenv "HOME")
"The full path of the user's home directory.")
(defconst tbh-emacs-d-dir
(expand-file-name ".emacs.d/" tbh-home-dir)
"Top level directory for local configuration and code.")
(defconst tbh-spacemacs-d-dir
(expand-file-name ".spacemacs.d/" tbh-home-dir)
"Top level directory for local Spacemacs configuration and code.")
(defconst tbh-private-spacemacs-layers-dir
(expand-file-name "layers/" tbh-spacemacs-d-dir)
"Directory for storying private Spacemacs layers.")
;; (defun modi/package-dependency-check-ignore (orig-ret)
;; "Remove the `black listed packages' from ORIG-RET."
;; (let ((pkg-black-list '(org))
;; new-ret
;; pkg-name)
;; (dolist (pkg-struct orig-ret)
;; (setq pkg-name (package-desc-name pkg-struct))
;; (if (member pkg-name pkg-black-list)
;; (message (concat "Package `%s' will not be auto-installed. "
;; "See `modi/package-dependency-check-ignore'.")
;; pkg-name)
;; ;; (message "Package to be installed: %s" pkg-name)
;; (push pkg-struct new-ret)))
;; new-ret))
;; (advice-add 'package-compute-transaction :filter-return #'modi/package-dependency-check-ignore)
;; Load system specific config, if it exists
(let ((tbh-system-specific-config
(expand-file-name
(concat tbh-hostname ".el") tbh-spacemacs-d-dir)))
(if (file-readable-p tbh-system-specific-config)
(load-file tbh-system-specific-config)))
;; Set up appropriate function advice
(defmacro tbh/wrap-func (func)
(let ((advice-name (intern (format "%s--advice" func)))
(target-name (intern (format "tbh/%s" func))))
`(progn
(defun ,advice-name (&rest args)
(when (fboundp ',target-name)
(apply ',target-name args)))
(advice-add ',func :after ',advice-name))))
(tbh/wrap-func dotspacemacs/layers)
(tbh/wrap-func dotspacemacs/init)
(tbh/wrap-func dotspacemacs/user-init)
(tbh/wrap-func dotspacemacs/user-config)
;; Generally Useful Functions
(defun unfill-paragraph ()
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
(defun unfill-region ()
(interactive)
(let ((fill-column (point-max)))
(fill-region (region-beginning) (region-end) nil)))
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
;; or `spacemacs'. (default 'spacemacs)
dotspacemacs-distribution 'spacemacs
;; Lazy installation of layers (i.e. layers are installed only when a file
;; with a supported type is opened). Possible values are `all', `unused'
;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
;; lazy install any layer that support lazy installation even the layers
;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
;; installation feature and you have to explicitly list a layer in the
;; variable `dotspacemacs-configuration-layers' to install it.
;; (default 'unused)
dotspacemacs-enable-lazy-installation 'unused
;; If non-nil then Spacemacs will ask for confirmation before installing
;; a layer lazily. (default t)
dotspacemacs-ask-for-lazy-installation t
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
;; List of configuration layers to load.
dotspacemacs-configuration-layers
'(
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press `SPC f e R' (Vim style) or
;; `M-m f e R' (Emacs style) to install them.
;; ----------------------------------------------------------------
;; auto-completion
better-defaults
emacs-lisp
hackernews
epub
(languagetool :variables
langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*")
(elfeed :variables rmh-elfeed-org-files (list "~/.spacemacs.d/elfeed.org"))
;; helm
lsp
;; markdown
multiple-cursors
(org :variables
org-enable-github-support t
org-enable-bootstrap-support t
org-enable-reveal-js-support t
org-enable-hugo-support t
org-enable-roam-ui t
org-want-todo-bindings t
org-enable-roam-support t
org-projectile-file "TODO.org"
org-enable-roam-protocol t
org-enable-sticky-header t
org-enable-org-journal-support t
org-journal-dir "~/org/journal/"
org-journal-file-format "%Y-%m-%d.org"
org-journal-date-prefix "#+TITLE: "
org-journal-date-format "%A, %B %d %Y"
org-journal-time-prefix "* "
org-journal-time-format "")
(shell :variables
shell-default-height 30
shell-enable-smart-eshell t
shell-default-position 'bottom
shell-protect-eshell-prompt t
shell-default-shell 'ansi-term
shell-pop-autocd-to-working-dir nil
shell-default-term-shell "zsh")
eaf
rust
php
windows-scripts
nginx
spacemacs-org
;; confluence
(lua :variables
lua-backend 'lsp
lua-lsp-server 'emmy)
;; ivy
compleseus
ess
csv
asciidoc
django
deft
(python :variables
python-formatter 'black
python-format-on-save t
python-backend 'lsp
;; (company-anaconda :toggle (configuration-layer/package-used-p 'company))
python-sort-imports-on-save t)
ipython-notebook
(c-c++ :variables
c-c++-enable-clang-support t
c-c++-default-mode-for-headers
'c++-mode)
(auto-completion :variables
auto-completion-return-key-behavior 'complete
auto-completion-tab-key-behavior 'cycle
auto-completion-complete-with-key-sequence nil
auto-completion-complete-with-key-sequence-delay 0.1
auto-completion-idle-delay 0.2
auto-completion-private-snippets-directory nil
auto-completion-enable-snippets-in-popup nil
auto-completion-enable-help-tooltip nil
auto-completion-use-company-box nil)
haskell
chinese
kubernetes
;; japanese
javascript
json
web-beautify
react
typescript
html
vimscript
(terraform :variables terraform-auto-format-on-save t)
(git :variables
git-magit-status-fullscreen nil
git-enable-github-support t)
;; git-gutter-use-fringe t)
(go :variables go-use-gometalinter t
gofmt-command "goimports"
go-use-gocheck-for-testing t
go-tab-width 4)
protobuf
sql
(markdown :variables markdown-live-preview-engine 'vmd)
xkcd
(ruby :variables ruby-test-runner 'rspec)
pdf
csharp
java
pandoc
plantuml
evil-commentary
;; evil-cleverparens
evil-snipe
docker
;; unimpaired
;; vim-powerline
finance
;; nlinum
fasd
;; (ranger :variables
;; ranger-override-dired t
;; ranger-show-preview t
;; ranger-cleanup-eagerly t)
;; wakatime
;; semantic
chinese
ruby-on-rails
shell-scripts
yaml
vinegar
systemd
restclient
;; ;; tmux
dash
ansible
;; gtags
;; (latex :variables
;; latex-build-command "LatexMk"
;; latex-enable-folding t)
;; bibtex
;; ;; osx
;; octave
;; d12frosted-org
;; d12frosted-csharp
;; elixir
speed-reading
(spell-checking :variables
enable-flyspell-auto-completion t
spell-checking-enable-by-default nil)
(version-control :variables
version-control-diff-tool 'diff-hl
version-control-diff-side 'left
version-control-global-margin 't)
fishman
;; common-lisp
;; syntax-checking
;; search-engine
;; deft
treemacs)
;; List of additional packages that will be installed without being wrapped
;; in a layer (generally the packages are installed only and should still be
;; loaded using load/require/use-package in the user-config section below in
;; this file). If you need some configuration for these packages, then
;; consider creating a layer. You can also put the configuration in
;; `dotspacemacs/user-config'. To use a local version of a package, use the
;; `:location' property: '(your-package :location "~/path/to/your-package/")
;; Also include the dependencies as they will not be resolved automatically.
dotspacemacs-additional-packages '(evil-replace-with-register
counsel-org-clock
angular-mode
angular-snippets
;; hledger-mode
;; (org-glossary :location (recipe :fetcher github :repo "jagrg/org-glossary"))
(toc-org :location (recipe :fetcher github :repo "snosov1/toc-org"))
(org-protocol-capture-html :location (recipe :fetcher github :repo "alphapapa/org-protocol-capture-html"))
org-caldav
;; org-board
(org-web-tools :location (recipe :fetcher github :repo "alphapapa/org-web-tools"))
;; org-web-tools
;; (org-web-tools :location (recipe :fetcher github :repo alphapapa/org-web-tools))
password-generator
bbdb
tldr
;; (org-wiki :location (recipe :fetcher github :repo "fishman/org-wiki" :branch "helm_to_consul"))
focus
ivy-youtube
;; ob-ipython
org-drill-table
kaolin-themes
gruvbox-theme
simple-mpc
(ox-asciidoc :location (recipe :fetcher github :repo "alphapapa/org-web-tools"))
(ox-ioslide :location (recipe :fetcher github :repo "fishman/org-ioslide"))
w3m xwidgete spray org-alert nxml xml-rpc langtool)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()
;; A list of packages that will not be installed and loaded.
dotspacemacs-excluded-packages '()
;; Defines the behaviour of Spacemacs when installing packages.
;; Possible values are `used-only', `used-but-keep-unused' and `all'.
;; `used-only' installs only explicitly used packages and deletes any unused
;; packages as well as their unused dependencies. `used-but-keep-unused'
;; installs only the used packages but won't delete unused ones. `all'
;; installs *all* packages supported by Spacemacs and never uninstalls them.
;; (default is `used-only')
dotspacemacs-install-packages 'used-only))
(defun dotspacemacs/init ()
"Initialization:
This function is called at the very beginning of Spacemacs startup,
before layer configuration.
It should only modify the values of Spacemacs settings."
;; This setq-default sexp is an exhaustive list of all the supported
;; spacemacs settings.
(setq-default
;; If non-nil then enable support for the portable dumper. You'll need to
;; compile Emacs 27 from source following the instructions in file
;; EXPERIMENTAL.org at to root of the git repository.
;;
;; WARNING: pdumper does not work with Native Compilation, so it's disabled
;; regardless of the following setting when native compilation is in effect.
;;
;; (default nil)
dotspacemacs-enable-emacs-pdumper nil
;; Name of executable file pointing to emacs 27+. This executable must be
;; in your PATH.
;; (default "emacs")
dotspacemacs-emacs-pdumper-executable-file "emacs"
;; Name of the Spacemacs dump file. This is the file will be created by the
;; portable dumper in the cache directory under dumps sub-directory.
;; To load it when starting Emacs add the parameter `--dump-file'
;; when invoking Emacs 27.1 executable on the command line, for instance:
;; ./emacs --dump-file=$HOME/.emacs.d/.cache/dumps/spacemacs-27.1.pdmp
;; (default (format "spacemacs-%s.pdmp" emacs-version))
dotspacemacs-emacs-dumper-dump-file (format "spacemacs-%s.pdmp" emacs-version)
;; If non-nil ELPA repositories are contacted via HTTPS whenever it's
;; possible. Set it to nil if you have no way to use HTTPS in your
;; environment, otherwise it is strongly recommended to let it set to t.
;; This variable has no effect if Emacs is launched with the parameter
;; `--insecure' which forces the value of this variable to nil.
;; (default t)
dotspacemacs-elpa-https t
;; Maximum allowed time in seconds to contact an ELPA repository.
;; (default 5)
dotspacemacs-elpa-timeout 5
;; Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
;; This is an advanced option and should not be changed unless you suspect
;; performance issues due to garbage collection operations.
;; (default '(100000000 0.1))
dotspacemacs-gc-cons '(100000000 0.1)
;; Set `read-process-output-max' when startup finishes.
;; This defines how much data is read from a foreign process.
;; Setting this >= 1 MB should increase performance for lsp servers
;; in emacs 27.
;; (default (* 1024 1024))
dotspacemacs-read-process-output-max (* 1024 1024)
;; If non-nil then Spacelpa repository is the primary source to install
;; a locked version of packages. If nil then Spacemacs will install the
;; latest version of packages from MELPA. Spacelpa is currently in
;; experimental state please use only for testing purposes.
;; (default nil)
dotspacemacs-use-spacelpa nil
;; If non-nil then verify the signature for downloaded Spacelpa archives.
;; (default t)
dotspacemacs-verify-spacelpa-archives t
;; If non-nil then spacemacs will check for updates at startup
;; when the current branch is not `develop'. Note that checking for
;; new versions works via git commands, thus it calls GitHub services
;; whenever you start Emacs. (default nil)
dotspacemacs-check-for-update nil
;; If non-nil, a form that evaluates to a package directory. For example, to
;; use different package directories for different Emacs versions, set this
;; to `emacs-version'. (default 'emacs-version)
dotspacemacs-elpa-subdirectory 'emacs-version
;; One of `vim', `emacs' or `hybrid'.
;; `hybrid' is like `vim' except that `insert state' is replaced by the
;; `hybrid state' with `emacs' key bindings. The value can also be a list
;; with `:variables' keyword (similar to layers). Check the editing styles
;; section of the documentation for details on available variables.
;; (default 'vim)
dotspacemacs-editing-style 'vim
;; If non-nil show the version string in the Spacemacs buffer. It will
;; appear as (spacemacs version)@(emacs version)
;; (default t)
dotspacemacs-startup-buffer-show-version t
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'
;; directory. A string value must be a path to an image format supported
;; by your Emacs build.
;; If the value is nil then no banner is displayed. (default 'official)
dotspacemacs-startup-banner 'official
;; Scale factor controls the scaling (size) of the startup banner. Default
;; value is `auto' for scaling the logo automatically to fit all buffer
;; contents, to a maximum of the full image height and a minimum of 3 line
;; heights. If set to a number (int or float) it is used as a constant
;; scaling factor for the default logo size.
dotspacemacs-startup-banner-scale 'auto
;; List of items to show in startup buffer or an association list of
;; the form `(list-type . list-size)`. If nil then it is disabled.
;; Possible values for list-type are:
;; `recents' `recents-by-project' `bookmarks' `projects' `agenda' `todos'.