git.fiddlerwoaroof.com
Browse code

emacs: misc fixes

fiddlerwoaroof authored on 30/07/2019 00:17:11
Showing 4 changed files
... ...
@@ -1,5 +1,4 @@
1 1
 ;; -*- mode: Emacs-Lisp;tab-width: 8;indent-tabs-mode: nil; -*-
2
-
3 2
 (setq gc-cons-threshold 100000000
4 3
       inhibit-splash-screen t
5 4
       inhibit-startup-message t)
... ...
@@ -15,6 +14,11 @@
15 14
                (bottom-divider-width . 2)))
16 15
        (modify-all-frames-parameters default-frame-alist))
17 16
 
17
+(let ((my-theme-path (expand-file-name "~/.emacs.d/themes/")))
18
+  (add-to-list 'load-path my-theme-path)
19
+  (add-to-list 'custom-theme-load-path my-theme-path)
20
+  (load-theme 'fwoar-zenburn t))
21
+
18 22
 (tool-bar-mode 0)
19 23
 (scroll-bar-mode 0)
20 24
 
... ...
@@ -22,18 +26,19 @@
22 26
 
23 27
 (let ((default-directory  "~/.emacs.d/lisp/"))
24 28
   (make-directory default-directory t)
25
-  (normal-top-level-add-to-load-path '("."))
29
+  (add-to-list 'load-path (expand-file-name default-directory))
26 30
   (normal-top-level-add-subdirs-to-load-path)
27 31
   (load "utils"))
28 32
 
29 33
 (cold-boot)
30
-
34
+(load "site-lisp")
31 35
 (load-package-configuration 'evil)
32 36
 
33 37
 
34
-(use-package multifiles
35
-  :config
36
-  (define-key evil-visual-state-map " m" 'mf/mirror-region-in-multifile))
38
+;;(use-package multifiles
39
+;;  :config
40
+;;  (define-key evil-visual-state-map " m" 'mf/mirror-region-in-multifile)
41
+;;  )
37 42
 
38 43
 (use-package org
39 44
   :pin "org"
... ...
@@ -62,6 +67,7 @@
62 67
   (define-key evil-visual-state-map " c" 'org-capture))
63 68
 
64 69
 (use-package org-projectile
70
+  :ensure t
65 71
   :config
66 72
   (progn
67 73
     (org-projectile-per-project)
... ...
@@ -74,6 +80,7 @@
74 80
   :ensure t)
75 81
 
76 82
 (use-package org-projectile-helm
83
+  :ensure t
77 84
   :after org-projectile
78 85
   :config
79 86
   (define-key projectile-mode-map (kbd "C-c n p") 'org-projectile-helm-template-or-project))
... ...
@@ -91,8 +98,6 @@
91 98
   :config
92 99
   (define-key evil-insert-state-map (kbd "C-c ,") 'emmet-expand-line))
93 100
 
94
-(use-package company-posframe
95
-  :ensure t)
96 101
 (use-package company
97 102
   :config
98 103
   ;; keybindings
... ...
@@ -116,7 +121,12 @@
116 121
            company-etags
117 122
            company-keywords)
118 123
           company-oddmuse
119
-          company-dabbrev))
124
+          company-dabbrev)))
125
+
126
+(use-package company-posframe
127
+  :ensure t
128
+  :after company
129
+  :config
120 130
   (add-hook 'company-mode-hook (lambda () (company-posframe-mode 1))))
121 131
 
122 132
 (use-package lisp-skeletons
... ...
@@ -128,10 +138,8 @@
128 138
   (define-key evil-normal-state-map " g" 'helm-generate-lisp-skeleton)
129 139
   (define-key evil-visual-state-map " g" 'helm-generate-lisp-skeleton))
130 140
 
131
-(load-package-configuration 'slime)
132
-(global-company-mode 1)
133
-
134 141
 
142
+
135 143
 (use-package js2-mode
136 144
   :ensure t
137 145
   :defer t
... ...
@@ -471,11 +479,36 @@ With a prefix ARG invalidates the cache first."
471 479
 (use-package highlight-parentheses :ensure t :config
472 480
   (global-highlight-parentheses-mode 1))
473 481
 
474
-(use-package magit :ensure t :config
482
+
483
+
484
+(use-package magit :ensure t
485
+  :config
475 486
   (evil-define-key 'normal magit-file-mode-map " a" 'magit)
476
-  (magit-define-popup-action 'magit-dispatch-popup 106 "Browse remote" 'browse-at-remote)
487
+  ;; TODO: figure this out with transients
488
+  ;;(magit-define-popup-action 'magit-dispatch-popup ?j "Browse remote" 'browse-at-remote)
477 489
   'magit-dispatch)
478 490
 
491
+
492
+(defvar *fwoar-git-repos*
493
+  (file-name-as-directory
494
+   (expand-file-name (car (file-expand-wildcards "~/git*_repos"))
495
+                     "~")))
496
+
497
+(defun fwoar-git-repo (name remote)
498
+  (let ((dir-name (file-name-as-directory (expand-file-name name *fwoar-git-repos*))))
499
+    (unless (file-exists-p dir-name)
500
+      (magit-run-git-with-input "clone" remote dir-name))
501
+    dir-name))
502
+
503
+(defvar *dotfiles-repo*
504
+  (fwoar-git-repo "dotfiles" "git@git.fiddlerwoaroof.com:dotfiles.git"))
505
+
506
+;; slime depends on fwoar-git-repo
507
+(load-package-configuration 'slime)
508
+(global-company-mode 1)
509
+
510
+
511
+
479 512
 (use-package markdown-mode :ensure t)
480 513
 
481 514
 (use-package project-explorer :ensure t)
... ...
@@ -546,8 +579,9 @@ With a prefix ARG invalidates the cache first."
546 579
 (global-set-key (kbd "s-v") 'yank)
547 580
 
548 581
 (setq custom-file "~/.emacs.d/custom.el")
582
+(load-file custom-file)
583
+
549 584
 
550
-(defvar *dotfiles-repo* "~/git_repos/dotfiles/")
551 585
 (defun edit-init-el ()
552 586
   (interactive)
553 587
   (let ((default-directory *dotfiles-repo*))
... ...
@@ -569,24 +603,6 @@ With a prefix ARG invalidates the cache first."
569 603
 
570 604
 (setq org-agenda-files '("~/org/notes.org"))
571 605
 
572
-(load-file custom-file)
573
-
574
-(defun read-sexps-in-file (fn)
575
-  (with-temp-buffer
576
-    (save-excursion
577
-      (insert "(")
578
-      (insert-file fn)
579
-      (goto-char (point-max))
580
-      (insert "\n)"))
581
-    (read (current-buffer))))
582
-
583
-(comment
584
- (use-package circe
585
-   :config
586
-   (setq circe-server-buffer-name "{host}:{port}"
587
-         circe-reduce-lurker-spam t
588
-         circe-network-options (read-sexps-in-file "~/.circe-info"))))
589
-
590 606
 (defvar url-pattern (car (read-sexps-in-file "~/.pastebin-name")))
591 607
 (defun pastebin-buffer ()
592 608
   (interactive)
... ...
@@ -8,11 +8,15 @@
8 8
   (interactive "P")
9 9
   (sp-wrap-with-pair "${"))
10 10
 
11
+(defun fwoar-delete-mru-window ()
12
+  (interactive)
13
+  (delete-window
14
+   (get-mru-window nil nil t)))
11 15
 (use-package evil
12 16
   :ensure t
13 17
   :config
14 18
 
15
-  (define-key evil-motion-state-map (kbd "C-w C-o") 'delete-mru-window)
19
+  (define-key evil-motion-state-map (kbd "C-w C-o") 'fwoar-delete-mru-window)
16 20
   (define-key evil-motion-state-map (kbd "C-w C-w") 'evil-window-mru)
17 21
 
18 22
   (define-key evil-normal-state-map "ZZ" 'save-buffer)
... ...
@@ -154,3 +158,5 @@
154 158
   (define-key evil-normal-state-map "gT" 'centaur-tabs-backward-tab)
155 159
   (define-key global-map (kbd "<header-line> <wheel-down>") 'centaur-tabs-backward-tab)
156 160
   (define-key global-map (kbd "s-{") 'centaur-tabs-backward-tab))
161
+ 
162
+
... ...
@@ -1,10 +1,33 @@
1 1
 ;;;; SLIME SETUP {{{
2 2
 ;; (load (expand-file-name "~/quicklisp/slime-helper.el"))
3
-(add-to-list 'load-path "~/git_repos/3dp/slime/")
3
+(add-to-list 'load-path (fwoar-git-repo "3dp/slime/" "git@github.com:slime/slime.git"))
4 4
 (require 'slime)
5 5
 
6
-(use-package slime-company
7
-  :ensure t)
6
+;; put slime-company in load-path
7
+;; (require 'slime-company)
8
+
9
+(defmacro define-lisp-implementations (&rest decl)
10
+  `(progn
11
+     ,@(cl-loop for (symbol . args) in decl
12
+                collect `(progn
13
+                           (defun ,symbol ()
14
+                             (interactive)
15
+                             (slime ',symbol))
16
+                           (cl-pushnew '(,symbol ,@args) slime-lisp-implementations
17
+                                       :key 'car)))))
18
+
19
+(with-eval-after-load "slime"
20
+  (when (or (eq system-type 'gnu/linux)
21
+            (eq system-type 'darwin))
22
+    (define-lisp-implementations
23
+      (abcl  ("abcl"))
24
+      (ccl ("ccl"))
25
+      (clisp ("clisp"))
26
+      (cmucl ("cmucl" "-quiet"))
27
+      (ecl   ("ecl"))
28
+      ;;(mkcl  ("mkcl"))
29
+      ;;(xcl   ("xcl"))
30
+      (sbcl  ("sbcl" "--dynamic-space-size" "8192")))))
8 31
 
9 32
 (global-set-key (kbd "C-c x") 'slime-export-symbol-at-point)
10 33
 
... ...
@@ -126,43 +149,10 @@
126 149
   (slime-eval-async `(ql:quickload ',(find-use-clause (list-at-point)))))
127 150
 
128 151
 
129
-(message (format "s-c-c is: %s" slime-company-completion))
130
-
131
-(setq slime-contribs '(slime-fancy
132
-                       slime-company
133
-                       slime-macrostep
134
-                       slime-trace-dialog
135
-                       slime-mdot-fu
136
-                       slime-buffer-streams
137
-                       slime-indentation)
138
-      slime-export-save-file t)
139
-
140
-(slime-setup)
152
+;;(message (format "s-c-c is: %s" slime-company-completion))
141 153
 
142 154
 ;;;;; }}}
143 155
 
144
-(defmacro define-lisp-implementations (&rest decl)
145
-  `(progn
146
-     ,@(cl-loop for (symbol . args) in decl
147
-                collect `(progn
148
-                           (defun ,symbol ()
149
-                             (interactive)
150
-                             (slime ',symbol))
151
-                           (cl-pushnew '(,symbol ,@args) slime-lisp-implementations
152
-                                       :key 'car)))))
153
-
154
-(with-eval-after-load "slime"
155
-  (when (or (eq system-type 'gnu/linux)
156
-            (eq system-type 'darwin))
157
-    (define-lisp-implementations
158
-      (abcl  ("abcl"))
159
-      (ccl ("ccl"))
160
-      (clisp ("clisp"))
161
-      (cmucl ("cmucl" "-quiet"))
162
-      (ecl   ("ecl"))
163
-      ;;(mkcl  ("mkcl"))
164
-      ;;(xcl   ("xcl"))
165
-      (sbcl  ("sbcl" "--dynamic-space-size" "8192")))))
166 156
 
167 157
 
168 158
 (defun sp-absorb-forward-sexp (&optional arg)
... ...
@@ -219,3 +209,14 @@ Examples:
219 209
                            (lambda (r)
220 210
                              (message "Loading ASDs done: %s" r))))))
221 211
            (:one-liner "Load asd for current project")))
212
+
213
+(setq slime-contribs '(slime-fancy
214
+                       slime-company
215
+                       slime-macrostep
216
+                       slime-trace-dialog
217
+                       slime-mdot-fu
218
+                       slime-buffer-streams
219
+                       slime-indentation)
220
+      slime-export-save-file t)
221
+
222
+(slime-setup slime-contribs)
... ...
@@ -1,16 +1,25 @@
1 1
 (require 'cl)
2 2
 
3
+(defun read-sexps-in-file (fn)
4
+  (with-temp-buffer
5
+    (save-excursion
6
+      (insert "(")
7
+      (insert-file fn)
8
+      (goto-char (point-max))
9
+      (insert "\n)"))
10
+    (read (current-buffer))))
11
+
3 12
 (defun op--collect-args (body)
4 13
   (cl-flet ((walker (body &optional args)
5
-                 (if (null body)
6
-                     args
7
-                   (if (symbolp body)
8
-                       (when (eql ?\_ (elt (symbol-name body) 0))
9
-                         (cons body args))
10
-                     (if (listp body)
11
-                         (append (op--collect-args (car body))
12
-                                 (op--collect-args (cdr body))
13
-                                 ))))))
14
+                    (if (null body)
15
+                        args
16
+                      (if (symbolp body)
17
+                          (when (eql ?\_ (elt (symbol-name body) 0))
18
+                            (cons body args))
19
+                        (if (listp body)
20
+                            (append (op--collect-args (car body))
21
+                                    (op--collect-args (cdr body))
22
+                                    ))))))
14 23
     (sort (walker body)
15 24
           (lambda (a b)
16 25
             (< (string-to-number (subseq (symbol-name a) 1))
... ...
@@ -66,10 +75,14 @@ that used by the user's shell.
66 75
 started from a shell."
67 76
   (interactive)
68 77
   (let ((path-from-shell
69
-         (replace-regexp-in-string "[ \t\n]*$" ""
70
-                                   (shell-command-to-string
71
-                                    "zsh -c 'source ~/.zsh.d/dependencies/utils.zsh;source ~/.zsh.d/dependencies/path-setup.zsh;echo $PATH'")
72
-)))
78
+         (replace-regexp-in-string
79
+          "[ \t\n]*$" ""
80
+          (shell-command-to-string
81
+           (concat "zsh -c '"
82
+                   "  source ~/.zsh.d/dependencies/utils.zsh;"
83
+                   "  source ~/.zsh.d/dependencies/path-setup.zsh;"
84
+                   "  echo $PATH"
85
+                   "'")))))
73 86
     (setenv "PATH" path-from-shell)
74 87
     (setq exec-path (split-string path-from-shell path-separator))))
75 88
 
... ...
@@ -131,7 +144,9 @@ started from a shell."
131 144
   ;; (paredit-mode)
132 145
   ;;(global-company-mode)
133 146
   ;; (setq linum-format "%5d\u2502")
134
-  (global-display-line-numbers-mode)
147
+  (if (version<= "26.0.50" emacs-version )
148
+      (global-display-line-numbers-mode)
149
+    (global-linum-mode))
135 150
   (set-exec-path-from-shell-PATH)
136 151
   ;; NOTE: this must be here...
137 152
   (global-company-mode 1))