-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path+user-configs.el
5531 lines (4600 loc) · 194 KB
/
+user-configs.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
;;; +user-configs.el -*- lexical-binding: t; -*-
(message "load +user-configs.el")
;;; Doom Common Configuration
;;;; GENERAL SETTINGS
;; /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
;; 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)
;;;; gc-cons : gcmh
;; (setq gcmh-idle-delay 5) ; doom 'auto
;; (setq gcmh-high-cons-threshold (* 100 1024 1024)) ; doom 16m
;; (setq gc-cons-threshold gcmh-high-cons-threshold)
;; (setq garbage-collection-messages t)
;;;; 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-,") ; emacs insert mode
;; persp-mode and projectile in different prefixes
;; (setq! persp-keymap-prefix (kbd "C-c w"))
;; (after! projectile
;; (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
(defun my/call-localleader ()
(interactive)
(setq unread-command-events (listify-key-sequence ",")))
(map! :leader (:desc "+major-mode" "m" #'my/call-localleader))
(after! evil
;; (global-set-key (kbd "M-m") #'my/call-localleader)
(evil-define-key '(normal visual) prog-mode-map (kbd "C-,") 'my/call-localleader))
;;;; Doom-Font
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-unicode-font' -- for unicode glyphs
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
(when (display-graphic-p) ; gui
(setq
doom-font (font-spec :family "Monoplex KR Nerd" :size 14.0)
doom-big-font (font-spec :family "Monoplex KR Nerd" :size 23.0))
(setq doom-variable-pitch-font (font-spec :family "Pretendard Variable" :size 14.0))
(setq doom-unicode-font (font-spec :family "Symbola" :size 14.0))
;; (setq doom-font (font-spec :family "Sarasa Term K Nerd Font" :size 15.1)
;; doom-big-font (font-spec :family "Sarasa Term K Nerd Font" :size 21.1))
)
(unless (display-graphic-p) ; terminal
(setq doom-font (font-spec :family "Sarasa Term K Nerd Font" :size 15.1)))
;;;; Hangul Korean
(setq default-input-method "korean-hangul")
(set-language-environment "Korean")
;; (setq default-transient-input-method "TeX") ; C-u set-input-method
(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 "<Alt_R>") 'toggle-input-method)
(global-set-key (kbd "<S-SPC>") 'toggle-input-method)
(global-set-key (kbd "<Hangul>") 'toggle-input-method)
(global-set-key (kbd "<menu>") 'toggle-input-method) ;; caps lock as <menu>
(add-hook 'context-menu-mode-hook '(lambda () (define-key context-menu-mode-map (kbd "<menu>") #'toggle-input-method)))
;; (global-unset-key (kbd "S-SPC"))
;; +------------+------------+
;; | 일이삼사오 | 일이삼사오 |
;; +------------+------------+
;; | ABCDEFGHIJ | ABCDEFGHIJ |
;; +------------+------------+
;; | 1234567890 | 1234567890 |
;; +------------+------------+
;; | 일이삼사오 | 일이삼사오 |
;; | abcdefghij | abcdefghij |
;; +------------+------------+
;;;; Basics
;; (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)
;; default 120 emacs-29, 60 emacs-28
(setq kill-ring-max 30) ; keep it small
;; Disable .# lock files
(setq create-lockfiles nil)
;; Ridiculous path view is vanilla emacs. change truename!
;; truename 을 원하지 않는다. 심볼링링크대로 쓰고 싶다. nil 로 사용한다.
;; (setq find-file-visit-truename t)
;;;; initial-scratch-message
(setq initial-scratch-message user-initial-scratch-message)
;;;; Tab-width
;; ====== Buffer-local variables ======
;; (setq-default
;; ;; Display long lines
;; truncate-lines nil ; default t
;; ;; Default fill column width
;; fill-column 80
;; ;; Never mix, use only spaces
;; indent-tabs-mode nil ;; Width for line numbers display-line-numbers-width 4
;; ;; 1) per major-mode config or hook
;; ;; 2) editorconfig
;; ;; 3) tab-width 4 (below)
;; ;; tab-width 4 ;; 2024-03-11 org-mode element-cache 사용 시 무조건 8이다. 충돌난다. 끈다.
;; display-line-numbers-width-start t ; 2024-06-26
;; )
;;;; Display-Line-Numbers-Mode
;; 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:
;; 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)
(remove-hook! text-mode #'display-line-numbers-mode)
;; 2024-04-01 disable
;; (unless IS-TERMUX
;; (add-hook 'org-mode-hook 'display-line-numbers-mode)
;; (add-hook 'markdown-mode-hook 'display-line-numbers-mode))
;;;; Time
(require 'time)
(setq display-time-format " |%a %e %b, %H:%M| ")
;; Covered by `display-time-format'
;; (setq display-time-24hr-format t)
;; (setq display-time-day-and-date t)
;; (setq display-time-interval 30) ; default 60
(setq display-time-default-load-average nil)
;; NOTE 2022-09-21: For all those, I have implemented my own solution
;; that also shows the number of new items, although it depends on
;; notmuch: the `notmuch-indicator' package.
(setq display-time-mail-directory nil)
(setq display-time-mail-function nil)
(setq display-time-use-mail-icon nil)
(setq display-time-mail-string nil)
(setq display-time-mail-face nil)
;;;; Calendar
(require 'calendar)
;; (setq org-agenda-start-on-weekday nil)
(add-hook 'calendar-today-visible-hook 'calendar-mark-today)
(setq
calendar-date-style 'iso ;; YYYY/MM/DD
calendar-mark-holidays-flag t
calendar-week-start-day 1 ;; 0 Sunday, 1 Monday
calendar-mark-diary-entries-flag nil
calendar-latitude user-calendar-latitude
calendar-longitude user-calendar-longitude
calendar-location-name user-calendar-location-name
calendar-time-display-form
'(24-hours
":" minutes
(if time-zone
" (")
time-zone
(if time-zone
")")))
;;;; Which-key
(after! which-key
(setq which-key-idle-delay 0.4 ; important
which-key-idle-secondary-delay 0.01)
(setq which-key-use-C-h-commands t) ; paging key maps
(setq which-key-max-description-length 29) ; doom 27, spacemacs 36
)
;;;; evil
;; Key binding guide
;; https://discourse.doomemacs.org/t/how-to-re-bind-keys/
;; NOTE: use `map!' macro for convienience
;; ------------------------------------------------
;; Key binding vars
(after! evil
;; Implicit /g flag on evil ex substitution, because I use the default behavior less often.
(setq evil-ex-substitute-global t) ; default nil
;; 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
;; 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)
;; '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
;; Don't put overwritten text in the kill ring
(setq evil-kill-on-visual-paste nil) ; default t
;; Change Doom's Default
(setq +evil-want-o/O-to-continue-comments nil)
(setq +default-want-RET-continue-comments nil)
(setq evil-disable-insert-state-bindings t) ; 2024-10-25 default nil
(setq evil-want-fine-undo t) ; doom 'nil
;; 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)
;; (setq evil-insert-state-cursor '(box "#F86155")) ;; better look
;; (setq evil-normal-state-cursor '(box "DarkGoldenrod2"))
;; 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
;; ;; (define-key evil-insert-state-map (kbd "C-k") 'kill-line) ; 2024-06-11 disable conflict with corfu-previous
;; 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 이거면 충분하다.
;; [[file:~/spacemacs/doc/DOCUMENTATION.org::*Binding keys][Binding keys]]
(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 $ ^
;; (define-key evil-normal-state-map (kbd "C-a") 'evil-beginning-of-line)
;; (define-key evil-normal-state-map (kbd "C-e") 'evil-end-of-line-or-visual-line)
;; (define-key evil-insert-state-map (kbd "C-a") 'evil-beginning-of-line)
;; (define-key evil-insert-state-map (kbd "C-e") 'evil-end-of-line-or-visual-line)
;; M-d region delete and C-d char delete
(define-key evil-insert-state-map (kbd "C-d") 'delete-forward-char)
;; 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 'normal 'evil-org-mode-map "X" 'delete-backward-char))
) ; end-of after evil
;;;; evil cursor with toggle-input-method
(after! evil
;; keep evil insert cursor status per input-method
;; 2024-04-09 커서 상태 기반 한영 입력! 커서를 신뢰하라!
;; 2024-09-19 org 모드에서 동작이 영 안좋다. 끈다.
;; - 버퍼 전환 시 커서 상태 유지
;; - 커서를 보면 input-method 온오프를 알 수 있다.
;; - 한영 전환은 insert 모드에서만 가능
;;;###autoload
(defun block-toggle-input-method ()
(interactive)
(message (format "Input method is disabled in <%s> state." evil-state)))
(mapc
(lambda (mode)
(let ((keymap (intern (format "evil-%s-state-map" mode))))
(define-key (symbol-value keymap) (kbd "<Hangul>") #'block-toggle-input-method)
(define-key (symbol-value keymap) (kbd "S-SPC") #'block-toggle-input-method)
(define-key (symbol-value keymap) (kbd "<menu>") #'block-toggle-input-method)))
'(motion normal visual))
;; ;;;###autoload
;; (defun check-evil-cursor-state-between-window-switch ()
;; (let ((type
;; (pcase current-input-method ('nil 'bar) ("korean-hangul" 'hbar))))
;; (setq-local evil-insert-state-cursor type)))
;; ;;;###autoload
;; (defun toggle-input-method-with-evil-cursor-switch ()
;; (interactive)
;; (toggle-input-method)
;; (check-evil-cursor-state-between-window-switch)
;; ;; (message (format "Input method is disabled in <%s> state." evil-state))
;; )
;; (mapc
;; (lambda (mode)
;; (let ((keymap (intern (format "evil-%s-state-map" mode))))
;; (define-key
;; (symbol-value keymap) (kbd "<Hangul>") #'toggle-input-method-with-evil-cursor-switch)
;; (define-key
;; (symbol-value keymap) (kbd "S-SPC") #'toggle-input-method-with-evil-cursor-switch)))
;; '(insert))
;; (add-hook 'evil-insert-state-entry-hook 'check-evil-cursor-state-between-window-switch 90)
;; (defadvice! change-cursor-after-toggle-input (fn &optional arg interactive)
;; :around #'toggle-input-method
;; :around #'set-input-method (funcall fn arg interactive)
;; (let ((type
;; (pcase current-input-method
;; ('nil 'bar)
;; ("korean-hangul" 'hbar))))
;; (setq-local evil-insert-state-cursor type)))
)
;;;; evil-escape
;; ,. 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))
;;;; undo-fu
(after! undo-fu
;; undo-fu
(define-key evil-normal-state-map (kbd "u") 'undo-fu-only-undo)
(define-key evil-normal-state-map (kbd "\C-r") 'undo-fu-only-redo)
(unbind-key "C-M-_" 'undo-fu-mode-map)
(global-unset-key (kbd "C-M-_")))
;; 스페이스맥스와 다르네?! 아래는 스페이스맥스 설정
;; ;; C-r 은 isearch-backward 가 기본
;; (define-key evil-normal-state-map "u" 'undo-fu-only-undo)
;; (define-key evil-normal-state-map "\C-r" 'undo-fu-only-redo)
;; ;; Undo-fu customization options
;; ;; Undoing with a selection will use undo within that region.
;; (setq undo-fu-allow-undo-in-region t)
;; ;; Use the `undo-fu-disable-checkpoint' command instead of Ctrl-G `keyboard-quit' for non-linear behavior.
;; (setq undo-fu-ignore-keyboard-quit t)
;; ;; By default while in insert all changes are one big blob. Be more granular
;; (setq evil-want-fine-undo t)
;;;; set-popup-rules
(progn
;; Disabling hidden mode-line in popups
;; By default, the mode-line is hidden in popups. To disable this, you can either:
;; (plist-put +popup-defaults :modeline t)
;; Completely disable management of the mode-line in popups:
;; (remove-hook '+popup-buffer-mode-hook #'+popup-set-modeline-on-enable-h) ; important
;; (setq +popup--display-buffer-alist nil) ; reset all
;; default popup rules
(set-popup-rules!
'(
;; ("^\\*scratch*" :ignore t) ; for TEST
("^\\.doom.d/diary" :ignore t) ; for TEST
("^\\*Completions" :ignore t)
("*Org Preview LaTeX Output*" :ingnore t) ; 2025-01-24
("^\\*Local variables\\*$" :vslot -1 :slot 1 :size +popup-shrink-to-fit)
;; ("^\\*\\(?:[Cc]ompil\\(?:ation\\|e-Log\\)\\|Messages\\)" :vslot -2 :size 0.3 :autosave t :quit t :ttl nil) ; +default
("^\\*Compil\\(?:ation\\|e-Log\\)" :size 0.3 :ttl 0 :quit t)
("^\\*Messages\\*" :vslot -4 :side right :size 0.4 :quit t :ttl 0) ; jh
("^\\*\\(?:doom \\|Pp E\\)" ; transient buffers (no interaction required)
:vslot -3
:size +popup-shrink-to-fit
:autosave t
:select ignore
:quit t
:ttl 0)
("^\\*doom:" ; editing buffers (interaction required)
:vslot -4
:size 0.35
:side right
:autosave t
:select t
:modeline t
:quit nil
:ttl t)
("^\\*doom:\\(?:v?term\\|e?shell\\)-popup" ; editing buffers (interaction required)
:vslot -5
:size 0.35
:select t
:modeline nil
:quit nil
:ttl nil)
("^\\*\\(?:Wo\\)?Man " :vslot -6 :size 0.45 :select t :quit t :ttl 0)
("^\\*Calc" :vslot -7 :side bottom :size 0.4 :select t :quit nil :ttl 0)
("^\\*Customize" :slot 2 :side right :size 0.5 :select t :quit nil)
("^ \\*undo-tree\\*" :slot 2 :side left :size 20 :select t :quit t)
;; `help-mode', `helpful-mode'
("^\\*\\([Hh]elp\\|Apropos\\)" :slot 2 :vslot -8 :size 0.42 :select t)
;; ("^\\*eww\\*" ; `eww' (and used by dash docsets)
;; :vslot -11 :size 0.35 :select t)
("^\\*xwidget" :vslot -11 :size 0.35 :select nil)
;; ("*Org Agenda(n)*" :size 0.5 :side left :select nil :quit nil :ttl 0)
("^\\*eww.*" :size 82 :side left :modeline t :select t :quit nil :ttl t) ; jh
("*Ilist*" :size 45 :side left :modeline nil :select nil :quit nil)
;; ("^ ?\\*Treemacs" :slot 7 :size 45 :side left :modeline nil :select nil :quit nil)
;; ("^ ?\\*NeoTree" :slot 7 :size 45 :side left :modeline t :slect nil :quit nil)
;; ("^\\*gptel\\*" :size 84 :side right :modeline t :select t :quit nil :ttl t)
;; ("^\\*gptel-ask\\*" :size 80 :side right :modeline nil :select nil :quit nil)
;; ("^\\*gptel-quick\\*" :size 80 :side right :modeline nil :select nil :quit nil)
;; "*EKG Capture.*\\*" "*EKG Edit.*\\*" "*[Ee][Kk][Gg] .*\\*"
;; ("*EKG Capture.*\\*" :slot 3 :side bottom :size 0.4 :select t :quit nil) ; jh
;; ("*EKG Edit.*\\*" :slot 3 :side bottom :size 0.4 :select t :quit nil) ; jh
("*Go-Translate*" :side bottom :size 0.4 :select t :quit t) ; jh
("\\`\\*evil-owl\\*\\'" :side bottom :ttl t :height 20 :quit t)
;; ("\\*Embark Actions\\*" :side bottom :ttl t :height 20 :quit t) ; mixed
;; ("^\\*info\\*$" :slot 2 :vslot 2 :size 0.45 :select t))
("^\\*info\\*$"
:slot 2
:vslot 2
:size 82
:side left
:modeline t
:select t
:ttl nil)) ;; `Info-mode' jh
)
;; (add-hook 'imenu-list-major-mode-hook (lambda (tab-line-mode -1) ))
;; 와우 이거다. 태그랑 쓰기랑 나눠야 한다.
;; (add-to-list
;; 'display-buffer-alist
;; `("*ekg tag.*\\*"
;; (display-buffer-reuse-window display-buffer-in-direction)
;; (direction . left)
;; (window . root)
;; (window-width . 0.35)))
;; 2024-03-19 sdcv 에서 가져옴. 이게 괜찮은듯
;; (add-to-list
;; 'display-buffer-alist
;; `("^\\*eww.*"
;; (display-buffer-reuse-window
;; display-buffer-in-direction)
;; (direction . right)
;; (window . root)
;; (window-width . 0.35)))
(set-popup-rule! "^\\*eww.*" :size 84 :side 'right :modeline t :select t :ttl nil)
;; (set-popup-rule! "\\`\\*chatgpt\\* " :ttl t :side 'bottom :height 20 :quit t :select t)
;; ;; (set-popup-rule! "^\\*Messages\\*" :ttl t :side 'bottom :height 20 :quit t :ttl t)
;; (set-popup-rule! "^\\*doom:vterm*" :ttl t :side 'bottom :height 20 :quit t)
;; (set-popup-rule! "^\\*npm*" :ttl t :side 'bottom :height 20 :quit t)
;; (set-popup-rule! "^\\*Flycheck*" :ttl t :side 'bottom :height 20 :quit t)
;; from prot's dotfiles : important
(add-to-list
'display-buffer-alist
`("\\`\\*\\(Warnings\\|Compile-Log\\|Org Links\\)\\*\\'"
(display-buffer-no-window)
(allow-no-window . t)))
)
;;;; bookmark
;; On each machine I use, I have different bookmarks, yet they all
;; point to the same location.
(setq bookmark-default-file "~/emacs-bookmarks.el")
;; (setq bookmark-default-file (concat user-dotemacs-dir "assets/bookmarks"))
(setq bookmark-use-annotations nil)
(setq bookmark-automatically-show-annotations t)
;; Save the `bookmark-file' each time I modify a bookmark.
(setq bookmark-save-flag 1)
;; https://www.emacswiki.org/emacs/BookmarkPlus
;;
;; Enhancements to the built-in Emacs bookmarking feature.
;; (use-package! bookmark+)
;; (define-key bookmark-bmenu-mode-map (kbd "s-o") #'ace-window)
;; when this is not set to `nil' explicitly, auto-save bookmarks
;; gets itself into an infinite loop attempting to autosave and
;; write the custom value to custom-file.el. this happens only when
;; the buffer associated with the bookmark has not been saved. (to
;; reproduce the issue, remove the customize-set-value sexp, find a
;; new file, and wait 30 seconds; it'll start printing messages like
;; mad. C-g will eventually break the loop.) i only use one
;; bookmark file so this isn't a problem but it really does seem
;; like a bmkp bug.
;; (customize-set-value 'bmkp-last-as-first-bookmark-file nil)
;; auto-set bookmarks.
;; (setq bmkp-automatic-bookmark-mode-delay 30))
;;;; show-trainling-whitespace
;; https://idiomdrottning.org/show-trailing-whitespace
;; `show-trailing-whitespace' is my friend.
(setq-hook! (text-mode prog-mode conf-mode) show-trailing-whitespace t)
;; White space cleanup, without obtrusive white space removal.
;; Whitespaces at EOL and EOF are trimmed upon file save, and only for lines modified by you.
;; Much better than globally removing EOL whitespace on save, especially when
;; editing collaboratively with others.
;; README/doomemacs-git/lisp/doom-editor.el
;; (ws-butler-keep-whitespace-before-point nil)
;; (ws-butler-global-exempt-modes '(special-mode comint-mode term-mode eshell-mode diff-mode markdown-mode))
;;;; User Goto Functions
;; (defun goto-emacs-dotfiles.org ()
;; "Open jh-emacs.org file."
;; (interactive)
;; (find-file (concat dotspacemacs-directory "jh-emacs.org")))
(defun goto-pandoc-config ()
"Open pandoc metadata file."
(interactive)
(find-file "~/.config/pandoc/metadata.yml"))
;;;; CJK Word Wrap
;; Emacs 28 adds better word wrap / line break support for CJK.
(setq word-wrap-by-category t) ; default nil
;; Normally when word-wrap is on, Emacs only breaks lines after
;; whitespace characters. When this option is turned on, Emacs also
;; breaks lines after characters that have the "|" category (defined in
;; characters.el). This is useful for allowing breaking after CJK
;; characters and improves the word-wrapping for CJK text mixed with
;; Latin text.
;; 일반적으로 단어 줄 바꿈이 켜져 있으면 Emac 은 공백 문자 뒤에 오는 줄만 줄
;; 바꿈합니다. 이 옵션을 켜면 Emac 은 "|" 범주(characters.el 에 정의됨)가 있는 문자
;; 뒤의 줄도 줄 바꿈합니다. 이 옵션은 한중일 문자 뒤에 줄 바꿈을 허용하는 데
;; 유용하며 라틴 텍스트와 혼합된 한중일 텍스트의 단어 줄 바꿈을 개선합니다.
;;;; winner
(after! winner
(setq winner-boring-buffers-regexp "\\*.*\\*")
(define-key evil-window-map "u" 'winner-undo)
(define-key evil-window-map "U" 'winner-redo))
;;;; abbr
(setq abbrev-file-name (concat user-dotemacs-dir "abbrev_defs"))
(read-abbrev-file abbrev-file-name)
(setq save-abbrevs t)
(setq-default abbrev-mode t)
;;;; fill-column-indicator-mode
;; 2023-04-16 Learn how-to use menu-bar for beginner on GUI mode
(when (display-graphic-p) ; gui
(add-hook 'org-mode-hook 'display-fill-column-indicator-mode)
;; (add-hook 'markdown-mode-hook 'display-fill-column-indicator-mode)
)
;;;; backtrace-mode-hook
(add-hook 'backtrace-mode-hook 'display-line-numbers-mode)
(add-hook 'backtrace-mode-hook 'visual-line-mode)
;;;; dabbrev
(progn
(require 'dabbrev)
(setq dabbrev-abbrev-char-regexp "[가-힣A-Za-z-_]")
(setq dabbrev-ignored-buffer-regexps
'("\\` "
"\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"
"\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?"))
(setq dabbrev-abbrev-skip-leading-regexp "[$*/=~']")
(setq dabbrev-upcase-means-case-search nil) ; default t
;; (setq dabbrev-check-all-buffers t) ;; default t
)
;;;; fortune
;; not work on termux
(unless IS-TERMUX
(require 'fortune)
(setq fortune-always-compile nil)
(setq fortune-dir (concat root-path "usr/share/games/fortunes/advice"))
(setq fortune-file (concat root-path "usr/share/games/fortunes/advice")))
;;;; goto-adddr
;; Actionable URLs in Emacs buffers via [[http://xenodium.com/#actionable-urls-in-emacs-buffers][Álvaro Ramírez]].
;; (define-key goto-address-highlight-keymap (kbd "C-c C-o") 'goto-address-at-point)
;;;; autorevert
;; ~/doomemacs-junghan0611/lisp/doom-editor.el
;; (after! autorevert
;; Ensure that files are reloaded from disk (when switching branches, or from dropbox sync)
(global-auto-revert-mode 1) ; doom nil
(setq auto-revert-interval 10)
;;;; DONT custom scrolling
;; (setq
;; ;; Do not adjust window-vscroll to view tall lines
;; auto-window-vscroll nil ; doom nil
;; ;; Keep the point in the same position while scrolling
;; scroll-preserve-screen-position t ; doom t
;; ;; Do not move cursor to the center when scrolling
;; scroll-conservatively 10 ; doom 10
;; ;; Scroll at a margin of one line
;; ;; scroll-margin 1 ; doom 0
;; )
;; (when (fboundp 'pixel-scroll-precision-mode)
;; ;; Better scrolling on Emacs29+, specially on a touchpad
;; (setq pixel-scroll-precision-use-momentum t) ; doom nil
;; (pixel-scroll-precision-mode +1))
;;;; DONT help-mode-hook : visual-line-mode
;; (add-hook 'help-mode-hook #'visual-line-mode)
;;;; Transparency
(if (eq system-type 'gnu/linux)
(setq default-frame-alist
(push '(alpha-background . 93) default-frame-alist)) ;; 93
(setq default-frame-alist (push '(alpha . (95 90)) default-frame-alist)))
;; Emacs 29 ushers in a bold new era where a frame's background can be made
;; transparent without affecting the transparency of foreground text and other
;; elements. Who'd-a thunk? Use that feature when available
(defun toggle-transparency (alpha-level)
(interactive "p")
(message (format "%s" alpha-level))
(when (< alpha-level 50)
(setq alpha-level 90))
(let ((myalpha (or (frame-parameter nil 'alpha) 100))
(frame-param
(if (< emacs-major-version 29)
'alpha
'alpha-background)))
(set-frame-parameter nil frame-param myalpha)
(message (format "Frame %s level is %d" frame-param myalpha))))
(defun set-transparency (alpha-level)
;; in Emacs 29+, set background opacity
;; before 29, we have no choice but to set frame opacity
(interactive "p")
(message (format "Alpha level passed in: %s" alpha-level))
(let ((alpha-level
(if (< alpha-level 2)
(read-number "Opacity percentage: " 90)
alpha-level))
(frame-param
(if (< emacs-major-version 29)
'alpha
'alpha-background)))
(set-frame-parameter nil frame-param alpha-level)
(message (format "Frame %s level is %d" frame-param alpha-level))))
(defalias 'set-opacity 'set-transparency)
(defun set-transparency-low ()
(interactive)
(set-transparency 70))
;;;; golden-ratio
(use-package! golden-ratio)
;;;; emms : music player
;; path
(setq
emms-directory (concat doom-data-dir "emms")
emms-cache-file (concat doom-cache-dir "emms"))
;; M-x emms-add-directory-tree
;;; :emacs
;; move to modules/custom/emacs
;;; :completion corfu vertico
;;;; vertico
(unless IS-TERMUX
(require 'vertico-buffer)
;; (setq vertico-resize 'grow-only) ; doom nil
;; vertico on Top
(setq vertico-buffer-display-action
`(display-buffer-in-side-window
(window-height . ,(+ 3 vertico-count)) (side . top)))
(vertico-mode +1)
(vertico-buffer-mode +1)
;; sachac-dotfiles/Sacha.org
(with-eval-after-load 'vertico-multiform
(add-to-list 'vertico-multiform-categories '(embark-keybinding grid)))
)
;;;; DONT vertico hangul
;; from ohyecloudy
;; vertico는 =post-command-hook= 을 사용해서 증분 완성(incremental completion)을
;; 수행한다. 영문 입력시 =post-command-hook= 이 잘 발동하지만 조합해서 입력하는
;; 한글은 =post-command-hook= 이 호출되지 않는다. helm 동작 방법을 참고해
;; timer를 돌려서 해결했다.
;; (after! vertico
;; (defun my/vertico-setup-then-remove-post-command-hook (&rest args)
;; "vertico--setup 함수에서 추가하는 post-command-hook을 제거한다.
;; 입력 조합으로 표현하는 한글 입력시 post-command-hook이 입력되지 않는다.
;; 한글 증분 완성을 위해 timer로 호출하기 때문에 제거한다"
;; (remove-hook 'post-command-hook #'vertico--exhibit 'local))
;; (defun my/vertico-exhibit-with-timer (&rest args)
;; "타이머를 넣어 타이머 이벤트 발생시 vertico--exhibit을 호출해 미니버퍼 완성(completion) 후보 리스트를 갱신한다
;; post-command-hook이 발동하지 않는 한글 입력시에도 한글 증분 완성을 하기 위해 timer를 사용한다"
;; (let (timer)
;; (unwind-protect
;; (progn
;; (setq timer
;; (run-with-idle-timer
;; 0.01 'repeat
;; (lambda ()
;; (with-selected-window (or (active-minibuffer-window)
;; (minibuffer-window))
;; (vertico--exhibit)))))
;; (apply args))
;; (when timer
;; (cancel-timer timer)))))
;; (advice-add
;; #'vertico--setup
;; :after #'my/vertico-setup-then-remove-post-command-hook)
;; (advice-add #'vertico--advice :around #'my/vertico-exhibit-with-timer))
;;;; custom consult
(after! consult
;; replace "." search with consul-line in Evil normal state
;; use default "/" evil search
;; (evil-global-set-key 'normal (kbd ".") 'consult-line) ;; see doomkeys.el
;; (evil-global-set-key 'motion (kbd ".") 'consult-line)
;; (evil-global-set-key 'visual (kbd ".") 'consult-line)
;; (map! :leader
;; :g "j i" #'consult-line
;; :g "j I" #'consult-buffer)
;; +default/search-cwd
(defun my/consult-find ()
(interactive)
(consult-find "."))
(defun my/consult-fd ()
(interactive)
(consult-fd "."))
;; spacemacs/layers/+completion/compleseus/funcs.el
;;;###autoload
(defun my/compleseus-search (use-initial-input initial-directory)
(let* ((initial-input
(if use-initial-input
(doom-pcre-quote ;; rxt-quote-pcre
(if (region-active-p)
(buffer-substring-no-properties
(region-beginning) (region-end))
(or (thing-at-point 'symbol t) ""))) ""))
(default-directory
(or initial-directory
(read-directory-name "Start from directory: "))))
(consult-ripgrep default-directory initial-input)))
(defun my/search-cwd-symbol-at-point ()
"Search current folder."
(interactive)
(my/compleseus-search t default-directory))
(setq consult-preview-key "M-m")
;; (setq consult--customize-alist nil)
(consult-customize
+default/search-project +default/search-other-project
+default/search-project-for-symbol-at-point
+default/search-cwd +default/search-other-cwd
+default/search-notes-for-symbol-at-point
+default/search-emacsd
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file
consult--source-recent-file consult--source-project-recent-file consult--source-bookmark
;; custom below
my/search-cwd-symbol-at-point
+lookup/definition
+lookup/implementations
:preview-key '("M-m" :debounce 0.3 "<up>" "<down>" "C-j" "C-k")) ; M-j,k
)
;;;; corfu
;; 2024-11-06 back to default
;; 2024-09-13 기본 설정, jump-out-of-pair 추가
;; DEPRECATED Tab 이 자동 완성이면 괄호 점프랑 충돌 난다. C-j/k C-n/p 는 직관적인 기본 설정이므로 건들이지 않는다.
(after! corfu
;; (setq corfu-auto-delay 0.5) ; doom 0.24
(setq corfu-auto-prefix 4) ; 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))
;; 2025-02-03 disable - use C-c d @org-mode
;; (add-hook! '(org-mode-hook markdown-mode-hook)
;; (defun +corfu-add-cape-dict-h ()
;; (add-hook 'completion-at-point-functions #'cape-dict 0 t)))
;; 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)
)
;;;; DONT corfu-echo
;; 1) add '(package! corfu-popupinfo :disable t)' in packages.el
;; 2) turn on corfu-echo
;; (after! corfu
;; (require 'corfu-echo)
;; (add-hook 'corfu-mode-hook 'corfu-echo-mode)
;; )
;;;; cape with dabbrev
;; (map! :map some-mode-map
;; "C-x e" #'cape-emoji)
;; (add-hook! some-mode (add-hook 'completion-at-point-functions #'some-capf depth t))
;; ;; OR, but note the different call signature
;; (add-hook 'some-mode-hook (lambda () (add-hook 'completion-at-point-functions #'some-capf depth t)))
;; (after! cape
;; (setq cape-dabbrev-min-length 5) ; default 4
;; (setq cape-dabbrev-check-other-buffers #'cape--buffers-major-mode) ; 'some
;; )
;; ;; 2023-07-08 순서 때문에 따로 확실하게 점검한다.
;; (defun cape-markdown-mode-setup ()
;; (interactive)
;; (add-to-list 'completion-at-point-functions #'cape-dict)
;; (add-to-list 'completion-at-point-functions #'cape-file)
;; ;; (add-to-list 'completion-at-point-functions #'cape-history)
;; ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev) ; top
;; )
;; (defun cape-org-mode-setup ()
;; ;; (add-to-list 'completion-at-point-functions #'cape-elisp-block)
;; ;; (add-to-list 'completion-at-point-functions #'cape-history)
;; ;; (add-to-list 'completion-at-point-functions #'cape-dict)
;; (add-to-list 'completion-at-point-functions #'cape-file)
;; ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; ;; (add-to-list 'completion-at-point-functions #'zk-completion-at-point) ;; top
;; )
;; ;; (defun cape-prog-mode-setup ()
;; ;; ;; (add-to-list 'completion-at-point-functions #'cape-file)
;; ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; ;; ;; (add-to-list 'completion-at-point-functions #'cape-history)
;; ;; ;; (add-to-list 'completion-at-point-functions #'cape-keyword) ;; no.1
;; ;; )
;; (add-hook 'markdown-mode-hook 'cape-markdown-mode-setup)
;; (add-hook 'org-mode-hook 'cape-org-mode-setup)
;; ;; (add-hook 'conf-mode-hook 'cape-prog-mode-setup)
;; ;; (add-hook 'prog-mode-hook 'cape-prog-mode-setup)
;;; :checkers
;;;; Eldoc
(progn
(require 'eldoc)
(setq eldoc-idle-delay 0)
(setq eldoc-echo-area-use-multiline-p nil) ; important - default 'truncate-sym-name-if-fit
(setq eldoc-echo-area-display-truncation-message nil)
(setq eldoc-echo-area-prefer-doc-buffer t) ; default nil - alway show echo-area
)
;; =M-x eldoc-doc-buffer= 함수 호출로 표시하는 buffer 크기 조절
;; (set-popup-rule! "^\\*eldoc for" :size 0.2 :vslot -1)
;; eldoc-display-functions '(eldoc-display-in-echo-area eldoc-display-in-buffer)