-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
emacs.el
1525 lines (1339 loc) · 51.4 KB
/
emacs.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
;;; emacs.el --- bzg's GNU Emacs configuration -*- lexical-binding: t; -*-
;; This is bzg's GNU Emacs configuration, refined over the years.
;; For more Emacs-related stuff, see https://bzg.fr/en/tags/emacs/
;;
;; Code in this file is licensed under the GNU GPLv3 or any later
;; version.
;; Set `package-archives' to the ones I use
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("nongnu" . "http://elpa.nongnu.org/nongnu/")
("melpa" . "http://melpa.org/packages/")))
;; Precompute activation actions to speed up startup
(package-activate-all)
;; Start server to use emacsclient
(server-start)
;; Unset C-z which is bound to `suspend-frame' by default
(global-unset-key (kbd "C-z"))
;; Load my customization file
(setq custom-file "/home/bzg/.emacs.d/emacs-custom.el")
(load custom-file)
;; Initialize Org from sources
;; See https://orgmode.org/manual/Installation.html
(add-to-list 'load-path "~/install/git/org-mode/lisp/")
(add-to-list 'load-path "~/install/git/org-contrib/lisp/")
(add-to-list 'load-path "~/install/git/org-caldav/")
;; Initialize my `exec-path' and `load-path' with custom paths
(add-to-list 'exec-path "~/bin/")
(setq Info-refill-paragraphs t)
;; Include org-mode and emacs local paths into Info
(add-to-list 'Info-directory-list "~/install/git/org-mode/doc/")
(add-to-list 'Info-directory-list "~/install/git/emacs/info/")
;; Don't ask for confirmation for "dangerous" commands
(put 'erase-buffer 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'set-goal-column 'disabled nil)
(put 'list-threads 'disabled nil)
(put 'scroll-left 'disabled nil)
;; Set `sentence-end-double-space' to nil
(setq sentence-end-double-space nil)
;; Expect local variables to be known
(setq enable-local-eval t)
;; Who I am
(setq user-full-name "Bastien Guerry")
(setq user-mail-address "[email protected]")
;; Let's get a backtrace when errors are
(setq debug-on-error t)
;; Display byte-compiler warnings on error
(setq byte-compile-debug t)
;; The default is to wait 1 second, which I find a bit long
(setq echo-keystrokes 0.1)
;; ;; Let search for "e" match e.g. "é":
(setq search-default-mode 'char-fold-to-regexp)
;; Stop polluting the directory with auto-saved files and backup
(setq auto-save-default nil)
(setq make-backup-files nil)
(setq auto-save-list-file-prefix nil)
;; Well, it's more so that you know this option
(setq kill-whole-line t)
(setq kill-read-only-ok t)
(setq require-final-newline t)
;; Scrolling done right
(setq scroll-error-top-bottom t)
(setq focus-follows-mouse t)
(setq recenter-positions '(top bottom middle))
(setq view-read-only t)
;; Number of lines of continuity when scrolling by screenfulls
(setq next-screen-context-lines 0)
;; Always use "y" for "yes"
(fset 'yes-or-no-p 'y-or-n-p)
(setq fill-column 72)
(setq spell-command "aspell")
(setq tab-always-indent 'always)
(setq display-time-mail-string "#")
(setq text-mode-hook '(turn-on-auto-fill text-mode-hook-identify))
(setq max-lisp-eval-depth 10000)
(setenv "EDITOR" "emacsclient")
(setenv "CVS_RSH" "ssh")
;; Enabling and disabling some modes
;; Less is more - see https://bzg.fr/en/emacs-strip-tease/
(show-paren-mode 1)
(auto-insert-mode 1)
(display-time-mode 1)
(tooltip-mode -1)
(blink-cursor-mode -1)
(pixel-scroll-mode 1)
(mouse-avoidance-mode 'cat-and-mouse)
;; Default Frame
(setq initial-frame-alist
'((alpha . 85)
(left-margin-width . 10)
(menu-bar-lines . 0)
(tool-bar-lines . 0)
(horizontal-scroll-bars . nil)
(vertical-scroll-bars . nil)))
;; Don't display initial messages
(setq initial-scratch-message "")
(setq initial-major-mode 'org-mode)
(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message "guerry")
(setq use-dialog-box nil)
(setq default-frame-alist initial-frame-alist)
(setq line-move-visual nil)
(setq visible-bell t)
(setq tab-bar-show nil)
(set-frame-parameter nil 'fullscreen 'fullboth)
(setq bzg-alt-font-size 200)
(setq bzg-default-font-size 120)
(defun bzg-toggle-default-font-size ()
(interactive)
(if (< (abs (- (face-attribute 'default :height) bzg-alt-font-size)) 10)
(custom-set-faces
`(default ((t (:height ,bzg-default-font-size)))))
(custom-set-faces
`(default ((t (:height ,bzg-alt-font-size)))))))
(add-to-list 'custom-theme-load-path "~/install/git/vxid-theme/")
(load-theme 'vxid)
(global-set-key (kbd "C-x <C-backspace>") 'bzg-find-bzg)
(global-set-key (kbd "<home>") 'beginning-of-buffer)
(global-set-key (kbd "<end>") 'end-of-buffer)
(global-set-key (kbd "C-²") 'follow-delete-other-windows-and-split)
(global-set-key (kbd "<f10>") #'bzg-toggle-fringe-width)
(global-set-key (kbd "<f11>") #'bzg-toggle-browser)
(global-set-key (kbd "<f12>") #'global-hl-line-mode)
(global-set-key (kbd "M-<f12>") #'global-highlight-thing-mode)
;; Org agenda view keybodings
(global-set-key (kbd "C-!") (lambda () (interactive) (org-agenda nil "[")))
(global-set-key (kbd "C-M-!") (lambda () (interactive) (org-agenda nil "{")))
(global-set-key (kbd "C-*") (lambda () (interactive) (org-agenda nil "n!")))
(global-set-key (kbd "C-M-*") (lambda () (interactive) (org-agenda nil "n?")))
(global-set-key (kbd "C-$") (lambda () (interactive) (org-agenda nil "d!")))
(global-set-key (kbd "C-<dead-circumflex>") (lambda () (interactive) (org-agenda nil ":")))
(global-set-key (kbd "C-M-$") (lambda () (interactive) (org-agenda nil "d?")))
(global-set-key (kbd "<f5>") (lambda () (interactive) (org-agenda nil "rr")))
(global-set-key (kbd "M-<f5>") (lambda () (interactive) (org-agenda nil "rt")))
(global-set-key (kbd "<f6>") (lambda () (interactive) (org-agenda nil "ww")))
(global-set-key (kbd "M-<f6>") (lambda () (interactive) (org-agenda nil "wt")))
(global-set-key (kbd "<f7>") (lambda () (interactive) (org-agenda nil "cc")))
(global-set-key (kbd "M-<f7>") (lambda () (interactive) (org-agenda nil "ct")))
(global-set-key (kbd "<f8>") (lambda () (interactive) (org-agenda nil "nn")))
(global-set-key (kbd "M-<f8>") (lambda () (interactive) (org-agenda nil "tt")))
(global-set-key (kbd "<f9>") (lambda () (interactive) (org-agenda nil "@")))
(global-set-key (kbd "M-<f9>") (lambda () (interactive) (org-agenda nil "?")))
(global-set-key (kbd "C-ù") (lambda () (interactive) (org-agenda nil "$")))
(global-set-key (kbd "C-%") (lambda () (interactive) (org-agenda nil "%")))
(global-set-key (kbd "C-&") 'gnus)
(global-set-key (kbd "C-é") 'bzg-cycle-view)
(global-set-key (kbd "C-\"") (lambda () (interactive) (dired "~") (revert-buffer)))
(global-set-key (kbd "C-c f") 'find-name-dired)
(global-set-key (kbd "C-c g") 'deadgrep)
(global-set-key (kbd "C-c F") 'auto-fill-mode)
(global-set-key (kbd "C-c o") 'occur)
(global-set-key (kbd "C-c O") 'multi-occur)
(global-set-key (kbd "C-c m") 'magit-status)
(global-set-key (kbd "C-à") (lambda () (interactive) (if (eq major-mode 'calendar-mode) (calendar-exit) (calendar))))
(global-set-key (kbd "C-ç") 'calc)
(global-set-key (kbd "C-+") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
(global-set-key (kbd "C-=") 'bzg-toggle-default-font-size)
(global-set-key (kbd "C-x C-<left>") 'tab-previous)
(global-set-key (kbd "C-x C-<right>") 'tab-next)
(global-set-key (kbd "C-M-]") 'origami-toggle-all-nodes)
(global-set-key (kbd "M-]") 'origami-toggle-node)
(global-set-key "\M- " 'hippie-expand)
(define-key global-map "\M-Q" 'unfill-paragraph)
;; Easily jump to my main org file
(defun bzg-find-bzg nil
"Find the bzg.org file."
(interactive)
(find-file "~/org/bzg.org")
(hidden-mode-line-mode 1)
(delete-other-windows))
;; Easily unfill paragraphs
(defun unfill-paragraph ()
"Make a multi-line paragraph into a single line of text."
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
(require 'org-tempo)
(require 'org-bullets)
(setq org-bullets-bullet-list '("►" "▸" "•" "★" "◇" "◇" "◇" "◇"))
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
(add-hook 'message-mode-hook (lambda () (abbrev-mode 0)))
(require 'ol-gnus)
;; org-mode global keybindings
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(define-key global-map "\C-cc" 'org-capture)
(define-key global-map "\C-cL" 'org-occur-link-in-agenda-files)
;; Hook to update all blocks before saving
(add-hook 'org-mode-hook
(lambda() (add-hook 'before-save-hook
'org-update-all-dblocks t t)))
;; Hook to display dormant article in Gnus
(add-hook 'org-follow-link-hook
(lambda ()
(if (eq major-mode 'gnus-summary-mode)
(gnus-summary-insert-dormant-articles))))
(setq org-adapt-indentation 'headline-data)
(setq org-priority-start-cycle-with-default nil)
(setq org-pretty-entities t)
(setq org-fast-tag-selection-single-key 'expert)
(setq org-fontify-done-headline t)
(setq org-footnote-auto-label 'confirm)
(setq org-footnote-auto-adjust t)
(setq org-hide-emphasis-markers t)
(setq org-hide-macro-markers t)
(setq org-link-frame-setup '((gnus . gnus) (file . find-file-other-window)))
(setq org-link-mailto-program '(browse-url-mail "mailto:%a?subject=%s"))
(setq org-log-done nil)
(setq org-log-into-drawer t)
(setq org-log-note-headings
'((done . "CLOSING NOTE %t") (state . "State %-12s %t") (clock-out . "")))
(setq org-refile-targets '((org-agenda-files . (:maxlevel . 3))
(("~/org/mll-todo/todo.org") . (:maxlevel . 1))
(("~/org/libre.org") . (:maxlevel . 1))))
(setq org-refile-use-outline-path t)
(setq org-refile-allow-creating-parent-nodes t)
(setq org-refile-use-cache t)
(setq org-element-use-cache nil)
(setq org-return-follows-link t)
(setq org-reverse-note-order t)
(setq org-scheduled-past-days 100)
(setq org-special-ctrl-a/e 'reversed)
(setq org-special-ctrl-k t)
(setq org-stuck-projects '("+LEVEL=1" ("NEXT" "TODO" "DONE")))
(setq org-tag-persistent-alist '(("Write" . ?w) ("Read" . ?r)))
(setq org-tag-alist
'((:startgroup)
("Handson" . ?o)
(:grouptags)
("Write" . ?w) ("Code" . ?c) ("Tel" . ?t)
(:endgroup)
(:startgroup)
("Handsoff" . ?f)
(:grouptags)
("Read" . ?r) ("View" . ?v) ("Listen" . ?l)
(:endgroup)
("Mail" . ?@) ("Print" . ?P) ("Buy" . ?b)))
(setq org-tags-column -74)
(setq org-todo-keywords '((type "STRT" "NEXT" "TODO" "WAIT" "|" "DONE" "DELEGATED" "CANCELED")))
(setq org-todo-repeat-to-state t)
(setq org-use-property-inheritance t)
(setq org-use-sub-superscripts '{})
(setq org-insert-heading-respect-content t)
(setq org-id-method 'uuidgen)
(setq org-combined-agenda-icalendar-file "~/org/bzg.ics")
(setq org-confirm-babel-evaluate nil)
(setq org-archive-default-command 'org-archive-to-archive-sibling)
(setq org-id-uuid-program "uuidgen")
(setq org-use-speed-commands
(lambda nil
(and (looking-at org-outline-regexp-bol)
(not (org-in-src-block-p t)))))
(setq org-todo-keyword-faces
'(("STRT" . (:inverse-video t :foreground (face-foreground 'default)))
("NEXT" . (:weight bold :foreground (face-foreground 'default)))
("WAIT" . (:inverse-video t))
("CANCELED" . (:inverse-video t))))
(setq org-footnote-section "Notes")
(setq org-link-abbrev-alist
'(("ggle" . "http://www.google.com/search?q=%s")
("gmap" . "http://maps.google.com/maps?q=%s")
("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")))
(setq org-attach-id-dir "~/org/data/")
(setq org-loop-over-headlines-in-active-region t)
(setq org-create-formula-image-program 'dvipng) ;; imagemagick
(setq org-allow-promoting-top-level-subtree t)
(setq org-blank-before-new-entry '((heading . t) (plain-list-item . auto)))
(setq org-crypt-key "Bastien Guerry")
(setq org-enforce-todo-dependencies t)
(setq org-fontify-whole-heading-line t)
(setq org-file-apps
'((auto-mode . emacs)
(directory . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . "evince %s")))
(setq org-hide-leading-stars t)
(setq org-global-properties '(("Effort_ALL" . "0:10 0:30 1:00 1:24 2:00 3:30 7:00")))
(setq org-cycle-include-plain-lists nil)
(setq org-default-notes-file "~/org/notes.org")
(setq org-directory "~/org/")
(setq org-link-email-description-format "%c: %.50s")
(setq org-support-shift-select t)
(setq org-ellipsis "…")
(org-clock-persistence-insinuate)
(setq org-timer-default-timer 25)
(setq org-clock-display-default-range 'thisweek)
(setq org-clock-persist t)
(setq org-clock-idle-time 60)
(setq org-clock-history-length 35)
(setq org-clock-in-resume t)
(setq org-clock-out-remove-zero-time-clocks t)
(setq org-clock-sound "~/Music/clock.wav")
;; Set headlines to STRT when clocking in
(add-hook 'org-clock-in-hook (lambda() (org-todo "STRT")))
;; Set headlines to STRT and clock-in when running a countdown
(add-hook 'org-timer-set-hook
(lambda ()
(if (eq major-mode 'org-agenda-mode)
(call-interactively 'org-agenda-clock-in)
(call-interactively 'org-clock-in))))
(add-hook 'org-timer-done-hook
(lambda ()
(if (and (eq major-mode 'org-agenda-mode)
org-clock-current-task)
(call-interactively 'org-agenda-clock-out)
(call-interactively 'org-clock-out))))
(add-hook 'org-timer-pause-hook
(lambda ()
(if org-clock-current-task
(if (eq major-mode 'org-agenda-mode)
(call-interactively 'org-agenda-clock-out)
(call-interactively 'org-clock-out)))))
(add-hook 'org-timer-stop-hook
(lambda ()
(if org-clock-current-task
(if (eq major-mode 'org-agenda-mode)
(call-interactively 'org-agenda-clock-out)
(call-interactively 'org-clock-out)))))
(setq org-capture-templates
'(("c" "Misc (edit)" entry (file+headline "~/org/bzg.org" "Basement")
"* TODO %?\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n\n- %a" :prepend t)
("C" "Misc" entry (file+headline "~/org/bzg.org" "Basement")
"* TODO %a\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n"
:prepend t :immediate-finish t)
("r" "RDV Perso" entry (file+headline "~/org/rdv.org" "RDV Perso")
"* RDV avec %:fromname %?\n SCHEDULED: %^T\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n\n- %a" :prepend t)
("R" "RDV MLL" entry (file+headline "~/org/rdv-mll.org" "RDV MLL")
"* RDV avec %:fromname %?\n SCHEDULED: %^T\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n\n- %a" :prepend t)
("o" "Org" entry (file+headline "~/org/bzg.org" "Org")
"* TODO %a\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n\n" :prepend t)
("m" "MLL" entry (file+headline "~/org/bzg.org" "MLL")
"* TODO %?\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n\n- %a\n\n%i" :prepend t)
("g" "Garden" entry (file+headline "~/org/libre.org" "Garden")
"* TODO %?\n :PROPERTIES:\n :CAPTURED: %U\n :END:\n\n- %a\n\n%i" :prepend t)
))
(setq org-capture-templates-contexts
'(("r" ((in-mode . "gnus-summary-mode")
(in-mode . "gnus-article-mode")
(in-mode . "message-mode")))
("R" ((in-mode . "gnus-summary-mode")
(in-mode . "gnus-article-mode")
(in-mode . "message-mode")))))
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)
(dot . t)
(clojure . t)
(org . t)
(ditaa . t)
(org . t)
(ledger . t)
(scheme . t)
(plantuml . t)
(R . t)
(gnuplot . t)))
(setq org-babel-default-header-args
'((:session . "none")
(:results . "replace")
(:exports . "code")
(:cache . "no")
(:noweb . "yes")
(:hlines . "no")
(:tangle . "no")
(:padnewline . "yes")))
(setq org-src-tab-acts-natively t)
(setq org-edit-src-content-indentation 0)
(setq org-babel-clojure-backend 'babashka)
(setq org-link-elisp-confirm-function nil)
(setq org-link-shell-confirm-function nil)
(setq org-plantuml-jar-path "~/bin/plantuml.jar")
(setq org-plantuml-jar-path (expand-file-name "/home/bzg/bin/plantuml.jar"))
(add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))
(require 'ox-md)
(require 'ox-beamer)
(require 'ox-latex)
(require 'ox-odt)
(require 'ox-koma-letter)
(setq org-koma-letter-use-email t)
(setq org-koma-letter-use-foldmarks nil)
(add-to-list 'org-latex-classes
'("my-letter"
"\\documentclass\{scrlttr2\}
\\usepackage[english,frenchb]{babel}
\[NO-DEFAULT-PACKAGES]
\[NO-PACKAGES]
\[EXTRA]"))
(setq org-export-with-broken-links t)
(setq org-export-default-language "fr")
(setq org-export-backends '(latex odt icalendar html ascii koma-letter))
(setq org-export-with-archived-trees nil)
(setq org-export-with-drawers '("HIDE"))
(setq org-export-with-section-numbers nil)
(setq org-export-with-sub-superscripts nil)
(setq org-export-with-tags 'not-in-toc)
(setq org-export-with-timestamps t)
(setq org-html-head "")
(setq org-html-head-include-default-style nil)
(setq org-export-with-toc nil)
(setq org-export-with-priority t)
(setq org-export-dispatch-use-expert-ui t)
(setq org-export-use-babel t)
(setq org-latex-pdf-process
'("pdflatex -interaction nonstopmode -shell-escape -output-directory %o %f" "pdflatex -interaction nonstopmode -shell-escape -output-directory %o %f" "pdflatex -interaction nonstopmode -shell-escape -output-directory %o %f"))
(setq org-export-allow-bind-keywords t)
(setq org-publish-list-skipped-files nil)
(setq org-html-table-row-tags
(cons '(cond (top-row-p "<tr class=\"tr-top\">")
(bottom-row-p "<tr class=\"tr-bottom\">")
(t (if (= (mod row-number 2) 1)
"<tr class=\"tr-odd\">"
"<tr class=\"tr-even\">")))
"</tr>"))
(setq org-html-head-include-default-style nil)
(setq org-html-head-include-scripts nil)
(add-to-list 'org-latex-packages-alist '("AUTO" "babel" t ("pdflatex")))
(org-agenda-to-appt)
;; Hook to display the agenda in a single window
(add-hook 'org-agenda-finalize-hook 'delete-other-windows)
(setq org-deadline-warning-days 3)
(setq org-agenda-inhibit-startup t)
(setq org-agenda-diary-file "/home/bzg/org/rdv.org")
(setq org-agenda-dim-blocked-tasks t)
(setq org-agenda-entry-text-maxlines 10)
(setq org-agenda-files '("~/org/rdv.org" "~/org/rdv-mll.org" "~/org/bzg.org"))
(setq org-agenda-prefix-format
'((agenda . " %i %-12:c%?-14t%s")
(timeline . " % s")
(todo . " %i %-14:c")
(tags . " %i %-14:c")
(search . " %i %-14:c")))
(setq org-agenda-remove-tags t)
(setq org-agenda-restore-windows-after-quit t)
(setq org-agenda-show-inherited-tags nil)
(setq org-agenda-skip-deadline-if-done t)
(setq org-agenda-skip-deadline-prewarning-if-scheduled nil)
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-skip-timestamp-if-done t)
(setq org-agenda-sorting-strategy
'((agenda time-up) (todo time-up) (tags time-up) (search time-up)))
(setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-agenda-use-tag-inheritance nil)
(setq org-agenda-window-frame-fractions '(0.0 . 0.5))
(setq org-agenda-deadline-faces
'((1.0001 . org-warning) ; due yesterday or before
(0.0 . org-upcoming-deadline))) ; due today or later
(setq org-agenda-loop-over-headlines-in-active-region t)
;; icalendar stuff
(setq org-icalendar-include-todo 'all)
(setq org-icalendar-combined-name "Bastien Guerry ORG")
(setq org-icalendar-use-scheduled '(todo-start event-if-todo event-if-not-todo))
(setq org-icalendar-use-deadline '(todo-due event-if-todo event-if-not-todo))
(setq org-icalendar-timezone "Europe/Paris")
(setq org-icalendar-store-UID t)
(setq org-agenda-custom-commands
'(
;; Week agenda for rendez-vous and tasks
("$" "All appointments" agenda* "Week planning"
((org-agenda-span 'week)
(org-agenda-sorting-strategy
'(time-up todo-state-up priority-down))))
("%" "Personal appointments" agenda* "Month planning"
((org-agenda-span 'month)
(org-agenda-files '("~/org/rdv.org"))
(org-agenda-sorting-strategy
'(time-up todo-state-up priority-down))))
("@" "Mail" tags-todo "+Mail+TODO={STRT\\|NEXT\\|TODO\\|WAIT}"
((org-agenda-sorting-strategy
'(todo-state-up priority-down))))
("?" "Waiting" tags-todo "+TODO={WAIT}")
("#" "To archive"
todo "DONE|CANCELED|DELEGATED"
((org-agenda-sorting-strategy '(timestamp-up))))
("[" "Today's tasks for MLL" agenda "Tasks and rdv for today"
((org-agenda-category-filter-preset '("+MLL"))
(org-agenda-span 1)
(org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(scheduled-up deadline-up todo-state-up priority-down))))
("{" "Today's tasks for non-MLL" agenda "Tasks and rdv for today"
((org-agenda-category-filter-preset '("-MLL"))
(org-agenda-span 1)
(org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(scheduled-up deadline-up todo-state-up priority-down))))
("n" . "What's next?")
("nn" "STRT/NEXT all" tags-todo "TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("n!" "STRT/NEXT MLL" tags-todo "TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("+MLL"))
(org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("n?" "STRT/NEXT -MLL" tags-todo "TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("-MLL"))
(org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("n/" "STRT/NEXT (libre)" tags-todo "TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/libre.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("t" . "What's next to do?")
("tt" "TODO all" tags-todo "TODO={TODO}"
((org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("t!" "TODO MLL" tags-todo "TODO={TODO}"
((org-agenda-category-filter-preset '("+MLL"))
(org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("t?" "TODO -MLL" tags-todo "TODO={TODO}"
((org-agenda-category-filter-preset '("-MLL"))
(org-agenda-files '("~/org/bzg.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
("t/" "TODO (libre)" tags-todo "TODO={TODO}"
((org-agenda-files '("~/org/libre.org"))
(org-agenda-sorting-strategy
'(todo-state-up priority-down time-up))))
(":" "Scheduled item work" agenda "Scheduled items"
((org-agenda-span 3)
(org-agenda-entry-types '(:scheduled))
(org-agenda-sorting-strategy
'(scheduled-up todo-state-up priority-down))))
("d" . "Deadlines")
("dd" "Deadlines all" agenda "Past/upcoming deadlines"
((org-agenda-span 1)
(org-deadline-warning-days 60)
(org-agenda-entry-types '(:deadline))
(org-agenda-sorting-strategy
'(deadline-up todo-state-up priority-down))))
("d!" "Deadlines MLL" agenda "Past/upcoming work deadlines"
((org-agenda-span 1)
(org-agenda-category-filter-preset '("+MLL"))
(org-deadline-warning-days 60)
(org-agenda-entry-types '(:deadline))
(org-agenda-sorting-strategy
'(deadline-up todo-state-up priority-down))))
("d?" "Deadlines -MLL" agenda "Past/upcoming non-work deadlines"
((org-agenda-span 1)
(org-agenda-category-filter-preset '("-MLL"))
(org-deadline-warning-days 60)
(org-agenda-entry-types '(:deadline))
(org-agenda-sorting-strategy
'(deadline-up todo-state-up priority-down))))
("d/" "Deadlines libre" agenda "Past/upcoming deadlines (libre)"
((org-agenda-span 1)
(org-agenda-files '("~/org/libre.org"))
(org-deadline-warning-days 60)
(org-agenda-entry-types '(:deadline))
(org-agenda-sorting-strategy
'(deadline-up todo-state-up priority-down))))
("A" "Write, Code, Mail" tags-todo
"+TAGS={Write\\|Code\\|Mail}+TODO={STRT}")
("Z" "Read, Listen, View" tags-todo
"+TAGS={Read\\|Listen\\|View}+TODO={STRT}")
("r" . "Read")
("rr" "Read STRT/NEXT" tags-todo "+Read+TODO={STRT\\|NEXT}")
("rt" "Read TODO" tags-todo "+Read+TODO={TODO}")
("r!" "Read MLL" tags-todo "+Read+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("+MLL"))))
("r?" "Read -MLL" tags-todo "+Read+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("-MLL"))))
("r/" "Read (libre)" tags-todo "+Read+TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/libre.org"))))
("v" . "View")
("vv" "View STRT/NEXT" tags-todo "+View+TODO={STRT\\|NEXT}")
("vt" "View TODO" tags-todo "+View+TODO={TODO}")
("v!" "View MLL" tags-todo "+View+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("+MLL"))))
("v?" "View -MLL" tags-todo "+View+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("-MLL"))))
("v/" "View (libre)" tags-todo "+View+TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/libre.org"))))
("l" . "Listen")
("ll" "Listen STRT/NEXT" tags-todo "+Listen+TODO={STRT\\|NEXT}")
("lt" "Listen TODO" tags-todo "+Listen+TODO={TODO}")
("l!" "Listen MLL" tags-todo "+Listen+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("+MLL"))))
("l?" "Listen -MLL" tags-todo "+Listen+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("-MLL"))))
("l/" "Listen (libre)" tags-todo "+Listen+TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/libre.org"))))
("w" . "Write")
("ww" "Write STRT/NEXT" tags-todo "+Write+TODO={STRT\\|NEXT}")
("wt" "Write TODO" tags-todo "+Write+TODO={TODO}")
("w!" "Write MLL" tags-todo "+Write+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("+MLL"))))
("w?" "Write -MLL" tags-todo "+Write+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("-MLL"))))
("w/" "Write (libre)" tags-todo "+Write+TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/libre.org"))))
("c" . "Code")
("cc" "Code STRT/NEXT" tags-todo "+Code+TODO={STRT\\|NEXT}")
("ct" "Code TODO" tags-todo "+Code+TODO={TODO}")
("c!" "Code MLL" tags-todo "+Code+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("+MLL"))))
("c?" "Code -MLL" tags-todo "+Code+TODO={STRT\\|NEXT}"
((org-agenda-category-filter-preset '("-MLL"))))
("c!" "Code (libre)" tags-todo "+Code+TODO={STRT\\|NEXT}"
((org-agenda-files '("~/org/libre.org"))))
))
(use-package epg :defer t)
(use-package epa
:defer t
:config
(setq epa-popup-info-window nil))
(use-package epg
:defer t
:config
(setq epg-pinentry-mode 'loopback))
(use-package gnus
:defer t
:config
(gnus-delay-initialize)
(setq gnus-refer-thread-limit t)
(setq gnus-delay-default-delay "1d")
(setq gnus-use-atomic-windows nil)
(setq gnus-always-read-dribble-file t)
(setq nndraft-directory "~/News/drafts/")
(setq nnmh-directory "~/News/drafts/")
(setq nnfolder-directory "~/Mail/archive")
(setq nnml-directory "~/Mail/old/Mail/")
(setq gnus-summary-ignore-duplicates t)
(setq gnus-suppress-duplicates t)
(setq gnus-auto-select-first nil)
(setq gnus-ignored-from-addresses
(regexp-opt '("[email protected]"
)))
(setq send-mail-function 'sendmail-send-it)
;; (setq mail-header-separator "----")
(setq mail-use-rfc822 t)
;; Attachments
(setq mm-content-transfer-encoding-defaults
(quote
(("text/x-patch" 8bit)
("text/.*" 8bit)
("message/rfc822" 8bit)
("application/emacs-lisp" 8bit)
("application/x-emacs-lisp" 8bit)
("application/x-patch" 8bit)
(".*" base64))))
(setq mm-url-use-external nil)
(setq nnmail-extra-headers
'(X-Diary-Time-Zone X-Diary-Dow X-Diary-Year
X-Diary-Month X-Diary-Dom
X-Diary-Hour X-Diary-Minute
To Newsgroups Cc))
;; Sources and methods
(setq mail-sources nil
gnus-select-method '(nnnil "")
gnus-secondary-select-methods
'((nnimap "localhost"
(nnimap-server-port "imaps")
(nnimap-authinfo-file "~/.authinfo")
(nnimap-stream ssl)
(nnimap-expunge t))))
(setq gnus-check-new-newsgroups nil)
(add-hook 'gnus-exit-gnus-hook
(lambda ()
(if (get-buffer "bbdb")
(with-current-buffer "bbdb" (save-buffer)))))
(setq read-mail-command 'gnus
gnus-asynchronous t
gnus-directory "~/News/"
gnus-gcc-mark-as-read t
gnus-inhibit-startup-message t
gnus-interactive-catchup nil
gnus-interactive-exit nil
gnus-large-newsgroup 10000
gnus-no-groups-message ""
gnus-novice-user nil
nntp-nov-is-evil t
gnus-nov-is-evil t
gnus-play-startup-jingle nil
gnus-show-all-headers nil
gnus-use-bbdb t
gnus-use-correct-string-widths nil
gnus-use-cross-reference nil
gnus-verbose 6
mail-specify-envelope-from t
mail-envelope-from 'header
message-sendmail-envelope-from 'header
mail-user-agent 'gnus-user-agent
message-fill-column 70
message-kill-buffer-on-exit t
message-mail-user-agent 'gnus-user-agent
message-use-mail-followup-to nil
message-forward-as-mime t
nnimap-expiry-wait 'never
nnmail-crosspost nil
nnmail-expiry-target "nnml:expired"
nnmail-expiry-wait 'never
nnmail-split-methods 'nnmail-split-fancy
nnmail-treat-duplicates 'delete)
(setq gnus-subscribe-newsgroup-method 'gnus-subscribe-interactively
gnus-group-default-list-level 6 ; 3
gnus-level-default-subscribed 3
gnus-level-default-unsubscribed 7
gnus-level-subscribed 6
gnus-activate-level 6
gnus-level-unsubscribed 7)
(setq nnir-notmuch-remove-prefix "/home/bzg/Mail/Maildir")
(setq gnus-search-default-engines
'((nnimap . notmuch)))
(defun my-gnus-message-archive-group (group-current)
"Return prefered archive group."
(cond
((and (stringp group-current)
(or (message-news-p)
(string-match "nntp\\+news" group-current 0)))
(concat "nnfolder+archive:" (format-time-string "%Y-%m")
"-divers-news"))
((and (stringp group-current) (< 0 (length group-current)))
(concat (replace-regexp-in-string "[^/]+$" "" group-current) "Sent"))
(t "nnimap+localhost:[email protected]/Sent")))
(setq gnus-message-archive-group 'my-gnus-message-archive-group)
;; Delete mail backups older than 1 days
(setq mail-source-delete-incoming 1)
;; Group sorting
(setq gnus-group-sort-function
'(gnus-group-sort-by-unread
gnus-group-sort-by-rank
;; gnus-group-sort-by-score
;; gnus-group-sort-by-level
;; gnus-group-sort-by-alphabet
))
(add-hook 'gnus-summary-exit-hook 'gnus-summary-bubble-group)
(add-hook 'gnus-summary-exit-hook 'gnus-group-sort-groups-by-rank)
(add-hook 'gnus-suspend-gnus-hook 'gnus-group-sort-groups-by-rank)
(add-hook 'gnus-exit-gnus-hook 'gnus-group-sort-groups-by-rank)
;; Headers we wanna see:
(setq gnus-visible-headers
"^From:\\|^Subject:\\|^Date:\\|^To:\\|^Cc:\\|^Newsgroups:\\|^Comments:\\|^User-Agent:"
message-draft-headers '(References From In-Reply-To)
;; message-generate-headers-first t ;; FIXME: Not needed Emacs>=29?
message-hidden-headers
'("^References:" "^Face:" "^X-Face:" "^X-Draft-From:" "^In-Reply-To:" "^Message-ID:")
)
;; Sort mails
(setq nnmail-split-abbrev-alist
'((any . "From\\|To\\|Cc\\|Sender\\|Apparently-To\\|Delivered-To\\|X-Apparently-To\\|Resent-From\\|Resent-To\\|Resent-Cc")
(mail . "Mailer-Daemon\\|Postmaster\\|Uucp")
(to . "To\\|Cc\\|Apparently-To\\|Resent-To\\|Resent-Cc\\|Delivered-To\\|X-Apparently-To")
(from . "From\\|Sender\\|Resent-From")
(nato . "To\\|Cc\\|Resent-To\\|Resent-Cc\\|Delivered-To\\|X-Apparently-To")
(naany . "From\\|To\\|Cc\\|Sender\\|Resent-From\\|Resent-To\\|Delivered-To\\|X-Apparently-To\\|Resent-Cc")))
;; Simplify the subject lines
(setq gnus-simplify-subject-functions
'(gnus-simplify-subject-re gnus-simplify-whitespace))
;; Display faces
(setq gnus-treat-display-face 'head)
;; Thread by Xref, not by subject
(setq gnus-thread-ignore-subject t)
(setq gnus-thread-hide-subtree nil)
(setq gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
gnus-thread-sort-functions '(gnus-thread-sort-by-number
gnus-thread-sort-by-total-score
gnus-thread-sort-by-date)
gnus-sum-thread-tree-false-root ""
gnus-sum-thread-tree-indent " "
gnus-sum-thread-tree-leaf-with-other "├► "
gnus-sum-thread-tree-root ""
gnus-sum-thread-tree-single-leaf "╰► "
gnus-sum-thread-tree-vertical "│")
;; Dispkay a button for MIME parts
(setq gnus-buttonized-mime-types '("multipart/alternative"))
;; Use w3m to display HTML mails
(setq mm-text-html-renderer 'gnus-w3m
mm-inline-text-html-with-images t
mm-inline-large-images nil
mm-attachment-file-modes 420)
;; Avoid spaces when saving attachments
(setq mm-file-name-rewrite-functions
'(mm-file-name-trim-whitespace
mm-file-name-collapse-whitespace
mm-file-name-replace-whitespace))
(setq gnus-user-date-format-alist
'(((gnus-seconds-today) . " %k:%M")
((+ 86400 (gnus-seconds-today)) . "hier %k:%M")
((+ 604800 (gnus-seconds-today)) . "%a %k:%M")
((gnus-seconds-month) . "%a %d")
((gnus-seconds-year) . "%b %d")
(t . "%b %d '%y")))
(setq gnus-topic-indent-level 3)
;; Add a time-stamp to a group when it is selected
(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
;; Format group line
(setq gnus-group-line-format "%M%S%p%P %(%-40,40G%)\n")
(setq gnus-group-line-default-format "%M%S%p%P %(%-40,40G%) %-3y %-3T %-3I\n")
(defun bzg-gnus-toggle-group-line-format ()
(interactive)
(if (equal gnus-group-line-format
gnus-group-line-default-format)
(setq gnus-group-line-format
"%M%S%p%P %(%-40,40G%)\n")
(setq gnus-group-line-format
gnus-group-line-default-format)))
;; Toggle the group line format
(define-key gnus-group-mode-map "("
(lambda () (interactive) (bzg-gnus-toggle-group-line-format) (gnus)))
;; Scoring
(setq gnus-use-adaptive-scoring '(word line)
gnus-adaptive-pretty-print t
gnus-adaptive-word-length-limit 5
;; gnus-score-expiry-days 14
gnus-default-adaptive-score-alist
'((gnus-replied-mark (from 50) (subject 10))
(gnus-read-mark (from 30) (subject 10))
(gnus-cached-mark (from 30) (subject 10))
(gnus-forwarded-mark (from 10) (subject 5))
(gnus-saved-mark (from 10) (subject 5))
(gnus-expirable-mark (from 0) (subject 0))
(gnus-catchup-mark (from -5) (subject -30))
(gnus-del-mark (from -10) (subject -50))
(gnus-killed-mark (from -10 (subject -50)))
(gnus-dormant-mark (from 10) (subject 30))
(gnus-ticked-mark (from 10) (subject 50))
(gnus-unread-mark))
gnus-score-exact-adapt-limit nil
gnus-default-adaptive-word-score-alist
'((42 . 3) ;cached
(65 . 2) ;replied
(70 . 1) ;forwarded
(82 . 1) ;read
(67 . -1) ;catchup
(69 . 0) ;expired
(75 . -3) ;killed
(114 . -3))
;; gnus-score-decay-constant 1
;; gnus-decay-scores t
;; gnus-decay-score 1000
)
(setq gnus-summary-line-format
(concat "%*%0{%U%R%z%}"
"%0{ %}(%2t)"
"%2{ %}%-23,23n"
"%1{ %}%1{%B%}%2{%-102,102s%}%-140="
"\n")))
(use-package gnus-alias
:config
(define-key message-mode-map (kbd "C-c C-x C-i")
'gnus-alias-select-identity))
(use-package gnus-art
:defer t
:config
;; Highlight my name in messages
(add-to-list 'gnus-emphasis-alist
'("Bastien\\|bzg" 0 0 gnus-emphasis-highlight-words)))
(use-package gnus-icalendar
:config
(gnus-icalendar-setup)
;; To enable optional iCalendar->Org sync functionality
;; NOTE: both the capture file and the headline(s) inside must already exist
(setq gnus-icalendar-org-capture-file "~/org/rdv-mll.org")
(setq gnus-icalendar-org-capture-headline '("RDV MLL"))
(setq gnus-icalendar-org-template-key "I")
(gnus-icalendar-org-setup))
(use-package gnus-dired
:defer t
:config
;; Make the `gnus-dired-mail-buffers' function also work on
;; message-mode derived modes, such as mu4e-compose-mode
(defun gnus-dired-mail-buffers ()
"Return a list of active message buffers."
(let (buffers)
(save-current-buffer