-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
1691 lines (1439 loc) · 57.6 KB
/
init.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
;;; init.el --- My init.el -*- lexical-binding: t; -*-
;; Copyright (C) bluehive@github.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; My init.el.
;; byte compile ;;;;;;;;;;;;;; emacs --batch -f batch-byte-compile init.el
;;; Code:
;; this enables this running method
;; emacs -q -l ~/.debug.emacs.d/init.el
;; GCの設定
;; 起動にも影響するのでleaf無しで最初にやります
;; https://github.com/ncaq/.emacs.d/blob/master/init.el
(setq gc-cons-threshold 200000000) ; 200MB
(run-with-idle-timer 120 t #'garbage-collect) ; 2分のアイドル時間ごとに明示的にガベージコレクトを呼び出す
(eval-and-compile
(when (or load-file-name byte-compile-current-file)
(setq user-emacs-directory
(expand-file-name
(file-name-directory (or load-file-name byte-compile-current-file))))))
(customize-set-variable
'package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
;; ("melpa" . "http://melpa.milkbox.net/packages/")
("melpa" . "https://melpa.org/packages/")
;; ("melpa-stable" . "https://stable.melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
(package-initialize)
(unless (package-installed-p 'leaf)
(package-refresh-contents)
(package-install 'leaf))
;;
(leaf leaf-keywords
:ensure t
:init
;; optional packages if you want to use :hydra, :el-get, :blackout,,,
(leaf hydra :ensure t)
(leaf el-get :ensure t)
(leaf blackout :ensure t)
:config
;; initialize leaf-keywords.el
(leaf-keywords-init))
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;; @ language - coding system ;;;
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 重要 日本語Windowsの文字コード対策
;; https://www49.atwiki.jp/ntemacs/pages/16.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ------------------------------------------------------------------------
;; @ character code (文字コード)
;; Setenv
(set-language-environment "Japanese")
(setenv "LANG" "ja_JP.UTF-8")
(when (equal system-type 'ns)
(require 'ucs-normalize)
(setq prefer-coding-system 'utf-8)
(setq locale-coding-system nil)
(setq default-process-coding-system '(utf-8 . cp932)) ;agで日本語検索させるためのおまじない
(setq set-file-name-coding-system 'cp932)
(setq set-keyboard-coding-system 'cp932)
(setq set-terminal-coding-system 'cp932)
)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Encoding
;; UTF-8 as the default coding system
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when (fboundp 'set-charset-priority)
(set-charset-priority 'unicode))
;; Explicitly set the prefered coding systems to avoid annoying prompt
;; from emacs (especially on Microsoft Windows)
(prefer-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(set-language-environment 'utf-8)
(set-default-coding-systems 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-file-name-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
;; Environment
;;(when (or sys/mac-x-p sys/linux-x-p)
;; (use-package exec-path-from-shell
;; :init
;; (setq exec-path-from-shell-check-startup-files nil
;; exec-path-from-shell-variables '("PATH" "MANPATH")
;; exec-path-from-shell-arguments '("-l"))
;; (exec-path-from-shell-initialize)))
;; 環境を日本語、UTF-8にする
;(set-locale-environment nil)
(setq buffer-file-coding-system 'utf-8)
;font
;(set-fontset-font t 'japanese-jisx0208 "IPAPGothic-11")
;;
;;;;;;;;;;;;;;;;;;;;;;
;; Colors and Fonts ;;
;; https://github.com/cdepillabout/docs/blob/53086c3cd34db01d001997e24d79ad9e0ec4cc8e/dot_files/dot_emacs
;;;;;;;;;;;;;;;;;;;;;;
(load-theme 'manoj-dark)
;; Set the default font.
(set-face-attribute 'default nil
:family "Source Code Pro"
:height 140
:weight 'normal
:width 'normal)
;; Set the cursor color to red to match Vim in the terminal.
(set-cursor-color "red")
;; Set the EOL whitespace to be colored in white.
(set-face-attribute 'trailing-whitespace nil
:background "white")
;; Set the default font for Japanese characters.
(set-fontset-font t 'japanese-jisx0208 (font-spec :family "IPAPGothic"))
;; Style the tab-bar so it looks like my Vim tab-bar.
;; (set-face-attribute 'tab-bar nil
;; :background "white"
;; :foreground "black")
;; (set-face-attribute 'tab-bar-tab nil
;; :background "deep sky blue"
;; :foreground "white"
;; :box 'nil
;; :weight 'bold)
;; (set-face-attribute 'tab-bar-tab-inactive nil
;; ;; :background "deep sky blue"
;; :foreground "black"
;; :box 'nil
;; :weight 'normal
;; )
(with-eval-after-load "org"
(if (display-graphic-p)
;; faces to set if we are in the GUI
(progn
(set-face-attribute 'org-level-2 nil :foreground "dark goldenrod" :weight 'bold)
(set-face-attribute 'org-level-3 nil :foreground "firebrick" :weight 'bold)
(set-face-attribute 'org-special-keyword nil :foreground "light gray" :weight 'light)
(set-face-attribute 'org-date nil :foreground "dark magenta" :underline nil :weight 'normal)
(set-face-attribute 'org-tag nil :foreground "cornflower blue" :weight 'light)
)
;; faces to set if we are in the CUI
(set-face-attribute 'org-level-2 nil :foreground "color-116" :weight 'bold)
(set-face-attribute 'org-level-3 nil :foreground "color-41" :weight 'bold)
(set-face-attribute 'org-level-4 nil :weight 'bold)
(set-face-attribute 'org-level-5 nil :weight 'bold)
(set-face-attribute 'org-special-keyword nil :foreground "color-95" :weight 'light)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ここにいっぱい設定を書く
;; https://emacs-jp.github.io/tips/emacs-in-2020
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;leafの :custom で設定するとinit.elにcustomが勝手に設定を追記します。 この状況になると、変数の二重管理になってしまうので、customがinit.elに追記しないように設定します。
(leaf cus-edit
:doc "tools for customizing Emacs and Lisp packages"
:tag "builtin" "faces" "help"
:custom `((custom-file . ,(locate-user-emacs-file "custom.el"))))
;;cus-start.c EmacsのC言語部分で定義されている変数をcustomで扱えるようにまとめているファイルです。 私の設定を書いておくので、取捨選択して頂ければと思います。変数の説明は F1 v で確認できます。
(leaf cus-start
:doc "define customization properties of builtins"
:tag "builtin" "internal"
:preface
(defun c/redraw-frame nil
(interactive)
(redraw-frame))
:bind (("M-ESC ESC" . c/redraw-frame))
:custom '(;;(user-full-name . "Naoya Yamashita")
;;(user-mail-address . "[email protected]")
;;(user-login-name . "conao3")
(create-lockfiles . nil)
(debug-on-error . t)
(init-file-debug . t)
(frame-resize-pixelwise . t)
(enable-recursive-minibuffers . t)
(history-length . 1000)
(history-delete-duplicates . t)
(scroll-preserve-screen-position . t)
(scroll-conservatively . 100)
(mouse-wheel-scroll-amount . '(1 ((control) . 5)))
(ring-bell-function . 'ignore)
(text-quoting-style . 'straight)
(truncate-lines . t)
;; (use-dialog-box . nil)
;; (use-file-dialog . nil)
(menu-bar-mode . t)
;; (tool-bar-mode . nil)
(scroll-bar-mode . nil)
(indent-tabs-mode . nil))
:config
(defalias 'yes-or-no-p 'y-or-n-p)
(keyboard-translate ?\C-h ?\C-?))
;;
(eval-and-compile
(leaf bytecomp
:doc "compilation of Lisp code into byte code"
:tag "builtin" "lisp"
:custom (byte-compile-warnings . '(cl-functions))))
;;Emacsの外でファイルが書き変わったときに自動的に読み直すマイナーモードです。 もちろん、Emacsで編集している場合は外の変更で上書きされることはありません。
(leaf autorevert
:doc "revert buffers when files on disk change"
:tag "builtin"
:custom ((auto-revert-interval . 0.3)
(auto-revert-check-vc-info . t))
:global-minor-mode global-auto-revert-mode)
;;delsel
;;選択している状態で入力したときに、regionを削除して挿入するマイナーモードです。 おそらくこの挙動のほうが現代人の意図に合っていると思います。
(leaf delsel
:doc "delete selection if you insert"
:tag "builtin"
:global-minor-mode delete-selection-mode)
;;paren
;;対応するカッコを強調表示するマイナーモードです。
(leaf paren
:doc "highlight matching paren"
:tag "builtin"
:custom ((show-paren-delay . 0.1))
:global-minor-mode show-paren-mode)
;;simple
;;kill-ringの数を制御したり、kill-lineの挙動を変更したりします。
(leaf simple
:doc "basic editing commands for Emacs"
:tag "builtin" "internal"
:custom ((kill-ring-max . 100)
(kill-read-only-ok . t)
(kill-whole-line . t)
(eval-expression-print-length . nil)
(eval-expression-print-level . nil)))
;;files
;;Emacsで好みが分かれる設定として、バックアップファイルを開いているファイルと同じディレクトリに作成するという挙動があります。 実際、このバックアップファイルに助けられることもあるので、 .emacs.d 以下にディレクトリを掘って、そこに保存するようにします。
(leaf files
:doc "file input and output commands for Emacs"
:tag "builtin"
:custom `((auto-save-timeout . 15)
(auto-save-interval . 60)
(auto-save-file-name-transforms . '((".*" ,(locate-user-emacs-file "backup/") t)))
(backup-directory-alist . '((".*" . ,(locate-user-emacs-file "backup"))
(,tramp-file-name-regexp . nil)))
(version-control . t)
(delete-old-versions . t)))
;;startup
;;自動保存されたファイルのリストです。 .emacs.d/backup 以下にまとめて保存するようにします。
(leaf startup
:doc "process Emacs shell arguments"
:tag "builtin" "internal"
:custom `((auto-save-list-file-prefix . ,(locate-user-emacs-file "backup/.saves-"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; add package
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;2.2 utility https://github.com/takeokunn/.emacs.d/blob/master/index.org
(leaf dash :ensure t)
(leaf dash-functional :ensure t)
(leaf s :ensure t)
(leaf f :ensure t)
(leaf ht :ensure t)
(leaf general :ensure t)
;;(leaf org-mode :ensure t)
;6.14 File;;6.14.1 recentf
(leaf recentf
:ensure t
:setq-default ((recentf-max-saved-items . 10000)
(recentf-auto-cleanup quote never)
(recentf-save-file . "~/.emacs.d/.recentf")
(recentf-exclude quote
(".recentf")))
:config
(recentf-mode 1))
;; https://emacs-jp.github.io/tips/emacs-in-2020 ;;
;;ivyはミニバッファの補完を強化するパッケージです。
;;補完が強化され、 M-x はこのような表示になります。 コマンドの断片で検索できるようになるので、あえてキーバインドを与えず、 M-x から起動する方法も便利です。 この補完では正規表現が使えるので、 ^ivy- をクエリーを入力すれば、 ivy パッケージのインタラクティブ関数が一覧できます。
(leaf ivy
:doc "Incremental Vertical completYon"
:req "emacs-24.5"
:tag "matching" "emacs>=24.5"
:url "https://github.com/abo-abo/swiper"
:emacs>= 24.5
:ensure t
:blackout t
:leaf-defer nil
:custom ((ivy-initial-inputs-alist . nil)
(ivy-re-builders-alist . '((t . ivy--regex-fuzzy)
(swiper . ivy--regex-plus)))
(ivy-use-selectable-prompt . t))
:global-minor-mode t
:config
(leaf swiper
:doc "Isearch with an overview. Oh, man!"
:req "emacs-24.5" "ivy-0.13.0"
:tag "matching" "emacs>=24.5"
:url "https://github.com/abo-abo/swiper"
:emacs>= 24.5
:ensure t
:bind (("C-s" . swiper)))
(leaf counsel
:doc "Various completion functions using Ivy"
:req "emacs-24.5" "swiper-0.13.0"
:tag "tools" "matching" "convenience" "emacs>=24.5"
:url "https://github.com/abo-abo/swiper"
:emacs>= 24.5
:ensure t
:blackout t
:bind (("C-S-s" . counsel-imenu)
("C-x C-r" . counsel-recentf))
:custom `((counsel-yank-pop-separator . "\n----------\n")
(counsel-find-file-ignore-regexp . ,(rx-to-string '(or "./" "../") 'no-group)))
:global-minor-mode t))
(leaf ivy-rich
:doc "More friendly display transformer for ivy."
:req "emacs-24.5" "ivy-0.8.0"
:tag "ivy" "emacs>=24.5"
:emacs>= 24.5
:ensure t
:after ivy
:global-minor-mode t)
(leaf prescient
:doc "Better sorting and filtering"
:req "emacs-25.1"
:tag "extensions" "emacs>=25.1"
:url "https://github.com/raxod502/prescient.el"
:emacs>= 25.1
:ensure t
:commands (prescient-persist-mode)
:custom `((prescient-aggressive-file-save . t)
(prescient-save-file . ,(locate-user-emacs-file "prescient")))
:global-minor-mode prescient-persist-mode)
(leaf ivy-prescient
:doc "prescient.el + Ivy"
:req "emacs-25.1" "prescient-4.0" "ivy-0.11.0"
:tag "extensions" "emacs>=25.1"
:url "https://github.com/raxod502/prescient.el"
:emacs>= 25.1
:ensure t
:after prescient ivy
:custom ((ivy-prescient-retain-classic-highlighting . t))
:global-minor-mode t)
;; ;;flycheckはリアルタイムにソースのエラーやワーニングを表示するマイナーモードです。
;; (leaf flycheck
;; :doc "On-the-fly syntax checking"
;; :req "dash-2.12.1" "pkg-info-0.4" "let-alist-1.0.4" "seq-1.11" "emacs-24.3"
;; :tag "minor-mode" "tools" "languages" "convenience" "emacs>=24.3"
;; :url "http://www.flycheck.org"
;; :emacs>= 24.3
;; :ensure nil
;; :bind (("M-n" . flycheck-next-error)
;; ("M-p" . flycheck-previous-error))
;; :global-minor-mode global-flycheck-mode)
(leaf company
:doc "Modular text completion framework"
:req "emacs-24.3"
:tag "matching" "convenience" "abbrev" "emacs>=24.3"
:url "http://company-mode.github.io/"
:emacs>= 24.3
:ensure nil
:blackout t
:leaf-defer nil
:bind ((company-active-map
("M-n" . nil)
("M-p" . nil)
("C-s" . company-filter-candidates)
("C-n" . company-select-next)
("C-p" . company-select-previous)
("<tab>" . company-complete-selection))
(company-search-map
("C-n" . company-select-next)
("C-p" . company-select-previous)))
:custom ((company-idle-delay . 0)
(company-minimum-prefix-length . 1)
(company-transformers . '(company-sort-by-occurrence)))
:global-minor-mode global-company-mode)
(leaf company-c-headers
:doc "Company mode backend for C/C++ header files"
:req "emacs-24.1" "company-0.8"
:tag "company" "development" "emacs>=24.1"
:added "2020-03-25"
:emacs>= 24.1
:ensure t
:after company
:defvar company-backends
:config
(add-to-list 'company-backends 'company-c-headers))
;;companyは入力補完のためのパッケージです。
;;3.9 time locale
(setq system-time-locale "C")
;;3.10 Font
;;(set-fontset-font t 'japanese-jisx0208 "TakaoPGothic")
;;(add-to-list 'face-font-rescale-alist '(".*Takao P.*" . 0.85))
;;;;;;;;;;;;;;;;;;;
;; カットペーストなど挿入削除時にハイライト
;;https://github.com/ncaq/.emacs.d/blob/master/init.el
(leaf volatile-highlights :ensure t :config (volatile-highlights-mode t))
;; 置換の動きを可視化
;;https://github.com/ncaq/.emacs.d/blob/master/init.el
(leaf anzu
:ensure t
:custom (global-anzu-mode . t)
:bind
([remap query-replace] . anzu-query-replace)
([remap query-replace-regexp] . anzu-query-replace-regexp))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; orgmode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;7 Org Mode
;7.1 Settinngs
(setq-default org-use-speed-commands t
org-agenda-todo-ignore-with-date t
org-directory "~/org"
org-agenda-files '("~/org/" )
org-todo-keywords '((sequence "TODO(t)" "WAIT(w)" "|" "DONE(d)"))
org-capture-templates '(("t" "Todo" entry (file+datetree "~/org/todo.org")
"* TODO %? %U %i\n %a")
;;("b" "Blog" entry (file "~/org/blog.org")
;; "* %?")
("m" "Memo" entry (file "~/org/memo.org")
"* %? %U\n %i")))
(leaf org-temp)
(general-define-key
:prefix "C-c"
"a" 'org-agenda
"b" 'counsel-bookmark
"c" 'org-capture)
(general-define-key
:keymaps 'org-mode-map
"C-m" nil)
;; tags
(setq org-tag-alist '(
("@office".?o)
("@home".?h)
("@blog".?b)
("notes".?n)
("awak".?a)
("7yr".?7)
("14yr".?1)
("READing".?r)))
;; ;7.2 org Keybind
;; (general-define-key
;; :prefix "C-c"
;; "a" 'org-agenda
;; "b" 'counsel-bookmark
;; "c" 'org-capture)
;; (general-define-key
;; :keymaps 'org-mode-map
;; "C-m" nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; doom themes https://takeokunn.github.io/.emacs.d/#org1bc4f66
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;6.1.2 all-the-icons-ivy
(leaf all-the-icons-ivy
:ensure t
:after all-the-icons
:config
(all-the-icons-ivy-setup))
;;6.1.3 doom-modeline
(leaf doom-modeline
:ensure t
:hook (after-init-hook)
:custom ((doom-modeline-buffer-file-name-style quote truncate-with-project)
(doom-modeline-icon . t)
(doom-modeline-major-mode-icon)
(doom-modeline-minor-modes))
:config
(with-eval-after-load 'doom-modeline
(line-number-mode 0)
(column-number-mode 0)))
;;6.1.4 doom-theme
(leaf doom-themes
:ensure t
:after neotree
:custom-face ((doom-modeline-bar quote
((t
(:background "#6272a4")))))
:config
(load-theme 'tango-dark t)
(doom-themes-neotree-config)
(doom-themes-org-config))
;;6.1.8 nyan-mode
(leaf nyan-mode
:ensure t
:after doom-modeline
:hook (doom-modeline-mode-hook)
:custom ((nyan-cat-face-number . 4)
(nyan-animate-nyancat . t)))
;6.17.1 ace-window
(leaf ace-window
:ensure t
:custom ((aw-keys '(97 115 100 102 103 104 106 107 108))))
;6.17.2 dashboard
(leaf dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ddskk
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(leaf ddskk
:ensure t
:bind
("C-x j" . skk-mode))
;;(leaf skk-study :ensure t)
;;(leaf skk-hint :ensure t)
;; Windows 環境だと [noconvert]
(setq skk-sticky-key [muhenkan])
(when (equal system-type 'windows-nt)
(setq skk-sticky-key [noconvert])
)
(require 'skk-hint)
;; muhenkanなどのキー名はどうやって取得するのかというと、 <f1> c を使います。その後に無変換キーを押せば「<muhenkan> is undefined」と出てきます。
(when (require 'skk nil t)
(global-set-key (kbd "C-x j") 'skk-auto-fill-mode) ;;良い感じに改行を自動入力してくれる機能
(setq default-input-method "japanese-skk") ;;emacs上での日本語入力にskkをつかう
(require 'skk-study)) ;;変換学習機能の追加
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;; @ LogFile ;;;
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
;;;;; ログ・ファイル出力
(defvar logger-process nil)
(defun logger (&rest msg)
(unless logger-process
(setq logger-process (start-process-shell-command "logger" nil (concat "cat >> ~/log.txt"))))
(process-send-string logger-process (concat (apply 'format msg) "\n")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; yatex to latex 野鳥起動のための設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(leaf yatex
:ensure t
:config )
;; (setq auto-mode-alist
;; (cons (cons "\\.tex$" ’yatex-mode) auto-mode-alist))
;; (autoload ’yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq load-path (cons (expand-file-name "~/Documents/latex/yatex") load-path))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
;; YaTeX-mode
;; (setq auto-mode-alist
;; (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
;; (setq dvi2-command "xdvi"
;; tex-command "platex"
;; dviprint-command-format "dvips %s | lpr"
;; YaTeX-kanji-code nil)
;; ;; YaHtml-mode
;; (setq auto-mode-alist
;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
;; (setq yahtml-www-browser "netscape")
;; (setq mac-option-modifier 'meta)
;; (setq indent-tabs-mode nil)
;;;;;;;;; ;;;;;;;;;;;;;;;;;;; https://texwiki.texjp.org/?YaTeX#e2cbcccd ;;;;;;;;;;;;;;
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq auto-mode-alist
(append '(("\\.tex$" . yatex-mode)
("\\.ltx$" . yatex-mode)
("\\.cls$" . yatex-mode)
("\\.sty$" . yatex-mode)
("\\.clo$" . yatex-mode)
("\\.bbl$" . yatex-mode)) auto-mode-alist))
(setq YaTeX-inhibit-prefix-letter t)
(setq YaTeX-kanji-code nil)
(setq YaTeX-latex-message-code 'utf-8)
(setq YaTeX-use-LaTeX2e t)
(setq YaTeX-use-AMS-LaTeX t)
(setq YaTeX-dvi2-command-ext-alist
'(("TeXworks\\|texworks\\|texstudio\\|mupdf\\|SumatraPDF\\|Preview\\|Skim\\|TeXShop\\|evince\\|atril\\|xreader\\|okular\\|zathura\\|qpdfview\\|Firefox\\|firefox\\|chrome\\|chromium\\|MicrosoftEdge\\|microsoft-edge\\|Adobe\\|Acrobat\\|AcroRd32\\|acroread\\|pdfopen\\|xdg-open\\|open\\|start" . ".pdf")))
;(setq tex-command "ptex2pdf -u -l -ot '-synctex=1'")
;(setq tex-command "lualatex -synctex=1")
(setq tex-command "llmk")
;(setq tex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/upmendex %O -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
;(setq tex-command "latexmk -e '$lualatex=q/lualatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/upmendex %O -o %D %S/' -norc -gg -pdflua")
(setq bibtex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/upmendex %O -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
(setq makeindex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/upmendex %O -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
;(setq dvi2-command "xdg-open")
(setq dvi2-command "evince")
;(setq dvi2-command "atril")
;(setq dvi2-command "okular --unique")
;(setq dvi2-command "zathura -x \"emacsclient --no-wait +%{line} %{input}\"")
;(setq dvi2-command "qpdfview --unique")
;(setq dvi2-command "texworks")
;(setq dvi2-command "texstudio --pdf-viewer-only")
;(setq tex-pdfview-command "xdg-open")
(setq tex-pdfview-command "evince")
;(setq tex-pdfview-command "atril")
;(setq tex-pdfview-command "okular --unique")
;(setq tex-pdfview-command "zathura -x \"emacsclient --no-wait +%{line} %{input}\"")
;(setq tex-pdfview-command "qpdfview --unique")
;(setq tex-pdfview-command "texworks")
;(setq tex-pdfview-command "texstudio --pdf-viewer-only")
;; (setq dviprint-command-format "wine cmd /c start AcroRd32.exe `echo %s | sed -e \"s/\\.[^.]*$/\\.pdf/\"`")
;; (require 'dbus)
;; (defun un-urlify (fname-or-url)
;; "A trivial function that replaces a prefix of file:/// with just /."
;; (if (string= (substring fname-or-url 0 8) "file:///")
;; (substring fname-or-url 7)
;; fname-or-url))
;; (defun evince-inverse-search (file linecol &rest ignored)
;; (let* ((fname (decode-coding-string (url-unhex-string (un-urlify file)) 'utf-8))
;; (buf (find-file fname))
;; (line (car linecol))
;; (col (cadr linecol)))
;; (if (null buf)
;; (message "[Synctex]: %s is not opened..." fname)
;; (switch-to-buffer buf)
;; (goto-line (car linecol))
;; (unless (= col -1)
;; (move-to-column col))
;; (x-focus-frame (selected-frame)))))
;; (dbus-register-signal
;; :session nil "/org/gnome/evince/Window/0"
;; "org.gnome.evince.Window" "SyncSource"
;; 'evince-inverse-search)
;; (with-eval-after-load 'yatexprc
;; (defun YaTeX-preview-jump-line ()
;; "Call jump-line function of various previewer on current main file"
;; (interactive)
;; (save-excursion
;; (save-restriction
;; (widen)
;; (let*((pf (or YaTeX-parent-file
;; (save-excursion (YaTeX-visit-main t) (buffer-file-name))))
;; (pdir (file-name-directory pf))
;; (bnr (substring pf 0 (string-match "\\....$" pf)))
;; ;(cf (file-relative-name (buffer-file-name) pdir))
;; (cf (buffer-file-name)) ;2016-01-08
;; (buffer (get-buffer-create " *preview-jump-line*"))
;; (line (count-lines (point-min) (point-end-of-line)))
;; (previewer (YaTeX-preview-default-previewer))
;; (cmd (cond
;; ((string-match "Skim" previewer)
;; (format "%s %d '%s.pdf' '%s'"
;; YaTeX-cmd-displayline line bnr cf))
;; ((string-match "evince" previewer)
;; (format "%s '%s.pdf' %d '%s'"
;; "fwdevince" bnr line cf))
;; ((string-match "sumatra" previewer)
;; (format "%s \"%s.pdf\" -forward-search \"%s\" %d"
;; previewer bnr cf line))
;; ((string-match "zathura" previewer)
;; (format "%s --synctex-forward '%d:0:%s' '%s.pdf'"
;; previewer line cf bnr))
;; ((string-match "qpdfview" previewer)
;; (format "%s '%s.pdf#src:%s:%d:0'"
;; previewer bnr cf line))
;; ((string-match "okular" previewer)
;; (format "%s '%s.pdf#src:%d %s'"
;; previewer bnr line (expand-file-name cf)))
;; )))
;; (YaTeX-system cmd "jump-line" 'noask pdir))))))
;; (add-hook 'yatex-mode-hook
;; '(lambda ()
;; (auto-fill-mode -1)))
;;
;; RefTeX with YaTeX
;;
;(add-hook 'yatex-mode-hook 'turn-on-reftex)
(add-hook 'yatex-mode-hook
'(lambda ()
(reftex-mode 1)
(define-key reftex-mode-map (concat YaTeX-prefix ">") 'YaTeX-comment-region)
(define-key reftex-mode-map (concat YaTeX-prefix "<") 'YaTeX-uncomment-region)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; ox-org : org-mode export to latex
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'ox-latex)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq org-latex-default-class "bxjsarticle")
(setq org-latex-pdf-process '("latexmk -e '$latex=q/uplatex %S/' -e '$bibtex=q/upbibtex %B/' -e '$biber=q/biber --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/upmendex -o %D %S/' -e '$dvipdf=q/dvipdfmx -o %D %S/' -norc -gg -pdfdvi %f"))
;(setq org-latex-pdf-process '("latexmk -e '$lualatex=q/lualatex %S/' -e '$bibtex=q/upbibtex %B/' -e '$biber=q/biber --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/upmendex -o %D %S/' -norc -gg -pdflua %f"))
;(setq org-export-in-background t)
(setq org-file-apps
'(("pdf" . "evince %s")))
(add-to-list 'org-latex-classes
'("bxjsarticle"
"\\documentclass[autodetect-engine,dvi=dvipdfmx,11pt,a4paper,ja=standard]{bxjsarticle}
[NO-DEFAULT-PACKAGES]
\\usepackage{amsmath}
\\usepackage{newtxtext,newtxmath}
\\usepackage{graphicx}
\\usepackage{hyperref}
\\ifdefined\\kanjiskip
\\usepackage{pxjahyper}
\\hypersetup{colorlinks=true}
\\else
\\ifdefined\\XeTeXversion
\\hypersetup{colorlinks=true}
\\else
\\ifdefined\\directlua
\\hypersetup{pdfencoding=auto,colorlinks=true}
\\else
\\hypersetup{unicode,colorlinks=true}
\\fi
\\fi
\\fi"
("\\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
'("jlreq"
"\\documentclass[luatexjp,12pt,paper=a4]{jlreq}
[NO-DEFAULT-PACKAGES]
\\usepackage{amsmath}
\\usepackage{newtxtext,newtxmath}
\\ifdefined\\kanjiskip
\\usepackage[dvipdfmx]{graphicx}
\\usepackage[dvipdfmx]{hyperref}
\\usepackage{pxjahyper}
\\hypersetup{colorlinks=true}
\\else
\\usepackage{graphicx}
\\usepackage{hyperref}
\\hypersetup{pdfencoding=auto,colorlinks=true}
\\fi"
("\\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
'("jlreq-tate"
"\\documentclass[luatexjp,tate,12pt,paper=a4]{jlreq}
[NO-DEFAULT-PACKAGES]
\\usepackage{amsmath}
\\usepackage{kocho}
\\usepackage{newtxtext,newtxmath}
\\ifdefined\\kanjiskip
\\usepackage[dvipdfmx]{graphicx}
\\usepackage[dvipdfmx]{hyperref}
\\usepackage{pxjahyper}
\\hypersetup{colorlinks=true}
\\else
\\usepackage{graphicx}
\\usepackage{hyperref}
\\hypersetup{pdfencoding=auto,colorlinks=true}
\\fi"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; devuan PATH ;;;;;;;;;;
;; (when (equal system-type 'windows-nt)
;; ;
;; )
;; (setenv "PATH"
;; (concat
;; ; "C:\\ProgramData\\chocolatey\\lib\\ag\\tools;"
;; "/usr/bin"
;; "/usr/local/texlive/2019/bin/x86_64-linux"
;; "/bin"
;; "/app/bin"
;; (getenv "PATH")))
(setenv "PATH" (concat (getenv "PATH") ":/usr/bin"))
(setq exec-path (append exec-path '("/usr/bin")))
(setenv "PATH" (concat (getenv "PATH") ":/app/bin"))
(setq exec-path (append exec-path '("/app/bin")))
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/texlive/2020/bin/x86_64-linux"))
(setq exec-path (append exec-path '("/usr/local/texlive/2020/bin/x86_64-linux")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; org-agenda config
;; http://www.i3s.unice.fr/~malapert/emacs_orgmode.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (setq org-agenda-ndays 7)
;; (setq org-agenda-show-all-dates t)
;; (setq org-agenda-skip-deadline-if-done t)
;; (setq org-agenda-skip-scheduled-if-done t)
;; (setq org-agenda-start-on-weekday nil)
;; (setq org-deadline-warning-days 14)
;; (setq org-agenda-custom-commands
;; '(("g" . "GTD contexts")
;; ("gh" "Home" tags-todo "HOME")
;; ("gu" "Urgent" tags-todo "URGENT")
;; ("G" "GTD Block Agenda"
;; ((todo "STARTED")
;; (tags-todo "URGENT")
;; (todo "NEXT"))
;; ((org-agenda-prefix-format "[ ] %T: ")
;; (org-agenda-with-colors nil)
;; (org-agenda-compact-blocks t)
;; (org-agenda-remove-tags t)
;; (ps-number-of-columns 2)
;; (ps-landscape-mode t))
;; ;;nil ;; i.e., no local settings
;; ("~/next-actions.txt"))
;; ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; hydra
;; https://www.reddit.com/r/emacs/comments/8of6tx/tip_how_to_be_a_beast_with_hydra/
;; https://github.com/abo-abo/hydra/wiki/Org-clock-and-timers
;;
;; (leaf hydra
;; :ensure t
;; :defer 2
;; :bind ("C-c t" . hydra-clock/body))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (defhydra hydra-org-agenda-clock (:color blue :hint nil)
;; ("i" org-agenda-clock-in)
;; ("o" org-agenda-clock-out)
;; ("q" org-agenda-clock-cancel)
;; ("g" org-agenda-clock-goto))
;; (bind-keys ("C-c w" . hydra-org-clock/body)
;; :map org-agenda-mode-map
;; ("C-c w" . hydra-org-agenda-clock/body))
;; https://github.com/abo-abo/hydra/wiki/Info
(defhydra hydra-clock (:color blue)
"
^
^Clock^ ^Do^
^─────^─────────────^──^─────────
_q_ quit _c_ cancel
^^ _d_ display
^^ _e_ effort
^^ _i_ in
^^ _j_ jump
^^ _o_ out
^^ _r_ report
^^ ^^
"
("q" nil)
("c" org-clock-cancel :color pink)
("d" org-clock-display)
("e" org-clock-modify-effort-estimate)
("i" org-clock-in)
("j" org-clock-goto)
("o" org-clock-out)
("r" org-clock-report))
(global-set-key (kbd "C-c t") 'hydra-clock/body)
;;(defhydra hydra-zoom ()
;; "zoom"
;; ("g" text-scale-increase "in")
;; ("l" text-scale-decrease "out"))
;; (global-set-key (kbd "C-x f") 'hydra-zoom/body)
;;
;;;;
(define-key Info-mode-map (kbd "?") #'hydra-info/body)
(defhydra hydra-info (:color blue
:hint nil)
"
Info-mode:
^^_]_ forward (next logical node) ^^_l_ast (←) _u_p (↑) _f_ollow reference _T_OC
^^_[_ backward (prev logical node) ^^_r_eturn (→) _m_enu (↓) (C-u for new window) _i_ndex _d_irectory
^^_n_ext (same level only) ^^_H_istory _g_oto (C-u for new window) _,_ next index item _c_opy node name
^^_p_rev (same level only) _<_/_t_op _b_eginning of buffer virtual _I_ndex _C_lone buffer
regex _s_earch (_S_ case sensitive) ^^_>_ final _e_nd of buffer ^^ _a_propos
_1_ .. _9_ Pick first .. ninth item in the node's menu.
"
("]" Info-forward-node)