git.fiddlerwoaroof.com
Browse code

chore(emacs): move magit earlier in init.el

fiddlerwoaroof authored on 10/02/2020 00:43:09
Showing 1 changed files
... ...
@@ -92,6 +92,93 @@
92 92
 (defvar fwoar-git-mode :ssh)
93 93
 (when (locate-library "site-lisp")
94 94
   (load "site-lisp"))
95
+
96
+
97
+
98
+(fwoar/zenburn-with-color-variables
99
+  (defface magit-keyword-feature
100
+    `((t :foreground ,zenburn-green :inherit magit-keyword))
101
+    "Face for parts of commit messages inside brackets."
102
+    :group 'magit-faces)
103
+  (defface magit-keyword-chore
104
+    `((t :foreground ,zenburn-blue :inherit magit-keyword))
105
+    "Face for parts of commit messages inside brackets."
106
+    :group 'magit-faces)
107
+  (defface magit-keyword-misc
108
+    `((t :foreground ,zenburn-fg-1 :inherit magit-keyword))
109
+    "Face for parts of commit messages inside brackets."
110
+    :group 'magit-faces)
111
+  (defface magit-keyword-bug
112
+    `((t :foreground ,zenburn-red :inherit magit-keyword))
113
+    "Face for parts of commit messages inside brackets."
114
+    :group 'magit-faces))
115
+
116
+(defun fwoar/propertize-magit-log (_rev msg)
117
+  (let ((boundary 0))
118
+    (while (string-match "^\\(\\(?:feat\\(?:ure\\)?(\\([^)]+?\\))\\)\\|\\(?:feat\\(ure\\)?\\>\\)\\)" msg boundary)
119
+      (setq boundary (match-end 0))
120
+      (magit--put-face (match-beginning 0) boundary
121
+                       'magit-keyword-feature msg)))
122
+  (let ((boundary 0))
123
+    (while (string-match "^\\(\\(?:chore(\\([^)]+?\\))\\)\\|\\(?:chore\\>\\)\\)" msg boundary)
124
+      (setq boundary (match-end 0))
125
+      (magit--put-face (match-beginning 0) boundary
126
+                       'magit-keyword-chore msg)))
127
+  (let ((boundary 0))
128
+    (while (string-match "^\\(\\(?:bug(\\([^)]+?\\))\\)\\|\\(?:bug\\>\\)\\)"  msg boundary)
129
+      (setq boundary (match-end 0))
130
+      (magit--put-face (match-beginning 0) boundary
131
+                       'magit-keyword-bug msg)))
132
+  (let ((boundary 0))
133
+    (while (string-match "^\\([^:\n\t]+\\):"  msg boundary)
134
+      (setq boundary (match-end 0))
135
+      (let ((group (match-string 1 msg)))
136
+        (unless (or (> (length group) 20)
137
+                    (s-starts-with? "feat" group)
138
+                    (s-starts-with? "Merge" group)
139
+                    (s-starts-with? "merge" group)
140
+                    (s-starts-with? "chore" group)
141
+                    (s-starts-with? "bug" group))
142
+          (magit--put-face (match-beginning 0) (1- boundary)
143
+                           'magit-keyword-misc msg))))))
144
+
145
+(use-package magit
146
+  :ensure t
147
+  :config
148
+  (evil-define-key 'normal magit-file-mode-map " a" 'magit)
149
+  ;; TODO: figure this out with transients
150
+  ;;(magit-define-popup-action 'magit-dispatch-popup ?j "Browse remote" 'browse-at-remote)
151
+  'magit-dispatch
152
+
153
+  (advice-add 'magit-log-propertize-keywords :after
154
+              'fwoar/propertize-magit-log))
155
+
156
+(use-package browse-at-remote
157
+  :after magit
158
+  :ensure t
159
+  :config (push (cons "gitlab.cj.com" "gitlab")
160
+                browse-at-remote-remote-type-domains))
161
+
162
+(eval-and-compile
163
+  (defvar *fwoar-git-repos*
164
+    (file-name-as-directory
165
+     (expand-file-name (car (file-expand-wildcards "~/git*_repos"))
166
+                       "~"))))
167
+
168
+(eval-and-compile
169
+  (defun fwoar-git-repo (name ssh-remote http-remote)
170
+    (let ((dir-name (file-name-as-directory (expand-file-name name *fwoar-git-repos*))))
171
+      (unless (file-exists-p dir-name)
172
+        (ecase fwoar-git-mode
173
+          (:ssh (magit-run-git-with-input "clone" ssh-remote dir-name))
174
+          (:http (magit-run-git-with-input "clone" http-remote dir-name))))
175
+      dir-name)))
176
+
177
+(defvar *dotfiles-repo*
178
+  (fwoar-git-repo "dotfiles"
179
+                  "git@git.fiddlerwoaroof.com:dotfiles.git"
180
+                  "https://git.fiddlerwoaroof.com/git/dotfiles.git"))
181
+
95 182
 (defun load-package-configuration (package)
96 183
   (let* ((local-configs "~/.emacs.d/lisp/configurations/")
97 184
          (git-configs (concat *dotfiles-repo*
... ...
@@ -104,6 +191,8 @@
104 191
 ;; slime depends on fwoar-git-repo
105 192
 (load-package-configuration 'slime)
106 193
 (load-package-configuration 'cider)
194
+(evil-define-key 'normal magit-file-mode-map " a" 'magit)
195
+
107 196
 
108 197
 
109 198
 ;;(use-package multifiles
... ...
@@ -429,92 +518,6 @@ With a prefix ARG invalidates the cache first."
429 518
 
430 519
 (use-package highlight-parentheses :ensure t :config
431 520
   (global-highlight-parentheses-mode 1))
432
-
433
-
434
-(fwoar/zenburn-with-color-variables
435
-  (defface magit-keyword-feature
436
-    `((t :foreground ,zenburn-green :inherit magit-keyword))
437
-    "Face for parts of commit messages inside brackets."
438
-    :group 'magit-faces)
439
-  (defface magit-keyword-chore
440
-    `((t :foreground ,zenburn-blue :inherit magit-keyword))
441
-    "Face for parts of commit messages inside brackets."
442
-    :group 'magit-faces)
443
-  (defface magit-keyword-misc
444
-    `((t :foreground ,zenburn-fg-1 :inherit magit-keyword))
445
-    "Face for parts of commit messages inside brackets."
446
-    :group 'magit-faces)
447
-  (defface magit-keyword-bug
448
-    `((t :foreground ,zenburn-red :inherit magit-keyword))
449
-    "Face for parts of commit messages inside brackets."
450
-    :group 'magit-faces))
451
-
452
-(defun fwoar/propertize-magit-log (_rev msg)
453
-  (let ((boundary 0))
454
-    (while (string-match "^\\(\\(?:feat\\(?:ure\\)?(\\([^)]+?\\))\\)\\|\\(?:feat\\(ure\\)?\\>\\)\\)" msg boundary)
455
-      (setq boundary (match-end 0))
456
-      (magit--put-face (match-beginning 0) boundary
457
-                       'magit-keyword-feature msg)))
458
-  (let ((boundary 0))
459
-    (while (string-match "^\\(\\(?:chore(\\([^)]+?\\))\\)\\|\\(?:chore\\>\\)\\)" msg boundary)
460
-      (setq boundary (match-end 0))
461
-      (magit--put-face (match-beginning 0) boundary
462
-                       'magit-keyword-chore msg)))
463
-  (let ((boundary 0))
464
-    (while (string-match "^\\(\\(?:bug(\\([^)]+?\\))\\)\\|\\(?:bug\\>\\)\\)"  msg boundary)
465
-      (setq boundary (match-end 0))
466
-      (magit--put-face (match-beginning 0) boundary
467
-                       'magit-keyword-bug msg)))
468
-  (let ((boundary 0))
469
-    (while (string-match "^\\([^:\n\t]+\\):"  msg boundary)
470
-      (setq boundary (match-end 0))
471
-      (let ((group (match-string 1 msg)))
472
-        (unless (or (> (length group) 20)
473
-                    (s-starts-with? "feat" group)
474
-                    (s-starts-with? "Merge" group)
475
-                    (s-starts-with? "merge" group)
476
-                    (s-starts-with? "chore" group)
477
-                    (s-starts-with? "bug" group))
478
-          (magit--put-face (match-beginning 0) (1- boundary)
479
-                           'magit-keyword-misc msg))))))
480
-
481
-(use-package magit
482
-  :ensure t
483
-  :config
484
-  (evil-define-key 'normal magit-file-mode-map " a" 'magit)
485
-  ;; TODO: figure this out with transients
486
-  ;;(magit-define-popup-action 'magit-dispatch-popup ?j "Browse remote" 'browse-at-remote)
487
-  'magit-dispatch
488
-
489
-  (advice-add 'magit-log-propertize-keywords :after
490
-              'fwoar/propertize-magit-log))
491
-
492
-(use-package browse-at-remote
493
-  :after magit
494
-  :ensure t
495
-  :config (push (cons "gitlab.cj.com" "gitlab")
496
-                browse-at-remote-remote-type-domains))
497
-
498
-(eval-and-compile
499
-  (defvar *fwoar-git-repos*
500
-    (file-name-as-directory
501
-     (expand-file-name (car (file-expand-wildcards "~/git*_repos"))
502
-                       "~"))))
503
-
504
-(eval-and-compile
505
-  (defun fwoar-git-repo (name ssh-remote http-remote)
506
-    (let ((dir-name (file-name-as-directory (expand-file-name name *fwoar-git-repos*))))
507
-      (unless (file-exists-p dir-name)
508
-        (ecase fwoar-git-mode
509
-          (:ssh (magit-run-git-with-input "clone" ssh-remote dir-name))
510
-          (:http (magit-run-git-with-input "clone" http-remote dir-name))))
511
-      dir-name)))
512
-
513
-(defvar *dotfiles-repo*
514
-  (fwoar-git-repo "dotfiles"
515
-                  "git@git.fiddlerwoaroof.com:dotfiles.git"
516
-                  "https://git.fiddlerwoaroof.com/git/dotfiles.git"))
517
-
518 521
 (global-company-mode 1)
519 522
 
520 523