-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspa_packages.el
executable file
·1339 lines (1246 loc) · 45.7 KB
/
spa_packages.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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; spa_packages.el ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
;; Libraries ;;
;;;;;;;;;;;;;;;
(use-package f
:ensure t
:defer t)
(use-package s
:ensure t
:defer t)
(use-package cl)
(use-package color)
;;;;;;;;;;;;;;;
;; Utilities ;;
;;;;;;;;;;;;;;;
(use-package exec-path-from-shell
:ensure t
:config
(exec-path-from-shell-copy-env "BOX_FOLDER")
(exec-path-from-shell-copy-env "SIGNATURES_BOX")
(exec-path-from-shell-initialize)
)
(use-package date2name
:ensure t
)
;;;;;;;;;;;;;;;;
;; Aesthetics ;;
;;;;;;;;;;;;;;;;
;; Turn minor mode "default text scale" on in order to globally adjust text size
;; with C-M-= and C-M--
(use-package default-text-scale
:ensure t
:config (default-text-scale-mode t))
;; TODO: use-package is not working here
;; (use-package presentation
;; :load-path (lambda () (xah-get-fullpath "lisp/presentation-mode/"))
;; :preface
;; (defun my-presentation-on ()
;; (global-display-line-numbers-mode 1))
;; (defun my-presentation-off ()
;; (global-display-line-numbers-mode -1))
;; :hook ((presentation-on . my-presentation-on)
;; (presentation-off . my-presentation-off)))
(defun my-presentation-on ()
(global-display-line-numbers-mode 1))
(defun my-presentation-off ()
(global-display-line-numbers-mode -1))
(load (xah-get-fullpath "lisp/presentation-mode/presentation.el"))
(add-hook 'presentation-on-hook #'my-presentation-on)
(add-hook 'presentation-off-hook #'my-presentation-off)
(use-package smart-mode-line
:ensure t
:init (add-hook 'after-init-hook 'sml/setup)
:config
(setq sml/theme 'automatic)
(setq sml/modified-char "m")
(add-to-list 'sml/replacer-regexp-list '("^~/Box Sync/" ":Box:") t))
(use-package color-theme-sanityinc-solarized
:ensure t
:pin melpa-stable
:init
(setq custom-safe-themes t) ;; treat all themes as safe
:config
(color-theme-sanityinc-solarized--define-theme dark))
(use-package emojify
:ensure t
:pin melpa-stable
:defer 10
:hook ((text-mode org-mode) . global-emojify-mode)
:config
(setq emojify-program-contexts '(comments))
:bind ("C-c E" . emojify-insert-emoji))
;; dired-x is not available?
(use-package dired-x
:disabled t
:ensure t
:after dired)
(use-package dired-du
:ensure t
:after dired
:defer t
:config
(setq dired-du-size-format t)
(setq dired-du-update-headers t))
;; ;; Disable due to error after upgrading to Emacs 28+. Getting syntax
;; ;; highlighting now from diredfl
;; (use-package dired+
;; :load-path (lambda () (xah-get-fullpath "lisp/diredp/"))
;; :after dired
;; :config
;; ;; TODO: Fix so that 'e' command in dired is not overwritten
;; (setq diredp-hide-details-initially-flag nil)
;; (unbind-key "M-b" dired-mode-map)
;; ;; (set-face-attribute 'diredp-dir-name nil :foreground "DarkRed")
;; )
(use-package diredfl
:ensure t
:pin melpa-stable
:config
(add-hook 'dired-mode-hook 'diredfl-mode)
;; Based on init file from John Soo (https://github.com/jsoo1/dotfiles)
;; Define colors with base colors coming from solarized color theme
(defvar base03 "#002b36" "Theme base03.")
(defvar base02 "#073642" "Theme base02.")
(defvar base01 "#586e75" "Theme base01.")
(defvar base00 "#657b83" "Theme base00.")
(defvar base3 "#fdf6e3" "Theme base3.")
(defvar base2 "#eee8d5" "Theme base2.")
(defvar base1 "#93a1a1" "Theme base1.")
(defvar base0 "#839496" "Theme base0.")
(defvar yellow "#b58900" "Theme yellow.")
(defvar red "#dc322f" "Theme red.")
(defvar green "#859900" "Theme green.")
(defvar blue "#286bd2" "Theme blue.")
(defvar cyan "#2aa198" "Theme cyan.")
(defvar magenta "#d33682" "Theme magenta.")
(defvar orange "#cb4b16" "Theme orange.")
(defvar violet "#6c71c4" "Theme violet.")
;; Assign the colors for diredfl to overwrite the defaults which are not good
;; when using solarized. NOTE: This is customized for solarized-dark but can
;; be modified for solarized-light using the other base values.
(set-face-attribute
diredfl-dir-heading nil
:foreground blue
:background base03)
(set-face-attribute
diredfl-number nil
:foreground green
:background base03)
(set-face-attribute
diredfl-date-time nil
:foreground yellow
:background base03)
(set-face-attribute
diredfl-file-name nil
:foreground base0
:background base03)
(set-face-attribute
diredfl-file-suffix nil
:foreground green
:background base03)
(set-face-attribute
diredfl-dir-name nil
:foreground blue
:background base03)
(set-face-attribute
diredfl-symlink nil
:foreground cyan
:background base03)
(set-face-attribute
diredfl-no-priv nil
:foreground base0
:background base03)
(set-face-attribute
diredfl-dir-priv nil
:foreground blue
:background base03)
(set-face-attribute
diredfl-read-priv nil
:foreground base0
:background base03)
(set-face-attribute
diredfl-write-priv nil
:foreground cyan
:background base03)
(set-face-attribute
diredfl-exec-priv nil
:foreground magenta
:background base03)
(set-face-attribute
diredfl-rare-priv nil
:foreground magenta
:background base03)
(set-face-attribute
diredfl-other-priv nil
:foreground orange
:background base03)
(set-face-attribute
diredfl-deletion nil
:foreground red
:background base03)
(set-face-attribute
diredfl-deletion-file-name nil
:foreground red
:background base03)
(set-face-attribute
diredfl-flag-mark nil
:foreground violet
:background base03)
(set-face-attribute
diredfl-flag-mark-line nil
:foreground violet
:background base03)
(set-face-attribute
diredfl-ignored-file-name nil
:foreground base01
:background base03))
;; (use-package dired-quick-sort
;; :config
;; (dired-quick-sort-setup))
(use-package rainbow-delimiters
:ensure t
:pin melpa-stable
:after (color cl)
:preface
(defun hsl-to-hex (h s l)
"Convert H S L to hex colours"
(let (rgb)
(setq rgb (color-hsl-to-rgb h s l))
(color-rgb-to-hex (nth 0 rgb)
(nth 1 rgb)
(nth 2 rgb))))
(defun bracket-colors ()
"Calculate the bracket colours based on background.
Used for better rainbow colors than default.
source: `https://emacs.stackexchange.com/questions/21303/looking-for-a-better-way-of-tweaking-rainbow-delimiters'"
(let (hexcolors lightvals)
(if (>= (color-distance "white"
(face-attribute 'default :background))
(color-distance "black"
(face-attribute 'default :background)))
(setq lightvals (list 0.65 0.55))
(setq lightvals (list 0.35 0.30)))
(concatenate 'list
(dolist (n'(.71 .3 .11 .01))
(push (hsl-to-hex (+ n 0.0) 1.0 (nth 0 lightvals)) hexcolors))
(dolist (n '(.81 .49 .17 .05))
(push (hsl-to-hex (+ n 0.0) 1.0 (nth 1 lightvals)) hexcolors)))
(reverse hexcolors)))
:config
;; Commented out to use defaults since this wasn't looking right
;; (set-face-attribute 'popup-face nil
;; :background "white" :foreground "black")
;; (set-face-attribute `rainbow-delimiters-depth-1-face nil
;; :foreground "#888")
;; (set-face-attribute `rainbow-delimiters-depth-2-face nil
;; :foreground (nth 0 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-3-face nil
;; :foreground (nth 1 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-4-face nil
;; :foreground (nth 2 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-5-face nil
;; :foreground (nth 3 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-6-face nil
;; :foreground (nth 4 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-7-face nil
;; :foreground (nth 5 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-8-face nil
;; :foreground (nth 6 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-depth-9-face nil
;; :foreground (nth 7 (bracket-colors)))
;; (set-face-attribute `rainbow-delimiters-unmatched-face nil
;; :foreground "white" :background "red")
:hook ((prog-mode ess-mode) . rainbow-delimiters-mode))
(use-package rainbow-mode
:ensure t
:init
(setq rainbow-r-colors t)
:hook ((prog-mode ess-mode) . rainbow-mode))
;; highlight todo keywords
(use-package hl-todo
:ensure t
:config
(global-hl-todo-mode 1))
(use-package ace-window
:ensure t
:init
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
:bind (:map global-map
("M-o" . ace-window)))
(use-package browse-kill-ring
:ensure t
:pin melpa-stable
:config
(setq browse-kill-ring-replace-yank t)
:bind (:map global-map
("M-y" . browse-kill-ring)))
;; TODO: Needs some customization to work with ESS
(use-package scratch
:ensure t
:pin melpa-stable)
(use-package popup
:ensure t
:config
(set-face-attribute 'popup-face nil :background "white" :foreground "black")
(set-face-attribute 'popup-tip-face nil :background "white" :foreground "black")
(set-face-attribute 'popup-menu-selection-face nil :background "#92C1F0" :foreground "black")
(set-face-attribute 'popup-isearch-match nil :background "#92C1F0" :foreground "black"))
(use-package use-package-hydra
:ensure t)
;; Can't figure out use-package-hydra
(use-package image+
:ensure t
:after (image hydra use-package-hydra)
:config
(setq imagex-auto-adjust-mode 1)
(setq imagex-quiet-error t))
;; :bind (:map global-map ("C-x C-l" . nil))
;; :hydra
;; imagex-sticky-binding ( )
;; "Manipulating Image"
;; ("+" imagex-sticky-zoom-in "zoom in")
;; ("-" imagex-sticky-zoom-out "zoom out")
;; ("M" imagex-sticky-maximize "maximize")
;; ("O" imagex-sticky-restore-original "restore original")
;; ("S" imagex-sticky-save-image "save file")
;; ("r" imagex-sticky-rotate-right "rotate right")
;; ("l" imagex-sticky-rotate-left "rotate left"))
;; Previously:
;; `(when (require 'hydra nil t)
;; (defhydra imagex-sticky-binding (global-map "C-x C-l")
;; "Manipulating Image"
;; ("+" imagex-sticky-zoom-in "zoom in")
;; ("-" imagex-sticky-zoom-out "zoom out")
;; ("M" imagex-sticky-maximize "maximize")
;; ("O" imagex-sticky-restore-original "restore original")
;; ("S" imagex-sticky-save-image "save file")
;; ("r" imagex-sticky-rotate-right "rotate right")
;; ("l" imagex-sticky-rotate-left "rotate left"))))
(use-package csv-mode
:ensure t
:mode
("\\.csv\\'" . csv-mode)
("\\.tsv\\'" . csv-mode)
:init
(add-hook 'csv-mode-hook (lambda () (font-lock-mode -1)))
(add-hook 'csv-mode-hook (lambda () (visual-line-mode -1)))
(add-hook 'csv-mode-hook #'flyspell-mode-off)
; This hook makes csv-mode align the fields by default in the entire buffer
(add-hook 'csv-mode-hook
(lambda () (csv-align-fields nil (point-min) (point-max)))))
(use-package org
:diminish org-indent
:preface
(defun spa/mtime (f) (let ((attrs (file-attributes f))) (nth 5 attrs)))
(defun spa/latest-file (path)
"Get latest file (including directory) in PATH."
(let ((e (f-entries path)))
(car (sort e (lambda (a b)
(not (time-less-p (spa/mtime a)
(spa/mtime b))))))))
(defun spa/org-link-screenshot ()
"Insert link to last screenshot"
(interactive)
(setq dir "/Users/savey/OneDrive - JnJ/Pictures/Screenshots")
(setq path (spa/latest-file dir))
(setq name (read-from-minibuffer "Link Name: " nil nil nil
'minibuffer-history))
(setq string (concat "[[" path "][" name "]]"))
(insert string)
)
(defun spa/diminish-org-indent ()
(interactive)
(diminish 'org-indent-mode ""))
;; (defun spa/on-org-clock-out ()
;; "Insert the script pushRepos.sh into the subshell process"
;; ;; (shell-command "~/Documents/pushAllRepos.sh")) ;; old way!
;; (shell) ;; open a new subshell in emacs
;; (insert "~/Documents/pushRepos.sh")) ;; Run the script interactively in emacs
;; ORG-MODE: * My Task
;; SCHEDULED: <%%(diary-last-day-of-month date)>
;; DIARY: %%(diary-last-day-of-month date) Last Day of the Month
;; See also: (setq org-agenda-include-diary t)
;; source: https://emacs.stackexchange.com/questions/31683/schedule-org-task-for-last-day-of-every-month
;; (diary-last-day-of-month '(2 28 2017))
(defun diary-last-day-of-month (date)
"Return `t` if DATE is the last day of the month."
(let* ((day (calendar-extract-day date))
(month (calendar-extract-month date))
(year (calendar-extract-year date))
(last-day-of-month
(calendar-last-day-of-month month year)))
(= day last-day-of-month)))
:config
;; Don't change the face of DONE headlines
(setq org-fontify-done-headline nil)
;; Increase org-imenu-depth to be able to search deeper headings
(setq org-imenu-depth 6)
;; Enforce TODO Dependencies so parent cannot be done when child is undone or ordering
;; must be followed
(setq org-enforce-todo-dependencies t)
;; Set properties for how org-agenda shows clock consistency
(setq org-agenda-clock-consistency-checks
(quote
(:max-duration "4:00" :min-duration 0 :max-gap "0:05" :gap-ok-around
("4:00" "12:30")
:default-face
((:background "DarkRed")
(:foreground "white"))
:overlap-face nil :gap-face nil :no-end-time-face nil :long-face nil :short-face nil)))
;; Set format for org duration in hours rather than default days:hours:minutes
(setq org-duration-format (quote h:mm))
;; Show notifications within Org mode in the minibuffer
(setq org-show-notification-handler 'message)
;; Setup org mode to view latex formula previews
(setq org-latex-create-formula-image-program 'imagemagick)
;; Set the directory for org files
(setq org-agenda-files '("/Users/savey/OneDrive - JNJ/org"))
;; Set default priority of TODO items to be the same as [#C]
(setq org-default-priority ?C)
;; Set default range from displaying clocks to all time until now
;; Use C-u C-u prefix to choose a different range
(setq org-clock-display-default-range 'untilnow)
;; Set clocktable defaults
(setq org-agenda-clockreport-parameter-plist '(:link t :maxlevel 4 :compact t))
;; Load pandoc back-end for exporting in org-mode
;; ;; Include built-in diary in org agenda to get holidays
;; (setq org-agenda-include-diary t)
;; restore window configuration when closing agenda
(setq org-agenda-restore-windows-after-quit t)
;; use cornered arrow instead of elipse for hidden items
(setq org-ellipsis "⤵")
;; hide the leading stars (even when not in indent-mode)
(setq org-hide-leading-stars t)
;; warn me of any deadlines in next 7 days
(setq org-deadline-warning-days 7)
;; don't show tasks as scheduled if they are already shown as a deadline
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)
;; Default notes and agenda files
(setq org-default-notes-file "~/OneDrive - JNJ/org/notes.org")
;; Specify where items can be refiled (any agenda file up to 9th level)
(setq org-refile-targets '((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9)))
(setq org-refile-use-outline-path 'file)
;; org-capture templates
;; Capture templates for: TODO tasks, Notes, appointments, phone calls, meetings, and org-protocol
(setq org-capture-templates
(quote (("t" "todo" entry (file "~/OneDrive - JNJ/org/refile.org")
"* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
("r" "respond" entry (file "~/OneDrive - JNJ/org/refile.org")
"* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
("n" "note" entry (file "~/OneDrive - JNJ/org/refile.org")
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
("j" "Journal" entry (file+datetree "~/OneDrive - JNJ/org/diary.org")
"* %?\n%U\n" :clock-in t :clock-resume t)
("w" "org-protocol" entry (file "~/OneDrive - JNJ/org/refile.org")
"* TODO Review %c\n%U\n" :immediate-finish t)
("m" "Meeting" entry (file "~/OneDrive - JNJ/org/refile.org")
"* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
("p" "Phone call" entry (file "~/OneDrive - JNJ/org/refile.org")
"* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
("h" "Habit" entry (file "~/OneDrive - JNJ/org/refile.org")
"* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
;; format string used when creating CLOCKSUM lines and when generating a
;; time duration (avoid showing days)
(setq org-time-clocksum-format
'(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
;; Press C-a twice to get to start of heading instead of stars
(setq org-special-ctrl-a/e 'reversed)
;; Log a "CLOSED" timestamp when something is done
(setq org-log-done 'time)
(setq org-log-reschedule 'note)
;; '@' log timestamp AND note when this keyword is entered
;; '!' log timestamp when you leave keyword
;; stamp when the state changes
(setq org-todo-keywords
(quote ((sequence "LEARN(l!)" "|" "LEARNED(L!)")
(sequence "TODO(t!)" "|" "DONE(d!)" "DELEGATED(o@/!)")
(type "PROJECT(P!)" "PROJECT_HOLD(H!)" "|" "PROJECT_DONE(D!)"
"PROJECT_TRANSFERRED(T@)")
(sequence "REPLAY(r)" "|" "REPLAYED(p!)")
(sequence "TOREAD(e)" "|" "READ(E!)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)"
"PHONE" "MEETING")
(sequence "RUNNING(R@)" "ERROR(e@)" "|" "FINISHED(f@)"))))
(setq org-agenda-custom-commands
'(
("p" . "List All Projects and High-Level Tasks") ; describe prefix "p"
("pe" "Everything Concrete" tags "-MAYBE/PROJECT")
("pp" "Portfolio Projects" tags "-MAYBE+portfolio/PROJECT")
("pn" "Non-Portfolio Projects" tags "-MAYBE-portfolio/PROJECT")
("pm" "Someday or Maybe Projects" tags "+MAYBE/PROJECT")
("l" "What to do during Lunch?" tags-todo "lunch")
("n" "Agenda and TODOs (without Projects)"
((agenda #1="")
(todo "TODO|LEARN|TOREAD|REPLAY|WAITING|HOLD|RUNNING")))
("q" "Quick tasks" tags-todo "EFFORT>=\"0:01\"&EFFORT<=\"0:15\"")
("d" "Timeline for today" ((agenda "" ))
(;(org-agenda-ndays 1)
(org-agenda-span 'day)
(org-agenda-show-log t)
(org-agenda-log-mode-items '(clock closed))
(org-agenda-clockreport-mode t)
(org-agenda-time-grid nil)
(org-agenda-entry-types '())))
("W" "Waiting on Others" todo "WAITING")
("w" "Weekly Review"
((tags "CLOSED>=\"<-1w>\"") ; NOTE: This is slow
(agenda ""))
(
;; (org-agenda-format-date "")
(org-agenda-overriding-header "WEEKLY TIMESHEET")
;; (org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp))
(org-agenda-span 'week)
(org-agenda-start-on-weekday 1)
(org-agenda-start-with-clockreport-mode t)
(org-agenda-show-log t)
(org-agenda-show-clocking-issues) ; NOTE: Not working to show clocking issues
(org-agenda-time-grid nil)
))
("P" "Printed agenda"
((agenda "" ((org-agenda-span 7) ;; overview of appointments
(org-agenda-start-on-weekday nil) ;; calendar begins today
(org-agenda-repeating-timestamp-show-all t)
(org-agenda-entry-types '(:timestamp :sexp))))
(agenda "" ((org-agenda-span 1) ; daily agenda
(org-deadline-warning-days 7) ; 7 day advanced warning for deadlines
(org-agenda-todo-keyword-format "[ ]")
(org-agenda-scheduled-leaders '("" ""))
(org-agenda-prefix-format "%t%s")))
(todo "TODO" ;; todos sorted by context
((org-agenda-prefix-format "[ ] %T: ")
(org-agenda-sorting-strategy '(priority-down tag-up))
(org-agenda-todo-keyword-format "")
(org-agenda-overriding-header "\nTasks by Context\n------------------\n"))))
(
;; (org-agenda-with-colors nil)
(org-agenda-compact-blocks t)
(org-agenda-remove-tags t)
;; (ps-number-of-columns 2)
;; (ps-landscape-mode t)
))
))
(setq org-todo-keyword-faces
(quote (("TODO" :foreground "red" :weight bold)
("DONE" :foreground "forest green" :weight bold)
("PROJECT" :foreground "#3288bd" :weight bold)
("DELEGATED" :foreground "forest green" :weight bold)
("COMPLETED" :foreground "forest green" :weight bold)
("TRANSFERRED" :foreground "forest green" :weight bold)
("REPLAY" :foreground "red" :weight bold)
("REPLAYED" :foreground "forest green" :weight bold)
("LEARN" :foreground "red" :weight bold)
("LEARNED" :foreground "forest green" :weight bold)
("TOREAD" :foreground "red" :weight bold)
("READ" :foreground "forest green" :weight bold)
("WAITING" :foreground "orange" :weight bold)
("HOLD" :foreground "orange" :weight bold)
("CANCELLED" :foreground "forest green" :weight bold)
("MEETING" :foreground "forest green" :weight bold)
("PHONE" :foreground "forest green" :weight bold)
("RUNNING" :foreground "orange" :weight bold)
("ERROR" :foreground "magenta" :weight bold)
("FINISHED" :foreground "forest green" :weight bold))))
;; (setq org-todo-keywords
;; '((sequence "TODO(t)" "|" "DONE(d@)")
;; (sequence "REPORT(r)" "BUG(b@)" "KNOWNCAUSE(k@)" "|" "FIXED(f@)")
;; (sequence "RUNNING(R@)" "ERROR(E@)" "|" "FINISHED(F@)")
;; (sequence "ANALYZING(a@)" "|" "ANALYZED(A@)")
;; (sequence "WAITING(w@)" "|" "CANCELED(c@)")
;; (sequence "HYPOTHESIS(h)" "|" "Results(e)")))
;; (setq org-agenda-archives-mode nil)
;; (setq org-agenda-skip-comment-trees nil)
;; (setq org-agenda-skip-function nil)
;; Effort and global properties
(setq org-global-properties '(("Effort_ALL". "0 0:10 0:20 0:30 1:00 2:00 3:00 4:00 6:00 8:00")))
;; Set global Column View format
(setq org-columns-default-format '"%38ITEM(Details) %TAGS(Context) %7TODO(To Do) %5Effort(Time){:} %6CLOCKSUM(Clock)")
;; Prefer a vertical split in Org mode for the agenda
(defadvice org-agenda (around split-vertically activate)
(let ((split-width-threshold 80)) ; or whatever width makes sense for you
ad-do-it))
;; (add-hook 'org-capture-mode-hook 'org-clock-out) ; Clock out of task when org-capture is run
;; (add-hook 'org-clock-out-hook 'spa/on-org-clock-out)
;; ;; Change the default PDF viewer to acroread
;; (eval-after-load "org"
;; '(progn
;; ;; Change .pdf association directly within the alist
;; (setcdr (assoc "\\.pdf\\'" org-file-apps) "acroread %s")))
;; Trigger org-trello for each org file
;; (add-hook 'org-mode-hook 'org-trello-mode)
;; Open links to directories in Emacs (dired) instead of the default
;; "open" command that opens the finder
(add-to-list 'org-file-apps '(directory . emacs))
;; Customize org-goto to search headlines via completion
(setq org-goto-interface 'outline-path-completion)
(setq org-outline-path-complete-in-steps nil)
(setq org-goto-max-level 8)
:hook
(org-indent-mode . spa/diminish-org-indent)
(org-mode . turn-on-font-lock)
(org-mode . visual-line-mode)
(org-agenda-mode . hl-line-mode)
:bind (:map global-map
("C-c a" . org-agenda))
(:map org-mode-map
;; ("C-c b" . org-iswitchb) ; now using ido-mode for buffer switching
("C-c l" . org-store-link)
("C-c c" . org-capture)
("C-c C-f" . org-forward-heading-same-level)
("C-c s" . 'spa/org-link-screenshot)
("C-c &" . 'org-mark-ring-goto)))
(use-package org-clock-convenience
:ensure t
:init
(setq org-clock-convenience-clocked-agenda-re "^ +\\([^:]+\\): *\\(\\([ 012][0-9]\\):\\([0-5][0-9]\\)\\)\\(?:-\\(\\([ 012][0-9]\\):\\([0-5][0-9]\\)\\)\\|.*\\)? +Clocked: +\\(([0-9]+:[0-5][0-9])\\|(-)\\)")
(defun spa/org-agenda-mode-fn ()
(define-key org-agenda-mode-map
(kbd "<S-up>") #'org-clock-convenience-timestamp-up)
(define-key org-agenda-mode-map
(kbd "<S-down>") #'org-clock-convenience-timestamp-down)
(define-key org-agenda-mode-map
(kbd "o") #'org-clock-convenience-fill-gap)
(define-key org-agenda-mode-map
(kbd "e") #'org-clock-convenience-fill-gap-both))
(add-hook 'org-agenda-mode-hook #'spa/org-agenda-mode-fn))
(use-package ox-pandoc
:ensure t
:after (org))
(use-package org-bullets
:ensure t
:commands org-bullets-mode
:hook (org-mode . org-bullets-mode))
(use-package google-this
:ensure t
:bind
("C-c C-g" . google-this))
;; volatile highlights - temporarily highlight changes from pasting etc
(use-package volatile-highlights
:ensure t
:diminish
:config
(volatile-highlights-mode t))
(use-package osx-dictionary
:ensure t
:bind
("C-c d" . osx-dictionary-search-word-at-point))
(use-package smartscan
:ensure t
:config
(global-smartscan-mode 1)
(unbind-key "M-n" smartscan-map)
(unbind-key "M-p" smartscan-map)
:bind (:map smartscan-map
("M-<down>" . smartscan-symbol-go-forward)
("M-<up>" . smartscan-symbol-go-backward)))
(use-package openwith
:ensure t
:init
:config
(openwith-mode t)
(setq openwith-associations
(list
(list (openwith-make-extension-regexp
'("pdf" "html" "svg" "doc" "docx" "xls" "xlsx" "xlsm" "ppt" "pptx" "pptm" "pzfx"))
"open"
'(file))
)))
(use-package doc-view
:ensure t
:defer t
:mode ("\\.pdf\\'" . doc-view-mode-maybe)
:config
(setq doc-view-continuous t))
(use-package smex
:ensure t
:config
(defadvice smex (around space-inserts-hyphen activate compile)
(let ((ido-cannot-complete-command
`(lambda ()
(interactive)
(if (string= " " (this-command-keys))
(insert ?-)
(funcall ,ido-cannot-complete-command)))))
ad-do-it))
:bind (("M-x" . smex)
("M-X" . smex-major-mode-commands)
("C-c C-c M-x" . execute-extended-command)))
(use-package writegood-mode
:ensure t)
(use-package pdf-tools
:ensure t
:defer t
:pin melpa-stable
:config
(pdf-tools-install))
(use-package which-key
:ensure t
:defer 5
:diminish
:commands which-key-mode
:config
(which-key-mode)
:bind (:map global-map
("C-h z" . which-key-show-major-mode)))
(use-package goto-chg
:ensure t
:bind
("C-c l" . goto-last-change))
(use-package ivy
:ensure t
:diminish
:preface
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-initial-inputs-alist nil)
(setq ivy-count-format "(%d/%d) ")
;; Polymode seems to have taken care of this so don't need to ignore these
;; buffer-specific modes. If I do in current Polymode, can't actually find the
;; file I have open.
;; (add-to-list 'ivy-ignore-buffers "\\[r\\]")
;; (add-to-list 'ivy-ignore-buffers "\\[poly-head-tail\\]")
;; (add-to-list 'ivy-ignore-buffers "\\[yaml\\]")
;; (add-to-list 'ivy-ignore-buffers "\\[latex\\]")
;; (add-to-list 'ivy-ignore-buffers "\\[fallback\\]")
;; (add-to-list 'ivy-ignore-buffers "\\[sas\\]")
(set-face-attribute 'ivy-current-match nil :background "ns_selection_bg_color" :foreground "ns_selection_fg_color")
:bind
("C-x b" . ivy-switch-buffer))
(use-package counsel
:ensure t
:diminish
:bind
("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file)
("C-c g" . counsel-git)
("C-c r" . counsel-minibuffer-history)
("C-c M" . counsel-imenu))
;; TODO: Update refcard with this bit of C-o doing swiper from regular isearch
(use-package swiper
:ensure t
:after ivy
:bind (:map isearch-mode-map
("C-o" . swiper-from-isearch)))
(use-package projectile
:diminish
:init
(setq projectile-project-search-path '("~/repos/"))
:bind-keymap ("C-c p" . projectile-command-map)
:bind* ("C-c P" . (lambda () (interactive)
(projectile-cleanup-known-projects)
(projectile-discover-projects-in-search-path)))
:config
(projectile-global-mode))
(use-package counsel-projectile
:ensure t
:config
(counsel-projectile-mode 1))
(use-package ibuffer-projectile
:ensure t
:defer 1
:after (ibuffer projectile))
(use-package ibuffer-vc
:ensure t
:defer 1
:after (ibuffer))
(use-package avy
:ensure t
:config
(avy-setup-default)
:bind
("M-g M-c" . avy-goto-char-2)
("M-g M-g" . avy-goto-line))
(use-package anzu
:ensure t
:diminish
:config
(global-anzu-mode)
:bind (:map global-map
("M-%" . anzu-query-replace)
("C-M-%" . anzu-query-replace-regexp)))
(use-package undo-tree
:ensure t
:diminish
:config
(global-undo-tree-mode))
(use-package flycheck
:ensure t
:init
(setq flycheck-lintr-linters "with_defaults(todo_comment_linter = NULL, trailing_blank_lines_linter = NULL, line_length_linter(80))")
:hook ((elpy-mode ess-mode) . flycheck-mode)
:commands
(flycheck-mode
flycheck-next-error
flycheck-previous-error))
(use-package template
:load-path (lambda () (xah-get-fullpath "lisp/template/lisp/"))
:config
(template-initialize)
;; TODO: Try to set default directory to one in dot-emacs repos!
;; Tried many ways and it doesn't work
;; (setq template-default-directories (xah-get-fullpath "lisp/template/templates/"))
:bind
("C-c i" . template-expand-template))
(use-package yasnippet
:ensure t
:pin melpa-stable
:diminish yas-minor-mode
:config
(use-package yasnippet-snippets
:ensure t)
(use-package stan-snippets
:ensure t)
(yas-global-mode 1)
(add-to-list #'yas-snippet-dirs (xah-get-fullpath "lisp/yasnippet-ess/")))
(use-package magit
:ensure t
:pin melpa-stable
:bind
("C-x g" . magit-status)
("C-x M-g" . magit-dispatch-popup))
(use-package reveal-in-osx-finder
:ensure t
:bind (:map global-map
("C-c o" . reveal-in-osx-finder)))
(use-package company
:ensure t
:pin melpa-stable
:diminish
:init
(setq company-minimum-prefix-length 2) ; do idle completion with at least 2 characters
(setq company-selection-wrap-around t) ; wrap around during selection
:config
(add-hook 'after-init-hook 'global-company-mode)
;; Customize company faces for dark background (ok for light background too)
(let ((bg (face-attribute 'default :background)))
(custom-set-faces
`(company-tooltip ((t (:inherit default :background ,(color-lighten-name bg 2)))))
`(company-scrollbar-bg ((t (:background ,(color-lighten-name bg 10)))))
`(company-scrollbar-fg ((t (:background ,(color-lighten-name bg 5)))))
`(company-tooltip-selection ((t (:inherit font-lock-function-name-face))))
`(company-tooltip-common ((t (:inherit font-lock-constant-face)))))))
(use-package htmlize
:ensure t
:defer 10
:pin melpa-stable)
;;;;;;;;;;;;;;;;;
;; Programming ;;
;;;;;;;;;;;;;;;;;
(use-package ein
:ensure t
:defer 5
:commands ein:notebooklist-open
:config
;; ideally would like this to be the same as polymode chunks which switch
;; when theme changes but this is good enough for now
;; (set-face-attribute 'ein:cell-input-area nil :background "#fd4ef3e3da54")
)
(use-package matlab-mode
:ensure t
:defer 5
:mode ("\\.m$" . matlab-mode)
:preface
(defun spa/matlab-insert-assign ()
"Insert asignment operator for Matlab"
(interactive)
(just-one-space)
(insert "=")
(just-one-space))
:config
(load-library "matlab-load")
(setq matlab-shell-command-switches '("-nosplash" "-nodesktop"))
(setq matlab-indent-level 4)
;; (matlab-cedet-setup)
;; (setq mlint-programs (quote ("/Applications/MATLAB_R2018b.app/bin/maci64/mlint")))
;; (add-hook 'matlab-mode-hook (lambda () (mlint-minor-mode 1)))
;; (setq matlab-show-mlint-warnings t)
;; (setq matlab-highlight-cross-function-variables t)
(add-hook 'matlab-mode-hook #'my-auto-hook)
:bind (:map matlab-mode-map
("M--" . spa/matlab-insert-assign)))
;; TODO: Does load but does NOT put function in Matlab mode map or set command switches as expected
(use-package ess
:ensure t
:pin melpa
:init (require 'ess-site)
:preface
(defun spa/ess-insert-pipe (arg)
"Insert pipe '%>%' operator, add a newline and indent. With prefix arg, don't add newline"
(interactive "P")
(if arg
(progn
(just-one-space)
(insert "%>%")
)
(progn
(just-one-space)
(insert "%>%")
;; (ess-newline-and-indent))
(ess-roxy-newline-and-indent))))
(defun spa/ess-insert-assign ()
"Insert asignment operator for R"
(interactive)
(just-one-space)
(insert "<-")
(just-one-space))
;; TODO: Improve this by determining source of error messages
;; and automatically linking scratch R buffer to process
(defun spa/R-scratch ()
"Bring up a 'scratch' R script and console for quick calculations."
(interactive)
(delete-other-windows)
(setq new-buf (get-buffer-create "scratch.R"))
(switch-to-buffer new-buf)
(R-mode)
(setq w1 (selected-window))
(setq w1name (buffer-name))
(setq w2 (split-window w1 nil t))
(if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
(R))
(set-window-buffer w2 "*R*")
(set-window-buffer w1 w1name))
:config
(setq ess-smart-S-assign-key nil)
;; Don't ask me for a directory on startup
(setq ess-ask-for-ess-directory nil)
;; Don't use ido so I can use ivy completion
(setq ess-use-ido nil)
;; Would like to use flymake but it's not currently working
(setq ess-use-flymake nil)
;; (setq ess-help-own-frame t)
(setq ess-ask-about-transfile nil)
;; (setq inferior-ess-own-frame t) ; for 'dedicated' *R* buffers
(setq inferior-R-args "--no-save") ; default is don't ask to save workspace
(setq-default ess-dialect "R")
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)
;; ElDoc
;; This seemed to slow things down too much so disabled
(setq ess-eldoc-show-on-symbol nil) ; shows function arguments even if not in ()
(setq ess-plain-first-buffername nil)
(setq ess-tab-complete-in-script t)
;; Modify the indentation style so that continued statements
;; like piping and adding operations only indent the first line
;; (add-to-list 'ess-style-alist
;; '(my-style
;; (ess-indent-level . 2)