-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.el
1845 lines (1490 loc) · 65.2 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
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://gitlab.com/zzamboni/dot-doom/-/blob/master/doom.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v t)
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
;; (setq user-full-name "John Doe"
;; user-mail-address "[email protected]")
;; 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:
;; (setq doom-theme 'doom-one)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
;; (setq org-directory "~/org/")
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
;; (setq display-line-numbers-type t)
;; 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.
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Most of my per-environment config done via =customize= and is in .custom.el.
;; However, some config is more involved, such as packages I just want in one
;; environment and not the others. To that end, let's load a file that can contain
;; those customizations.
;; (let ((per-machine-filename (concat doom-user-dir "per-machine.el")))
;; (when (file-exists-p per-machine-filename)
;; (load-file per-machine-filename)))
(load! "+user-info")
;;; Load 'Per-Machine' - User Configs
;; Most of my per-environment config done via =customize= and is in .custom.el.
;; However, some config is more involved, such as packages I just want in one
;; environment and not the others. To that end, let's load a file that can contain
;; those customizations.
(let ((per-machine-filename (concat doom-user-dir "per-machine.el")))
(when (file-exists-p per-machine-filename)
(load-file per-machine-filename)))
;;; GENERAL SETTINGS
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
;; (setq display-line-numbers-type 'relative)
;; /doom/high-school-macos-emacs-dev-env/doom/init.el
(setq-default x-stretch-cursor t) ; make the cursor wide over tabs, etc.
(setq undo-limit 80000000) ; Raise undo-limit to 80Mb
(setq truncate-string-ellipsis "…") ; Unicode ellispis are nicer than "...", and also save /precious/ space
;;; startup and dashboard
(setq initial-scratch-message user-initial-scratch-message)
;; When I bring up Doom's scratch buffer with SPC x, it's often to play with
;; elisp or note something down (that isn't worth an entry in my notes). I can
;; do both in `lisp-interaction-mode'.
(setq doom-scratch-initial-major-mode 'emacs-lisp-mode)
;; Set initial buffer to org
(setq initial-major-mode #'text-mode)
;;; Leader key
;; Over-ride or add to Doom Emacs default key bindings
;; https://discourse.doomemacs.org/t/what-are-leader-and-localleader-keys/153
;; 'M-m', '\,' 'SPC m' for localleader
(setq doom-localleader-key ","
doom-localleader-alt-key "C-,")
(defun my/call-localleader ()
(interactive)
(setq unread-command-events (listify-key-sequence ",")))
(map! :leader (:desc "+major-mode" "m" #'my/call-localleader))
;; (global-set-key (kbd "M-m") #'my/call-localleader)
;;;; Font Test:
;; Font test: " & ' ∀ ∃ ∅ ∈ ∉ ∏ ∑ √ ∞ ∧ ∨ ∩ ∪ ∫ ² ³ µ · × ∴ ∼
;; ≅ ≈ ≠ ≡ ≤ ≥ < > ⊂ ⊃ ⊄ ⊆ ⊇ ⊥ ∂ ∇ ∈ ∝ ⊕ ⊗ ← → ↑ ↓ ↔ ⇐ ⇒ ⇔
;; □ ■ | © ¬ ± ° · ˜ Γ Δ α β γ δ ε φ ∀, ∃, ¬(~), ∨, ∧,⊂, ∈,
;; ⇒, ⇔ 𝑀<1
;; 𝑻𝑼𝑽𝗔𝗕𝗖𝗗 𝞉𝞩𝟃 ϑϕϰ ⊰⊱⊲⊳⊴⊵⫕ 𝚢𝚣𝚤𝖿𝗀𝗁𝗂
;;; Input-method +Hangul
;; +------------+------------+
;; | 일이삼사오 | 일이삼사오 |
;; +------------+------------+
;; | ABCDEFGHIJ | ABCDEFGHIJ |
;; +------------+------------+
;; | 1234567890 | 1234567890 |
;; +------------+------------+
;; | 일이삼사오 | 일이삼사오 |
;; | abcdefghij | abcdefghij |
;; +------------+------------+
(progn
(setq default-input-method "korean-hangul")
(set-language-environment "Korean")
;; (setq default-transient-input-method "TeX")
(set-keyboard-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(set-charset-priority 'unicode)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq-default buffer-file-coding-system 'utf-8-unix)
(set-selection-coding-system 'utf-8) ;; important
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write '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))
(setq-default line-spacing 3) ; use fontaine
;; (setenv "LANG" "en_US.UTF-8")
;; (setenv "LC_ALL" "en_US.UTF-8")
;; (setenv "LANG" "ko_KR.UTF-8")
;; 날짜 표시를 영어로한다. org mode에서 time stamp 날짜에 영향을 준다.
(setq system-time-locale "C")
(setq input-method-verbose-flag nil
input-method-highlight-flag nil)
(global-set-key (kbd "<S-SPC>") 'toggle-input-method)
;; (global-set-key (kbd "<Alt_R>") 'toggle-input-method)
(global-set-key (kbd "<Hangul>") 'toggle-input-method)
;; (global-unset-key (kbd "S-SPC"))
;;;###autoload
(defun my/set-emoji-symbol-font ()
(interactive)
(set-fontset-font "fontset-default" 'hangul (font-spec :family (face-attribute 'default :family)))
(when (display-graphic-p) ; gui
(set-fontset-font t 'unicode (font-spec :family "Symbola") nil 'prepend) ;; 2024-09-16 테스트 -- 𝑀<1
(set-fontset-font t 'mathematical (font-spec :family "Symbola") nil 'prepend) ; best
;; (set-fontset-font t 'emoji (font-spec :family "Apple Color Emoji") nil 'prepend)
(set-fontset-font t 'emoji (font-spec :family "Noto Color Emoji") nil)
(set-fontset-font t 'emoji (font-spec :family "Noto Emoji") nil 'prepend) ; Top
)
(unless (display-graphic-p) ; terminal
(set-fontset-font "fontset-default" 'emoji (font-spec :family "Noto Emoji") nil 'prepend))
(set-fontset-font t 'symbol (font-spec :family "Symbola") nil 'prepend)
(set-fontset-font t 'symbol (font-spec :family "Noto Sans Symbols 2") nil 'prepend)
(set-fontset-font t 'symbol (font-spec :family "Noto Sans Symbols") nil 'prepend))
(add-hook 'after-setting-font-hook #'my/set-emoji-symbol-font))
;;; better default
;; (setq-default display-line-numbers-width-start t) ; doom's default t
(setq inhibit-compacting-font-caches t)
;; Stop asking abount following symlinks to version controlled files
(setq vc-follow-symlinks t)
(global-auto-revert-mode 1) ; doom nil
(setq auto-revert-interval 10)
;; default 120 emacs-29, 60 emacs-28
(setq kill-ring-max 30) ; keep it small
;; Disable .# lock files
(setq create-lockfiles nil)
;; Denote 23.9. Speed up backlinks’ buffer creation?
;; Prefer ripgrep, then ugrep, and fall back to regular grep.
(setq xref-search-program
(cond ((or (executable-find "ripgrep") (executable-find "rg")) 'ripgrep)
((executable-find "ugrep") 'ugrep) (t 'grep)))
;;; overide doomemacs
(setq bookmark-default-file "~/emacs-bookmarks.el")
(setq bookmark-use-annotations nil)
(setq bookmark-automatically-show-annotations t)
(progn
(require 'dabbrev)
(setq dabbrev-abbrev-char-regexp "[A-Za-z-_]") ; tshu
(setq dabbrev-ignored-buffer-regexps
'("\\` "
"\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"
"\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?"))
(setq dabbrev-abbrev-skip-leading-regexp "[$*/=~']"))
;;;; dired
(after! dired
(setq dired-make-directory-clickable t) ; Emacs 29.1, doom t
(setq dired-free-space nil) ; Emacs 29.1, doom first
;; Better dired flags:
;; `-l' is mandatory
;; `-a' shows all files
;; `-h' uses human-readable sizes
;; `-F' appends file-type classifiers to file names (for better highlighting)
;; -g like -l, but do not list owner
(setq dired-listing-switches "-AGFhgv --group-directories-first --time-style=long-iso") ;; doom "-ahl -v --group-directories-first"
(setq dired-recursive-copies 'always ; doom 'always
dired-dwim-target t) ; doom t
(setq dired-ls-F-marks-symlinks nil ; doom nil -F marks links with @
delete-by-moving-to-trash t) ; doom nil
(setq dired-use-ls-dired t) ; doom t
(setq dired-do-revert-buffer t) ; doom nil
;; (setq dired-clean-confirm-killing-deleted-buffers t) ; doom nil
;; (setq dired-kill-when-opening-new-dired-buffer t) ; doom nil
(require 'wdired)
(setq wdired-allow-to-change-permissions t) ; doom nil
(setq wdired-create-parent-directories t)
(add-hook 'dired-mode-hook
(lambda ()
(interactive)
(setq-local truncate-lines t) ; Do not wrap lines
;; (visual-line-mode -1)
(hl-line-mode 1)))
(add-hook 'dired-mode-hook 'dired-hide-details-mode)
(remove-hook 'dired-mode-hook 'dired-omit-mode)
(evil-define-key 'normal dired-mode-map
(kbd "C-c C-e") 'wdired-change-to-wdired-mode
(kbd "C-c l") 'org-store-link
(kbd "C-x /") 'dired-narrow-regexp
(kbd ".") 'consult-line
;; (kbd "K") 'dired-kill-subdir
(kbd "K") 'dired-do-kill-lines
;; (kbd "F") 'evil-avy-goto-line-below ;; 2024-01-25 useful
(kbd "h") 'dired-up-directory
(kbd "RET") 'dired-find-file
(kbd "l") 'dired-find-file
(kbd "S-<return>") 'dired-find-file-other-window
;; evil-force-normal-state
(kbd "q") 'casual-dired-tmenu
(kbd "S-SPC") 'dired-toggle-marks
)
)
;;;; which-key
(after! which-key
(setq
which-key-max-description-length 36 ; doom 27, spacemacs 36
which-key-idle-delay 0.4
which-key-idle-secondary-delay 0.01
;; which-key-ellipsis ".."
;; which-key-allow-multiple-replacements nil
;; which-key-use-C-h-commands t) ; paging key maps
))
;;;; popup-rule
;; from prot's dotfiles : important
(add-to-list
'display-buffer-alist
`("\\`\\*\\(Warnings\\|Compile-Log\\|Org Links\\)\\*\\'"
(display-buffer-no-window)
(allow-no-window . t)))
;;; completion
;;;; corfu
;; 2024-09-13 기본 설정, jump-out-of-pair 추가
;; Tab 이 자동 완성이면 괄호 점프랑 충돌 난다. C-j/k C-n/p 는 직관적인 기본 설정이므로 건들이지 않는다.
(after! corfu
;; (setq corfu-auto-delay 0.5) ; doom 0.24
(setq corfu-auto-prefix 3) ; doom 2
(setq corfu-preselect 'valid) ; doom 'prompt
(setq completion-cycle-threshold 3) ; doom nil
(setq tab-always-indent t) ; for jump-out-of-pair - doom 'complete
(setq +corfu-want-minibuffer-completion nil) ; doom t
(setq +corfu-want-tab-prefer-expand-snippets t) ; 2024-11-06
(setq +corfu-want-tab-prefer-navigating-snippets t)
;; (setq +corfu-want-tab-prefer-navigating-org-tables t)
;; from minemacs
;; HACK: Prevent the annoting completion error when no `ispell' dictionary is set, prefer `cape-dict'
(when (eq emacs-major-version 30)
(setq text-mode-ispell-word-completion nil))
;; IMO, modern editors have trained a bad habit into us all: a burning need for
;; completion all the time -- as we type, as we breathe, as we pray to the
;; ancient ones -- but how often do you *really* need that information? I say
;; rarely. So opt for manual completion:
;; doom/hlissner-dot-doom/config.el
;; (setq corfu-auto nil)
;; default 'C-S-s'
(define-key corfu-map (kbd "M-.") '+corfu-move-to-minibuffer)
)
;;; evil
(after! evil
;; C-h is backspace in insert state
;; (setq evil-want-C-h-delete t) ; default nil
(setq evil-want-C-w-delete t) ; default t
(setq evil-want-C-u-scroll t) ; default t
;; use C-i / C-o evil-jump-backward/forward
;; (setq evil-want-C-i-jump t) ; default nil
;; /home/junghan/sync/man/dotsamples/vanilla/mpereira-dotfiles-evil-clojure/configuration.org
;; FIXME: this correctly causes '*' to match on whole symbols (e.g., on a
;; Clojure file pressing '*' on 'foo.bar' matches the whole thing, instead of
;; just 'foo' or 'bar', BUT, it won't match 'foo.bar' in something like
;; '(foo.bar/baz)', which I don't like.
;; (setq-default evil-symbol-word-search t)
;; (setq evil-jumps-cross-buffers nil)
(setq evil-want-Y-yank-to-eol t) ; doom t
;; 'Important' Prevent the cursor from moving beyond the end of line.
;; Don't move the block cursor when toggling insert mode
(setq evil-move-cursor-back nil) ; nil is better - default t
(setq evil-move-beyond-eol nil) ; default nil
(setq +evil-want-o/O-to-continue-comments nil) ; doom t
(setq +default-want-RET-continue-comments nil) ; doom t
(setq evil-want-fine-undo t) ; doom 'nil
;; Don't put overwritten text in the kill ring
(setq evil-kill-on-visual-paste nil) ; default t
;; Don't create a kill entry on every visual movement.
;; More details: https://emacs.stackexchange.com/a/15054:
(fset 'evil-visual-update-x-selection 'ignore)
;; Prevent evil-motion-state from shadowing previous/next sexp
(with-eval-after-load 'evil-maps
(define-key evil-motion-state-map "L" nil)
(define-key evil-motion-state-map "M" nil)
(evil-global-set-key 'normal (kbd "DEL") 'evil-switch-to-windows-last-buffer) ; Backspace
;; Replace Emacs Tabs key bindings with Workspace key bindings
;; replace "." search with consul-line in Evil normal state
;; use default "/" evil search
;; disable evil macro
(define-key evil-normal-state-map (kbd "q") 'nil) ; evil macro disable
(define-key evil-normal-state-map (kbd "Q") 'evil-record-macro)
;; o :: ace-link-info 이거면 충분하다.
(define-key evil-insert-state-map (kbd "C-]") 'forward-char) ; very useful
;; =C-w= 'insert 'evil-delete-backward-word
;; =C-w= 'visual 'evil-window-map
;; use evil bindings $ ^
;; M-d region delete and C-d char delete
(define-key evil-insert-state-map (kbd "C-d") 'delete-forward-char)
;; Don't put overwritten text in the kill ring
;; evil-delete-char -> delete-forward-char
(define-key evil-normal-state-map "x" 'delete-forward-char)
(define-key evil-normal-state-map "X" 'delete-backward-char)
)
;; evil-org
(with-eval-after-load 'evil-org
;; (evil-define-key 'insert 'evil-org-mode-map (kbd "C-d") 'delete-forward-char)
(evil-define-key 'normal 'evil-org-mode-map "x" 'delete-forward-char)
;; (evil-define-key 'insert 'evil-org-mode-map (kbd "C-k") 'org-kill-line)
;; (evil-define-key 'insert 'org-mode-map (kbd "C-k") 'org-kill-line)
(evil-define-key 'normal 'evil-org-mode-map "X" 'delete-backward-char))
)
;; ,. as Esc key binding
;; https://discourse.doomemacs.org/t/typing-jk-deletes-j-and-returns-to-normal-mode/59/7
(after! evil-escape
(setq evil-escape-key-sequence ",.") ;; "jk"
(setq evil-escape-unordered-key-sequence nil)
(setq evil-escape-delay 1.0) ;; 0.5, default 0.1
(evil-escape-mode 1))
(after! smartparens
;; 2023-09-14 global 로 사용하다보니 거슬린다. 잠시만. 글로벌을 빼면 어떤가?
;; ("\\\\(" . "\\\\)") ;; emacs regexp parens
;; ("\\{" . "\\}") ;; latex literal braces in math mode
;; ("\\(" . "\\)") ;; capture parens in regexp in various languages
;; ("\\\"" . "\\\"") ;; escaped quotes in strings
;; ("/*" . "*/") ;; C-like multi-line comment
;; ("\"" . "\"") ;; string double quotes
;; ("'" . "'") ;; string single quotes/character quotes
;; ("(" . ")") ;; parens (yay lisp)
;; ("[" . "]") ;; brackets
;; ("{" . "}") ;; braces (a.k.a. curly brackets)
;; ("`" . "`") ;; latex strings. tap twice for latex double quotes
;; Unbind `M-s' (set by paredit keybindings above) because it's bound
;; to some handy occur related functions
;; (define-key sp-keymap (kbd "M-s") nil)
;; org 모드에서 거슬린다. 제거. 굳.
(sp-local-pair 'org-mode "(" ")" :actions '(rem)) ; for denote completion
(sp-local-pair 'org-mode "[" "]" :actions '(rem)) ; temporarly
(sp-local-pair 'org-mode "'" "'" :actions '(rem))
(sp-local-pair 'org-mode "`" "`" :actions '(rem))
(sp-local-pair 'org-mode "\"" "\"" :actions '(rem))
(sp-local-pair 'org-mode "/" "/" :actions '(rem))
(sp-local-pair 'org-mode "=" "=" :actions '(rem))
(sp-local-pair 'org-mode "~" "~" :actions '(rem))
;; markdown 에서도 삭제
(sp-local-pair 'markdown-mode "(" ")" :actions '(rem))
(sp-local-pair 'markdown-mode "'" "'" :actions '(rem))
(sp-local-pair 'markdown-mode "`" "`" :actions '(rem))
(sp-local-pair 'markdown-mode "\"" "\"" :actions '(rem))
(sp-local-pair 'markdown-mode "/" "/" :actions '(rem))
;; pair management
(sp-with-modes
'(minibuffer-mode)
(sp-local-pair "'" nil :actions nil)
(sp-local-pair "(" nil :wrap "C-("))
(sp-with-modes 'markdown-mode (sp-local-pair "**" "***"))
(sp-with-modes
'web-mode
(sp-local-pair "{{#if" "{{/if")
(sp-local-pair "{{#unless" "{{/unless"))
(sp-with-modes
'org-mode
(sp-local-pair "\\[" "\\]")
(sp-local-pair "$$" "$$"))
)
;;;; tempel
;; Template-based in-buffer completion (tempel.el)
;; NOTE 2023-01-19: Check the `templates'
(use-package! tempel
:bind
(("M-+" . tempel-complete) ;; Alternative tempel-expand
("M-*" . tempel-insert))
:config
;; (setq tempel-trigger-prefix "<") ; conflits with evil-shift
(setq tempel-path (expand-file-name "tempel-templates.eld" doom-user-dir))
;; Use concrete keys because of org mode
;; "M-RET" #'tempel-done
;; "M-{" #'tempel-previous
;; "M-}" #'tempel-next
;; "M-<up>" #'tempel-previous
;; "M-<down>" #'tempel-next
;; 2023-10-19 disable my custom
(define-key tempel-map (kbd "RET") #'tempel-done)
(define-key tempel-map (kbd "M-n") #'tempel-next)
(define-key tempel-map (kbd "M-p") #'tempel-previous)
(use-package! tempel-collection))
;;;; laas
;; https://github.com/tecosaur/LaTeX-auto-activating-snippets
(use-package! laas
:hook ((LaTeX-mode . laas-mode)
(org-mode . laas-mode)))
;;;; org
;; (require 'ob-tangle)
(after! org
(message "after org - config")
;; (load-file (concat doom-user-dir "lisp/org-funcs.el"))
;; (load-file (concat doom-user-dir "lisp/org-config.el"))
;; (+org-init-keybinds-h) -> 2024-06-01 여기 키바인딩 관련 부분 뒤에서 다시 잡아줌
;; (setq org-attach-use-inheritance nil) ; selective
(progn
(setq org-capture-bookmark nil)
(setq org-edit-src-content-indentation 0) ; default 2
)
(setq org-id-locations-file
(file-name-concat org-directory (concat "." system-name "-orgids"))) ; ".org-id-locations"))
;; overide here! important
(setq org-insert-heading-respect-content nil) ; doom t
;; org-indent-mode 사용하면 org-hide-leading-stars 자동 on
;; (setq org-hide-leading-stars nil) ; doom t
)
(after! org
;;;; org-todo-keywords : whhone
(progn
;; https://whhone.com/emacs-config/
(setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)" "DONT(o)")))
(with-no-warnings
(custom-declare-face '+org-todo-todo '((t (:inherit (bold error org-todo)))) "")
(custom-declare-face '+org-todo-next '((t (:inherit (bold warning org-todo)))) "")
(custom-declare-face '+org-todo-done '((t (:inherit (bold success org-todo)))) "")
(custom-declare-face '+org-todo-dont '((t (:inherit (bold font-lock-doc-face org-todo)))) "")
)
(setq org-todo-keyword-faces
'(("TODO" . +org-todo-todo) ;; red
("DONE" . +org-todo-done) ;; green
("NEXT" . +org-todo-next) ;; yellow
("DONT" . +org-todo-dont) ;; green
))
;; https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html
(setq org-agenda-custom-commands
'(("n" "Agenda / NEXT"
((agenda "" nil)
(tags "INBOX+LEVEL=2|CATEGORY=\"Inbox\"+LEVEL=1")
(todo "NEXT" nil)
;; (todo "TODO" nil) ;; 2024-03-18 add
) nil)
(" " "Agenda and all TODOs" ; default' view
((agenda "")
(alltodo "")))))
)
;;;; DONT custom agenda files
;; ;; (setq org-agenda-files org-user-agenda-files)
(setq org-agenda-diary-file (my/org-diary-file))
(setq org-default-notes-file (my/org-inbox-file))
;; doom-emacs capture files : absolute path
(setq +org-capture-todo-file (my/org-inbox-file))
(setq +org-capture-notes-file (my/org-inbox-file))
(setq +org-capture-changelog-file (my/org-inbox-file))
(setq +org-capture-projects-file (my/org-tasks-file))
(setq +org-capture-journal-file (my/org-diary-file))
;;;; org-agenda
;; Use sticky agenda since I need different agenda views (personal and work) at the same time.
(setq org-agenda-sticky t) ; default nil
;; Shift the agenda to show the previous 3 days and the next 7 days for
;; better context on your week. The past is less important than the future.
(setq org-agenda-span 'day) ; default 'week, doom 10
;; Hide all scheduled todo.
(setq org-agenda-todo-ignore-scheduled 'all)
;; Ignores "far" deadline TODO items from TODO list.
(setq org-agenda-todo-ignore-deadlines 'far)
;; Hide all scheduled todo, from tags search view, like tags-todo.
(setq org-agenda-tags-todo-honor-ignore-options t)
;; Hide all done todo in agenda
(setq org-agenda-skip-scheduled-if-done t)
;; Hide task until the scheduled date.
(setq org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled)
(setq org-log-into-drawer t)
(setq org-log-done 'time)
;; (setcdr (assoc 'note org-log-note-headings) "%d")
;; Interstitial Journaling: add note to CLOCK entry after clocking out
;; https://emacs.stackexchange.com/questions/37526/add-note-to-clock-entry-after-clocking-out
(setq org-log-note-clock-out t)
;; 4 priorities to model Eisenhower's matrix.
;; - [#A] means +important +urgent
;; - [#B] means +important -urgent
;; - [#C] means -important +urgent
;; - [#D] means -important -urgent
(setq org-priority-default 68
org-priority-lowest 68)
;;;; diary-file
(setq diary-file (concat doom-user-dir "diary"))
(setq org-agenda-include-diary t)
;;;; org-agenda-log-mode and clock-mode
;; Show all agenda dates - even if they are empty
(setq org-agenda-show-all-dates t)
(setq org-agenda-start-with-log-mode t)
;; Agenda log mode items to display (closed clock : default)
;; 이전 이맥스는 state 가 기본이었다. 지금은 시간 기준으로 표기한다.
;; closed Show entries that have been closed on that day.
;; clock Show entries that have received clocked time on that day.
;; state Show all logged state changes.
;; (setq org-agenda-log-mode-items '(closed clock state))
(setq org-agenda-log-mode-add-notes nil)
;; sort 관련 기능을 확인해보고 정의한 함수들이 필요 없으면 빼면 된다.
(setq org-agenda-sort-notime-is-late t) ; Org 9.4
(setq org-agenda-sort-noeffort-is-high t) ; Org 9.4
;; Time Clocking
(setq org-clock-idle-time 30) ; 10
(setq org-clock-reminder-timer (run-with-timer
t (* org-clock-idle-time 20) ; 60
(lambda ()
(unless (org-clocking-p)
(when (fboundp 'alert)
(alert "Do you forget to clock-in?"
:title "Org Clock"))))))
;; (org-clock-auto-clockout-insinuate) ; auto-clockout
;; modeline 에 보이는 org clock 정보가 너무 길어서 줄임
(setq org-clock-string-limit 30) ; default 0
;; org-clock-persist for share with machines
(setq org-clock-persist-query-save t)
(setq org-clock-persist-query-resume t)
;; current Only the time in the current instance of the clock
;; today All time clocked into this task today
;; repeat All time clocked into this task since last repeat
;; all All time ever recorded for this task
;; auto Automatically, either all, or repeat for repeating tasks
(setq org-clock-mode-line-entry t)
(setq org-clock-mode-line-line-total 'auto) ; default nil
;; global Effort estimate values
;; global STYLE property values for completion
(setq org-global-properties
(quote
(("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 8:00")
("STYLE_ALL" . "habit"))))
;;;; org-tag and category
;; (setq org-auto-align-tags nil) ; default t, use doom's custom
;; (setq org-tags-column 0) ; default -77
(setq org-agenda-tags-column -80) ;; 'auto ; org-tags-column
(setq org-agenda-show-inherited-tags nil)
(setq org-tag-alist (quote (
(:startgroup) ;; Action
("later" . ?.)
("now" . ?,)
(:endgroup)
("important" . ?i) ; 별도 처리
("waiting" . ?w)
("next" . ?n)
("hold" . ?h)
;; ("crypt" . ?E)
("note" . ?o)
("noexport" . ?x)
("nonum" . ?u)
("ATTACH" . ?a)
("latest" . ?l) ;; latest version
)))
(add-to-list 'org-tags-exclude-from-inheritance "projects") ; projects 왜 구분했었지?
;;;; org-agenda-custom-commands
;; ol-doi ol-w3m ol-bbdb ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail
;; ol-eww ol-bibtex
;; Adapted from http://stackoverflow.com/a/12751732/584121
;; (require 'org-protocol)
(setq org-protocol-default-template-key "L")
(setq org-modules `(org-habit org-protocol))
;; (setq org-agenda-prefix-format
;; '((agenda . " %i %-14:c%?-12t% s")
;; (todo . " %i %-14:c")
;; (tags . " %i %-14:c")
;; (search . " %i %-14:c")))
;; https://www.pygopar.com/creating-new-columns-in-org-agenda
;; Originally from here: https://stackoverflow.com/a/59001859/2178312
(defun gopar/get-schedule-or-deadline-if-available ()
(let ((scheduled (org-get-scheduled-time (point)))
(deadline (org-get-deadline-time (point))))
(if (not (or scheduled deadline))
(format " ")
;; (format "🗓️ ")
" ")))
(setq org-agenda-prefix-format
'((agenda . " %-4e %i %-12:c%?-12t% s ")
(todo . " %i %-10:c %-5e %(gopar/get-schedule-or-deadline-if-available)")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
(when IS-TERMUX
(setq org-agenda-prefix-format
'((agenda . " %i %?-12t% s")
(todo . " %i ")
(tags . " %i ")
(search . " %i "))))
(setq org-agenda-category-icon-alist nil)
(setq org-agenda-hide-tags-regexp
"agenda\\|DONT\\|LOG\\|ATTACH\\|GENERAL\\|BIRTHDAY\\|PERSONAL\\|PROFESSIONAL\\|TRAVEL\\|PEOPLE\\|HOME\\|FINANCE\\|PURCHASES")
(add-hook 'org-agenda-finalize-hook
(lambda ()
;; (setq-local line-spacing 0.2)
(define-key org-agenda-mode-map [(double-mouse-1)] 'org-agenda-goto-mouse)))
(defun cc/org-agenda-goto-now ()
"Redo agenda view and move point to current time '← now'"
(interactive)
(org-agenda-redo)
(org-agenda-goto-today)
(if window-system
(search-forward "← now ─")
(search-forward "now -"))
)
(add-hook 'org-agenda-mode-hook
(lambda ()
(define-key org-agenda-mode-map (kbd "<f2>") 'org-save-all-org-buffers)
(define-key org-agenda-mode-map (kbd "<backspace>") #'evil-switch-to-windows-last-buffer)
(define-key org-agenda-mode-map (kbd "DEL") #'evil-switch-to-windows-last-buffer)
;; (define-key org-agenda-mode-map (kbd "M-p") 'org-pomodoro)
;; (define-key org-agenda-mode-map (kbd "M-P") 'ash/org-pomodoro-til-meeting)
(define-key org-agenda-mode-map (kbd "M-.") 'cc/org-agenda-goto-now)))
;; (setq org-archive-location "archives/%s_archive::")
(setq org-archive-location (file-name-concat org-directory "archives/%s::"))
;; nil 이면 C-c C-o 으로 접근한다.
;; (setq org-mouse-1-follows-link t) ; default 450
(setq org-capture-template-dir (concat doom-user-dir "captures/"))
(setq org-datetree-add-timestamp t)
;;;; Simple is Better
;; See https://orgmode.org/manual/Template-elements.html#index-org_002ddefault_002dnotes_002dfile-1
(setq org-capture-templates nil)
(add-to-list
'org-capture-templates
`("i" "Inbox" entry (file+headline ,(my/org-inbox-file) "Inbox")
"* %?\n%i\n%a"))
(add-to-list
'org-capture-templates
`("I" "Inbox (Work)" entry (file+headline ,(my/org-inbox-file) "Inbox")
"* %? :work:\n%i\n%a"))
(add-to-list
'org-capture-templates
`("p" "Project /w template" entry (file+headline ,(my/org-tasks-file) "Projects")
(file ,(concat org-capture-template-dir "project.capture"))))
(add-to-list
'org-capture-templates
`("l" "links" entry (file ,(my/org-links-file))
"* TODO %(org-cliplink-capture)" :immediate-finish t))
(add-to-list
'org-capture-templates
`("T" "Personal Todo /w clock-in" entry (file ,(my/org-inbox-file))
"* TODO [#C] %?\n%T\n%a\n" :clock-in t :clock-resume t))
)
(with-eval-after-load 'org
(require 'ox-hugo)
;; (setq org-hugo-base-dir (file-truename "~/git/blog/"))
(setq org-hugo-base-dir user-hugo-blog-dir) ;; 2024-10-07 fix quartz
(setq org-hugo-auto-set-lastmod t
org-hugo-suppress-lastmod-period 3600.0) ; 3600.0 1h, (86400.0) 24h, (172800.0) 48h
(setq org-hugo-front-matter-format 'yaml)
;; My blog is created using Hugo and ox-hugo. It generates better markdown than what you would get using org-md-export!
;; It works well out-of-the-box. However, extra configuration is required to embed video.
;; In ox-hugo, uses #+begin_video to generate the <video> HTML5 tag (details in ox-hugo/issues/274).
;; In Hugo config, set markup.goldmark.renderer.unsafe to true (details in discourse.gohugo.io).
(add-to-list 'org-hugo-external-file-extensions-allowed-for-copying "webm")
(setq org-hugo-section "notes") ; 2024-04-26 change
(setq org-hugo-paired-shortcodes "mermaid callout cards details tabs") ; hint sidenote
;; https://ox-hugo.scripter.co/doc/formatting/
;; if org-hugo-use-code-for-kbd is non-nil
;; Requires CSS to render the <kbd> tag as something special.
;; eg: ~kbd~
;; (setq org-hugo-use-code-for-kbd t)
;; https://ox-hugo.scripter.co/doc/linking-numbered-elements/
;; org-export-dictionary 에 Figure, Table 에 한글 번역을 넣으면
;; 한글로 바뀌어 export 될 것이다.
(setq org-hugo-link-desc-insert-type t)
;; 내보낼 때는 fill-column 끈다.
(setq org-hugo-preserve-filling nil) ; important
(setq org-hugo-allow-spaces-in-tags t) ; default t
(setq org-hugo-prefer-hyphen-in-tags t) ; default t
;; Assume all static files are images for now otherwise this
;; defaults to /ox-hugo/mypicture.png which is ugly
(setq org-hugo-default-static-subdirectory-for-externals "images") ; imgs
;; (setq org-hugo-default-static-subdirectory-for-externals "~/git/temp/notes.junghanacs.com/quartz/static/images") ; imgs
;; Override the default `org-hugo-export-creator-string' so that this
;; string is consistent in all ox-hugo tests.
(setq org-hugo-export-creator-string "Emacs + Org-mode + ox-hugo")
;; In that normal example of the sidenote, ox-hugo trims the whitespace around
;; the sidenote block. That is configured by customizing the
;; org-hugo-special-block-type-properties variable:
(progn
(add-to-list 'org-hugo-special-block-type-properties '("mermaid" :raw t))
(add-to-list 'org-hugo-special-block-type-properties '("callout" :raw t))
(add-to-list 'org-hugo-special-block-type-properties '("cards" :raw t))
(add-to-list 'org-hugo-special-block-type-properties '("details" :raw t)))
;; (add-to-list 'org-hugo-special-block-type-properties '("sidenote" . (:trim-pre t :trim-post t)))
;; If this property is set to an empty string, this heading will not be auto-inserted.
;; default value is 'References'
;; https://ox-hugo.scripter.co/doc/org-cite-citations/
(plist-put org-hugo-citations-plist :bibliography-section-heading "References")
(defun my/insert-white-space ()
(interactive)
(insert " "))
(defun +org-export-remove-white-space (text _backend _info)
"Remove zero width spaces from TEXT."
(unless (org-export-derived-backend-p 'org)
(replace-regexp-in-string " " "" text)))
(add-to-list 'org-export-filter-final-output-functions #'+org-export-remove-white-space t)
(evil-define-key '(insert normal) text-mode-map (kbd "M-m") #'my/insert-white-space)
)
;;;; org-glossary
(use-package! org-glossary
:after org
:init
(setq org-glossary-idle-update-period 1.0) ; 0.5
(setq org-glossary-autodetect-in-headings t) ; 2024-06-13 new
;; :hook (org-mode . org-glossary-mode)
:config
(setq org-glossary-collection-root (concat org-directory "dict/"))
;; (setq org-glossary-global-terms "global")
(define-key org-mode-map (kbd "C-}") 'org-glossary-insert-term-reference)
(define-key org-mode-map (kbd "C-{") 'org-glossary-create-definition)
(define-key org-mode-map (kbd "C-\"") 'org-glossary-create-definition)
;; (setq org-glossary-automatic nil) ;; disable auto-export
)
;;;; org-rainbow-tags
(use-package! org-rainbow-tags
:after org
:init
(setq org-rainbow-tags-hash-start-index 0)
(setq org-rainbow-tags-extra-face-attributes
'(:inverse-video t :box nil :weight 'bold))
:hook (org-mode . org-rainbow-tags-mode)
)
;;;; org-download
(use-package! org-download
:after org
:hook (;; (dired-mode . org-download-enable)
(org-mode . org-download-enable))
:commands (org-download-enable
org-download-yank
org-download-screenshot)
:config
(setq-default org-download-heading-lvl nil)
(setq org-download-method 'directory) ; doom 'attach
(setq-default org-download-image-dir (concat org-directory "screenshot" )) ;; share all devieces
(setq org-download-display-inline-images nil)
(setq org-download-timestamp"%Y%m%dT%H%M%S--") ;; denote id
;; #+caption: "
;; #+name: fig-"
;; #+attr_html: :width 40% :align center"
;; #+attr_latex: :width \\textwidth"
(setq org-download-image-attr-list
'("#+attr_html: :width 80% :align center"
"#+attr_latex: :width \\textwidth"
"#+attr_org: :width 800px"))
(defun kimim/org-download-annotate (link)
"Annotate LINK with the time of download."
(format "#+name: fig:%s\n#+caption: %s\n"
(file-name-base link) (file-name-base link)))
(setq org-download-annotate-function #'kimim/org-download-annotate)
)
;;;; org-journal
(progn
(require 'org-journal)
(setq org-journal-dir (concat user-org-directory "journal"))
(setq org-journal-date-format "%Y-%m-%d")
(setq org-journal-file-format "%Y%m%dT000000--%Y-%m-%d__journal.org")
;; (setq org-journal-time-prefix "** ") ; default **
;; (setq org-journal-time-format "%R ")
(setq org-journal-carryover-items "TODO=\"TODO\"|TODO=\"NEXT\"")
)
(use-package! org-modern
;; :init
;; (after! org
;; (require 'org-modern)
;; (add-hook 'org-mode-hook #'org-modern-mode)
;; (add-hook 'org-agenda-finalize-hook #'org-modern-agenda))
:custom
(org-modern-table nil)
(org-modern-keyword nil)
(org-modern-timestamp nil)
(org-modern-priority nil)
(org-modern-checkbox nil)
(org-modern-tag nil)
(org-modern-block-name nil)
(org-modern-footnote nil)
(org-modern-internal-target nil)
(org-modern-radio-target nil)
(org-modern-statistics nil)
(org-modern-progress nil)
)
(use-package! org-fragtog
:after org
:hook (org-mode . org-fragtog-mode)
:init
(setq org-startup-with-latex-preview t) ; doom nil
(setq org-highlight-latex-and-related '(native script entities)) ; doom org +pretty
;; (setq org-highlight-latex-and-related '(native)) ; doom nil
)
(use-package! org-transclusion