1 | (require 'package)
|
---|
2 |
|
---|
3 | (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
|
---|
4 | ("melpa" . "http://melpa.org/packages/")))
|
---|
5 |
|
---|
6 | (when (< emacs-major-version 27)
|
---|
7 | (package-initialize))
|
---|
8 |
|
---|
9 | (require 'gnutls)
|
---|
10 |
|
---|
11 | (progn
|
---|
12 | (package-refresh-contents)
|
---|
13 | (package-install 'avy)
|
---|
14 | (package-install 'php-mode)
|
---|
15 | (package-install 'phps-mode)
|
---|
16 | ;; (package-install 'anzu)
|
---|
17 | (package-install 'anaconda-mode)
|
---|
18 | (package-install 'auctex)
|
---|
19 | ;; (package-install 'rmsbolt)
|
---|
20 | ;; (package-install 'beginend)
|
---|
21 | ;; (package-install 'composer)
|
---|
22 | (package-install 'cinspect)
|
---|
23 | (package-install 'debian-el)
|
---|
24 | (package-install 'dpkg-dev-el)
|
---|
25 | (package-install 'edebug-inline-result)
|
---|
26 | ;;(package-install 'haskell-mode)
|
---|
27 | ;;(package-install 'idris-mode)
|
---|
28 | (package-install 'magit)
|
---|
29 | (package-install 'git-timemachine)
|
---|
30 | (package-install 'git-dwim)
|
---|
31 | (package-install 'gitpatch)
|
---|
32 | (package-install 'goto-chg)
|
---|
33 | (package-install 'debbugs)
|
---|
34 | ;;(package-install 'deft)
|
---|
35 | ;; (package-install 'direnv)
|
---|
36 | (package-install 'dumb-jump)
|
---|
37 | (package-install 'docker)
|
---|
38 | (package-install 'docker-cli)
|
---|
39 | (package-install 'docker-tramp)
|
---|
40 | (package-install 'docker-compose-mode)
|
---|
41 | (package-install 'org-sql)
|
---|
42 | ;;(package-install 'eglot)
|
---|
43 | ;; (package-install 'eglot-java)
|
---|
44 | ;; (package-install 'mastodon)
|
---|
45 | ;; (package-install 'exec-path-from-shell)
|
---|
46 | (package-install 'expand-region)
|
---|
47 | ;; (package-install 'flymake-php)
|
---|
48 | (package-install 'flycheck)
|
---|
49 | (package-install 'flycheck-phpstan)
|
---|
50 | (package-install 'phpactor)
|
---|
51 | ;;(package-install 'robe)
|
---|
52 | (package-install 'geiser)
|
---|
53 | (package-install 'geiser-guile)
|
---|
54 | (package-install 'guix)
|
---|
55 | ;; (package-install 'git-gutter)
|
---|
56 | ;; (package-install 'gnuplot)
|
---|
57 | ;;(package-install 'swiper)
|
---|
58 | ;;(package-install 'sqlite3)
|
---|
59 | (package-install 'org-roam)
|
---|
60 | ;; (package-install 'org-roam-ui)
|
---|
61 | ;; (package-install 'org-download)
|
---|
62 | ;; (package-install 'org-babel-eval-in-repl)
|
---|
63 | ;;(package-install 'ob-php)
|
---|
64 | ;; (package-install 'on-screen)
|
---|
65 | ;;(package-install 'nix-mode)
|
---|
66 | (package-install 'pdf-tools)
|
---|
67 | ;;(package-install 'phpactor)
|
---|
68 | ;; (package-install 'company-quickhelp)
|
---|
69 | ;;(package-install 'ac-php)
|
---|
70 | (package-install 'php-mode)
|
---|
71 | (package-install 'php-quickhelp)
|
---|
72 | (package-install 'phan)
|
---|
73 | ;;(package-install 'php-cs-fixer)
|
---|
74 | ;; (package-install 'company-php)
|
---|
75 | ;;(package-install 'php-eldoc)
|
---|
76 | ;;(package-install 'phps-mode)
|
---|
77 | (package-install 'realgud)
|
---|
78 | ;; (package-install 'realgud-xdebug)
|
---|
79 | ;; (package-install 'kiwix)
|
---|
80 | ;;(package-install 'sml-mode)
|
---|
81 | (package-install 'sly)
|
---|
82 | (package-install 'simple-httpd)
|
---|
83 | (package-install 'sudo-edit)
|
---|
84 | ;;(package-install 'treemacs)
|
---|
85 | (package-install 'undo-tree)
|
---|
86 | ;; (package-install 'yasnippet)
|
---|
87 | ;; (package-install 'yasnippet-snippets)
|
---|
88 | ;; (package-install 'vimrc-mode)
|
---|
89 | ;; (package-install 'flymake-phpcs)
|
---|
90 | ;; (package-install 'flymake-phpstan)
|
---|
91 | ;; (package-install 'no-littering)
|
---|
92 | (package-install 'web-mode)
|
---|
93 | ;; (package-install 'which-key)
|
---|
94 | ;; (package-install 'reverse-im)
|
---|
95 | (package-install 'imenu-list)
|
---|
96 | ;; (package-install 'isearch-mb)
|
---|
97 | (package-install 'visual-fill-column)
|
---|
98 | ;; (package-install 'browse-kill-ring)
|
---|
99 | (package-install 'corfu)
|
---|
100 | ;; (package-install 'inf-ruby)
|
---|
101 | (package-install 'yaml-mode)
|
---|
102 | ;; (package-install 'geben)
|
---|
103 | (package-install 'link-hint)
|
---|
104 | (package-install 'whole-line-or-region)
|
---|
105 | (package-install 'quickrun)
|
---|
106 | ;; (package-install 'psysh)
|
---|
107 | ;; (package-install 'restclient)
|
---|
108 | )
|
---|
109 |
|
---|
110 | (when (eq window-system 'pgtk)
|
---|
111 | (pgtk-use-im-context t))
|
---|
112 |
|
---|
113 | (when (fboundp 'native-compile-async)
|
---|
114 | (setq comp-async-compilation t
|
---|
115 | package-native-compile t
|
---|
116 |
|
---|
117 | native-comp-speed 2
|
---|
118 | native-comp-async-jobs-number 1
|
---|
119 | comp-num-cpus 2
|
---|
120 | ;; JIT Compilation
|
---|
121 | native-comp-deferred-compilation t
|
---|
122 | ;; AOT Compilation
|
---|
123 | package-native-compile t
|
---|
124 | comp-async-report-warnings-errors nil))
|
---|
125 |
|
---|
126 | ;; (native-compile-async "~/.emacs.d/elpa/" 'recursively)
|
---|
127 | (native-compile-async "~/.guix-profile/share/emacs/site-lisp" 'recursively)
|
---|
128 |
|
---|
129 | ;; block until native compilation has finished
|
---|
130 | (while (or comp-files-queue
|
---|
131 | (> (comp-async-runnings) 0))
|
---|
132 |
|
---|
133 | ;; Disable guix autoloading and x resources loading
|
---|
134 | (setq site-run-file nil)
|
---|
135 |
|
---|
136 | (require 'exwm)
|
---|
137 | (require 'exwm-config)
|
---|
138 | (exwm-config-example)
|
---|
139 |
|
---|
140 | ;; Change mode-line-modes to show only major mode
|
---|
141 | (defvar mode-line-major-mode
|
---|
142 | (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out"))
|
---|
143 | (list (propertize "%[" 'help-echo recursive-edit-help-echo)
|
---|
144 | `(:propertize ("" mode-name)
|
---|
145 | help-echo "Major mode\n\
|
---|
146 | mouse-1: Display major mode menu\n\
|
---|
147 | mouse-2: Show help for major mode\n\
|
---|
148 | mouse-3: Toggle minor modes"
|
---|
149 | mouse-face mode-line-highlight
|
---|
150 | local-map ,mode-line-major-mode-keymap)
|
---|
151 | '("" mode-line-process)
|
---|
152 | (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer"
|
---|
153 | 'mouse-face 'mode-line-highlight
|
---|
154 | 'local-map (make-mode-line-mouse-map
|
---|
155 | 'mouse-2 #'mode-line-widen))
|
---|
156 | (propertize "%]" 'help-echo recursive-edit-help-echo)
|
---|
157 | " "))
|
---|
158 | "Mode line construct for displaying major and minor modes.")
|
---|
159 |
|
---|
160 | (put 'mode-line-major-mode 'risky-local-variable t)
|
---|
161 |
|
---|
162 | ;; Change mode-line-format
|
---|
163 | (setq-default mode-line-format
|
---|
164 | '("%e"
|
---|
165 | mode-line-front-space
|
---|
166 | mode-line-mule-info
|
---|
167 |
|
---|
168 | mode-line-client
|
---|
169 | mode-line-modified
|
---|
170 | mode-line-remote
|
---|
171 | mode-line-frame-identification
|
---|
172 | ;; long-path
|
---|
173 | mode-line-buffer-identification
|
---|
174 | mode-line-misc-info
|
---|
175 | " "
|
---|
176 | mode-line-major-mode
|
---|
177 | " "
|
---|
178 | vc-mode
|
---|
179 | " "
|
---|
180 |
|
---|
181 | mode-line-position
|
---|
182 | mode-line-end-spaces
|
---|
183 | ))
|
---|
184 |
|
---|
185 | ;; Do not resize the frame at this early stage.
|
---|
186 | (setq frame-inhibit-implied-resize t)
|
---|
187 | (setq use-dialog-box nil)
|
---|
188 |
|
---|
189 | ;;; Disable some gui
|
---|
190 | (scroll-bar-mode -1)
|
---|
191 | (tool-bar-mode -1)
|
---|
192 | (menu-bar-mode -1)
|
---|
193 | ;;(tooltip-mode -1)
|
---|
194 |
|
---|
195 | ;;; Changing emacs default setting through customize
|
---|
196 | (custom-set-variables
|
---|
197 | '(fill-column 72)
|
---|
198 | '(git-gutter:added-sign " ")
|
---|
199 | '(git-gutter:deleted-sign " ")
|
---|
200 | '(git-gutter:modified-sign " ")
|
---|
201 | '(git-gutter:unchanged-sign " ")
|
---|
202 | '(lsp-headerline-breadcrumb-enable nil)
|
---|
203 | '(scroll-bar-mode 'nil)
|
---|
204 | '(scroll-bar-adjust-thumb-portion nil)
|
---|
205 | '(tool-bar-position 'bottom)
|
---|
206 | '(tool-bar-style 'both-horiz))
|
---|
207 |
|
---|
208 | (custom-set-faces
|
---|
209 | '(default ((t (:height 140 :family "Jetbrains Mono" :embolden t))))
|
---|
210 | '(region ((t (:background "gray85"))))
|
---|
211 | '(mode-line ((t (:background "grey70" :foreground "grey10"))))
|
---|
212 | '(mode-line-inactive ((t (:inherit mode-line :background "grey90" :foreground "grey20" :box (:line-width (-2 . -2) :color "grey85") :weight light))))
|
---|
213 | '(mode-line-buffer-id ((t (:weight bold))))
|
---|
214 | '(mode-line-emphasis ((t (:weight bold))))
|
---|
215 | '(lsp-modeline-code-actions-face ((t :inherit mode-line :height 100)))
|
---|
216 | '(tool-bar ((t (:background "grey80" :foreground "grey10"))))
|
---|
217 | '(fill-column-indicator ((t (:foreground "grey95"))))
|
---|
218 | '(hl-line ((t (:background "gray95"))))
|
---|
219 | '(fringe ((t (:background "grey87"))))
|
---|
220 | '(header-line ((t (:inherit mode-line :background "grey90"))))
|
---|
221 | '(vertical-border ((t (:foreground "grey90"))))
|
---|
222 | '(window-divider ((t (:foreground "gray90")))))
|
---|
223 |
|
---|
224 | (set-fringe-style (cons 7 7))
|
---|
225 |
|
---|
226 | (defun switch-gui ()
|
---|
227 | "Disable/enable menu-bar and tool-bar."
|
---|
228 | (interactive)
|
---|
229 | (if menu-bar-mode
|
---|
230 | (progn
|
---|
231 | (menu-bar-mode -1)
|
---|
232 | (tool-bar-mode -1)
|
---|
233 | (scroll-bar-mode -1))
|
---|
234 | (progn
|
---|
235 | (menu-bar-mode 1)
|
---|
236 | (tool-bar-mode 1)
|
---|
237 | (scroll-bar-mode 1))))
|
---|
238 |
|
---|
239 | (defun switch-scroll-bar ()
|
---|
240 | "Disable/enable scroll-bar."
|
---|
241 | (interactive)
|
---|
242 | (if scroll-bar-mode
|
---|
243 | (scroll-bar-mode -1)
|
---|
244 | (scroll-bar-mode)))
|
---|
245 |
|
---|
246 | (define-key global-map (kbd "<f5>") 'switch-gui)
|
---|
247 | (define-key global-map (kbd "<f8>") 'switch-scroll-bar)
|
---|
248 |
|
---|
249 | (provide 'early-init)
|
---|
250 | ;;; early-init.el ends here
|
---|
251 |
|
---|
252 | ;;(add-hook 'prog-mode-hook 'flymake-mode)
|
---|
253 |
|
---|
254 | (require 'psalm)
|
---|
255 |
|
---|
256 | (define-prefix-command 'flymake-map)
|
---|
257 | (global-set-key (kbd "C-q") 'flymake-map)
|
---|
258 | (define-key flymake-map (kbd "n") 'flymake-goto-next-error)
|
---|
259 | (define-key flymake-map (kbd "p") 'flymake-goto-prev-error)
|
---|
260 | (define-key flymake-map (kbd "l") 'flymake-show-diagnostics-buffer)
|
---|
261 | (define-key flymake-map (kbd "e") 'flymake-show-diagnostic)
|
---|
262 |
|
---|
263 | ;; (require 'psalm)
|
---|
264 |
|
---|
265 | (when (package-loaded? "flycheck")
|
---|
266 |
|
---|
267 | (defun flycheck-phanclient-start-daemon ()
|
---|
268 | "Start the phan daemon"
|
---|
269 | (interactive)
|
---|
270 | (let* ((default-directory (php-project-get-root-dir))
|
---|
271 | (phan-executable (or flycheck-phanclient--phan-executable
|
---|
272 | (if (file-exists-p "vendor/bin/phan")
|
---|
273 | (concat default-directory "vendor/bin/phan")
|
---|
274 | (executable-find "phan"))))
|
---|
275 | (cmd (list phan-executable "--daemonize-tcp-port" "4846" "--quick")))
|
---|
276 | (apply #'start-process "PhanDaemon" "*phan daemon*" cmd)))
|
---|
277 |
|
---|
278 | (flycheck-define-checker php-phanclient
|
---|
279 | "Phan"
|
---|
280 | :command ("phan_client" "-l" source-original "-f" source)
|
---|
281 | :error-patterns
|
---|
282 | ((warning line-start (or "Parse" "Fatal" "syntax" "Phan") " error" (any ":" ",") " " (message) " in " (file-name) " on line " line line-end))
|
---|
283 | :modes (php-mode php+-mode))
|
---|
284 |
|
---|
285 | (add-to-list 'flycheck-checkers 'php-phanclient)
|
---|
286 |
|
---|
287 | (flycheck-add-next-checker 'php '(warning . php-phanclient))
|
---|
288 |
|
---|
289 | (add-hook 'prog-mode-hook 'flycheck-mode))
|
---|
290 |
|
---|
291 | (when (package-loaded? "treemacs")
|
---|
292 | (progn
|
---|
293 | (setq treemacs-width 50
|
---|
294 | treemacs-show-cursor t
|
---|
295 | treemacs-position 'right
|
---|
296 | treemacs-indentation 1
|
---|
297 | treemacs-tag-follow-mode t
|
---|
298 | treemacs-fringe-indicator-mode nil)
|
---|
299 |
|
---|
300 | (define-key global-map
|
---|
301 | (kbd "C-x C-d") 'treemacs)))
|
---|
302 |
|
---|
303 | (when (package-loaded? "isearch-mb")
|
---|
304 | (progn
|
---|
305 | (isearch-mb-mode t)
|
---|
306 | (global-set-key (kbd "C-s") 'isearch-forward-regexp)
|
---|
307 | (global-set-key (kbd "C-r") 'isearch-backward-regexp)))
|
---|
308 |
|
---|
309 | (when (package-loaded? "browse-kill-ring")
|
---|
310 | (define-key global-map (kbd "C-M-y") 'browse-kill-ring))
|
---|
311 |
|
---|
312 | (setq path-to-ctags "~/.guix-profile/bin/ctags")
|
---|
313 |
|
---|
314 | (defun tags-create (dir-name)
|
---|
315 | "Create tags file."
|
---|
316 | (interactive "DDirectory: ")
|
---|
317 | (shell-command
|
---|
318 | (format "%s -f TAGS -e -R %s" path-to-ctags
|
---|
319 | (directory-file-name dir-name))))
|
---|
320 |
|
---|
321 | (defun tags-create-python (dir-name)
|
---|
322 | "Create tags with python interpreter"
|
---|
323 | (interactive "DDirectory: ")
|
---|
324 | (shell-command
|
---|
325 | (format "%s -f TAGS -e -R --fields=+l --languages=python --python-kinds=-iv $(python -c \"import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))\") %s" path-to-ctags
|
---|
326 | (directory-file-name dir-name))))
|
---|
327 |
|
---|
328 | (when (package-loaded? "realgud")
|
---|
329 | (load "~/.emacs.d/site-lisp/realgud-xdebug/realgud-xdebug.el"))
|
---|
330 |
|
---|
331 | (when (package-loaded? "geben")
|
---|
332 | (setq geben-dbgp-default-port 9003))
|
---|
333 |
|
---|
334 | (when (package-loaded? "corfu")
|
---|
335 | (progn
|
---|
336 | (setq corfu-preview-current 'nil
|
---|
337 | corfu-popupinfo-delay t)
|
---|
338 | (corfu-mode 1)
|
---|
339 | (corfu-popupinfo-mode 1)
|
---|
340 | (defun show-default-completion-buffer ()
|
---|
341 | (interactive)
|
---|
342 | (corfu-quit)
|
---|
343 | (corfu-mode -1)
|
---|
344 | (completion-at-point)
|
---|
345 | (corfu-mode 1)
|
---|
346 | (corfu-popupinfo-mode 1))
|
---|
347 | (define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
|
---|
348 | (define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
|
---|
349 | (define-key corfu-map (kbd "C-M-i") 'show-default-completion-buffer)
|
---|
350 | (corfu-mode -1)
|
---|
351 | (add-hook 'prog-mode-hook 'corfu-mode)
|
---|
352 |
|
---|
353 | (defun corfu-send-shell (&rest _)
|
---|
354 | "Send completion candidate when inside comint/eshell."
|
---|
355 | (cond
|
---|
356 | ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
|
---|
357 | (eshell-send-input))
|
---|
358 | ((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
|
---|
359 | (comint-send-input))))
|
---|
360 |
|
---|
361 | (advice-add #'corfu-insert :after #'corfu-send-shell)
|
---|
362 |
|
---|
363 | (add-hook 'eshell-mode-hook 'corfu-mode)))
|
---|
364 |
|
---|
365 | (setq completion-styles '(basic partial-completion substring flex emacs22)
|
---|
366 | completion-ignore-case t
|
---|
367 | read-buffer-completion-ignore-case t
|
---|
368 | read-file-name-completion-ignore-case t)
|
---|
369 |
|
---|
370 | (setq aggressive-completion-delay 0.5)
|
---|
371 | (aggressive-completion-mode t)
|
---|
372 |
|
---|
373 | (load "deft-autoloads")
|
---|
374 |
|
---|
375 | (define-key global-map
|
---|
376 | (kbd "C-c n s") 'deft)
|
---|
377 |
|
---|
378 | (setq deft-recursive t
|
---|
379 | deft-use-filter-string-for-filename t
|
---|
380 | deft-default-extension "org md"
|
---|
381 | deft-directory "~/projects/at-w96k/content/digarden")
|
---|
382 |
|
---|
383 | (when (package-loaded? "yasnippet")
|
---|
384 | (progn
|
---|
385 | (add-hook 'prog-mode-hook #'yas-minor-mode)))
|
---|
386 |
|
---|
387 | (defun my-php-mode-setup ()
|
---|
388 | "My PHP-mode hook."
|
---|
389 | (require 'flycheck-phpstan)
|
---|
390 | (flycheck-mode t))
|
---|
391 |
|
---|
392 | (add-hook 'php-mode-hook 'my-php-mode-setup)
|
---|
393 |
|
---|
394 | ;; (add-hook 'php-mode-hook 'flymake-php-load)
|
---|
395 | ;; (add-hook 'php-mode-hook 'flymake-phpstan-turn-on)
|
---|
396 |
|
---|
397 | ;; (require 'flycheck-phpstan)
|
---|
398 |
|
---|
399 |
|
---|
400 | ;;(add-to-list 'auto-mode-alist '("\\.\\(php\\|phtml\\)\\'" . phps-mode))
|
---|
401 |
|
---|
402 | ;; (phps-mode-flycheck-setup)
|
---|
403 |
|
---|
404 | ;; (setq phps-mode-async-process t)
|
---|
405 | ;; (setq phps-mode-async-process-using-async-el t)
|
---|
406 |
|
---|
407 | (desktop-save-mode 1)
|
---|
408 |
|
---|
409 | (global-anzu-mode t)
|
---|
410 |
|
---|
411 | (load "swiper-autoloads")
|
---|
412 | (global-set-key (kbd "C-s") 'swiper)
|
---|
413 |
|
---|
414 | (setq swiper-include-line-number-in-search t
|
---|
415 | swiper-use-visual-line t
|
---|
416 | swiper-stay-on-quit t)
|
---|
417 |
|
---|
418 | (load "which-key-autoloads")
|
---|
419 | (which-key-setup-side-window-right)
|
---|
420 | (which-key-mode)
|
---|
421 |
|
---|
422 | (setq which-key-side-window-max-width 0.5
|
---|
423 | which-key-show-remaining-keys t
|
---|
424 | which-key-max-display-columns 50
|
---|
425 | which-key-max-description-length 35
|
---|
426 | which-key-sort-order 'which-key-local-then-key-order
|
---|
427 | which-key-idle-delay 0.25)
|
---|
428 |
|
---|
429 | (add-hook 'prog-mode-hook 'rmsbolt-mode)
|
---|
430 |
|
---|
431 | ;; (when (package-loaded? "quickrun")
|
---|
432 | ;; (define-key global-map (kbd "C-c C-c") 'quickrun))
|
---|
433 |
|
---|
434 | (load "sly-autoloads")
|
---|
435 |
|
---|
436 | (setq sly-lisp-implementations
|
---|
437 | '((clisp ("clisp"))
|
---|
438 | (cmucl ("cmucl" "-quiet"))
|
---|
439 | (sbcl ("/opt/sbcl/bin/sbcl") :coding-system utf-8-unix)))
|
---|
440 |
|
---|
441 | (load "erlang-autoloads")
|
---|
442 |
|
---|
443 | (when (package-loaded? "inf-ruby")
|
---|
444 | (add-hook 'ruby-mode-hook 'inf-ruby-minor-mode))
|
---|
445 |
|
---|
446 | (when (package-loaded? "inf-ruby")
|
---|
447 | (add-hook 'ruby-mode-hook 'robe-mode))
|
---|
448 |
|
---|
449 | (when (package-loaded? "anaconda-mode")
|
---|
450 | (progn
|
---|
451 | (add-hook 'python-mode-hook 'anaconda-mode)
|
---|
452 | (add-hook 'python-mode-hook 'anaconda-eldoc-mode)))
|
---|
453 |
|
---|
454 | ;; (when (load "flymake" t)
|
---|
455 | ;; (defun flymake-pylint-init ()
|
---|
456 | ;; (let* ((temp-file (flymake-init-create-temp-buffer-copy
|
---|
457 | ;; 'flymake-create-temp-inplace))
|
---|
458 | ;; (local-file (file-relative-name
|
---|
459 | ;; temp-file
|
---|
460 | ;; (file-name-directory buffer-file-name))))
|
---|
461 | ;; (list "epylint" (list local-file))))
|
---|
462 |
|
---|
463 | ;; (add-to-list 'flymake-allowed-file-name-masks
|
---|
464 | ;; '("\\.py\\'" flymake-pylint-init)))
|
---|
465 |
|
---|
466 | ;; (add-hook 'python-mode-hook 'flymake-mode)
|
---|
467 |
|
---|
468 | (add-hook 'sml-mode-hook 'sml-mode)
|
---|
469 |
|
---|
470 | ;; (add-to-list 'load-path "~/.emacs.d/site-lisp/realgud-xdebug/")
|
---|
471 | ;; (require 'realgud-xdebug)
|
---|
472 |
|
---|
473 | ;; (defun init-php-mode ()
|
---|
474 | ;; (eglot-ensure))
|
---|
475 |
|
---|
476 | (with-eval-after-load 'php-mode
|
---|
477 |
|
---|
478 | ;; (add-hook 'php-mode-hook #'init-php-mode)
|
---|
479 | )
|
---|
480 |
|
---|
481 | (when (package-loaded? "php-mode")
|
---|
482 | (progn
|
---|
483 | (add-hook 'php-mode-hook 'php-enable-symfony2-coding-style)
|
---|
484 | (setq lsp-intelephense-php-version "8.1.16")
|
---|
485 | (defvar phpactor-executable "~/.bin/phpactor")
|
---|
486 | (custom-set-variables '(lsp-phpactor-path "~/usr/local/bin/phpactor"))
|
---|
487 |
|
---|
488 | (add-hook 'php-mode-hook
|
---|
489 | '(lambda ()
|
---|
490 | ;; (require 'yasnippet)
|
---|
491 | ;; (require 'yasnippet-snippets)
|
---|
492 |
|
---|
493 | (set-fill-column 120)
|
---|
494 |
|
---|
495 | ;; (make-local-variable 'eldoc-documentation-function)
|
---|
496 | ;; (setq eldoc-documentation-function
|
---|
497 | ;; 'phpactor-hover)
|
---|
498 | ;; (yas-minor-mode t)
|
---|
499 | (define-key php-mode-map (kbd "C-c h") 'php-quickhelp-at-point)))
|
---|
500 |
|
---|
501 | (setq php-manual-path
|
---|
502 | "~/php/php-manual/"
|
---|
503 | php-quickhelp-dir "~/php/php-manual/"
|
---|
504 | php-quickhelp--dest "~/.emacs.d/php-manual/php_manual_en.json")
|
---|
505 |
|
---|
506 |
|
---|
507 | ;; (add-hook 'php-mode-hook
|
---|
508 | ;; '(lambda ()
|
---|
509 | ;; ;; (auto-complete-mode t)
|
---|
510 |
|
---|
511 | ;; ;; (require 'ac-php)
|
---|
512 | ;; (require 'php-quickhelp)
|
---|
513 | ;; (require 'company)
|
---|
514 | ;; (company-mode t)
|
---|
515 | ;; (require 'company-php)
|
---|
516 | ;; (require 'company-quickhelp)
|
---|
517 |
|
---|
518 | ;; (require 'yasnippet)
|
---|
519 | ;; (require 'yasnippet-snippets)
|
---|
520 |
|
---|
521 | ;; (set (make-local-variable 'company-backends)
|
---|
522 | ;; '((company-ac-php-backend company-dabbrev-code)
|
---|
523 | ;; php-quickhelp-company-php
|
---|
524 | ;; company-capf company-files))
|
---|
525 |
|
---|
526 | ;; (company-quickhelp-mode t)
|
---|
527 |
|
---|
528 | ;; (define-key php-mode-map (kbd "C-M-i") 'company-complete)
|
---|
529 | ;; (define-key company-mode-map (kbd "M-TAB") 'company-complete)
|
---|
530 |
|
---|
531 | ;; ;; (setq ac-sources '(ac-source-php php-quickhelp-company-php))
|
---|
532 | ;; ;; (setq eldoc-documentation-function
|
---|
533 | ;; ;; 'php-quickhelp-eldoc-func)
|
---|
534 |
|
---|
535 | ;; (yas-minor-mode t)
|
---|
536 |
|
---|
537 | ;; ;; (define-key php-mode-map (kbd "C-M-i") 'auto-complete)
|
---|
538 | ;; ;; (define-key ac-mode-map (kbd "M-TAB") 'auto-complete)
|
---|
539 |
|
---|
540 | ;; (define-key php-mode-map (kbd "C-c H")
|
---|
541 | ;; 'php-local-manual-search)
|
---|
542 |
|
---|
543 | ;; (define-key php-mode-map (kbd "C-c h") 'php-quickhelp-at-point)
|
---|
544 | ;; (define-key company-mode-map (kbd "C-c h") 'php-quickhelp-at-point)
|
---|
545 |
|
---|
546 | ;; ;; (define-key php-mode-map (kbd "C-c t") 'ac-php-show-tip)
|
---|
547 |
|
---|
548 | ;; ;; Jump to definition (optional)
|
---|
549 | ;; (define-key php-mode-map
|
---|
550 | ;; (kbd "M-.") 'ac-php-find-symbol-at-point)
|
---|
551 |
|
---|
552 | ;; ;; Return back (optional)
|
---|
553 | ;; (define-key php-mode-map
|
---|
554 | ;; (kbd "M-,") 'ac-php-location-stack-back)))
|
---|
555 | ))
|
---|
556 |
|
---|
557 | (setq phpactor-executable "~/.bin/phpactor")
|
---|
558 | (custom-set-variables '(lsp-phpactor-path "~/.bin/phpactor"))
|
---|
559 |
|
---|
560 | (use-package phpactor :ensure t)
|
---|
561 | (use-package company-phpactor :ensure t)
|
---|
562 |
|
---|
563 |
|
---|
564 |
|
---|
565 | ;; (with-eval-after-load 'php-mode
|
---|
566 | ;; (define-key php-mode-map (kbd "M-.") #'phpactor-goto-definition)
|
---|
567 | ;; (define-key php-mode-map (kbd "M-?") #'phpactor-find-references))
|
---|
568 |
|
---|
569 | (require 'transient)
|
---|
570 | (define-transient-command php-menu ()
|
---|
571 | "Php"
|
---|
572 | [["Class"
|
---|
573 | ("cc" "Copy" phpactor-copy-class)
|
---|
574 | ("cn" "New" phpactor-create-new-class)
|
---|
575 | ("cr" "Move" phpactor-move-class)
|
---|
576 | ("ci" "Inflect" phpactor-inflect-class)
|
---|
577 | ("n" "Namespace" phpactor-fix-namespace)]
|
---|
578 | ["Properties"
|
---|
579 | ("a" "Accessor" phpactor-generate-accessors)
|
---|
580 | ("pc" "Constructor" phpactor-complete-constructor)
|
---|
581 | ("pm" "Add missing props" phpactor-complete-properties)
|
---|
582 | ("r" "Rename var locally" phpactor-rename-variable-local)
|
---|
583 | ("R" "Rename var in file" phpactor-rename-variable-file)]
|
---|
584 | ["Extract"
|
---|
585 | ("ec" "constant" phpactor-extract-constant)
|
---|
586 | ("ee" "expression" phpactor-extract-expression)
|
---|
587 | ("em" "method" phpactor-extract-method)]
|
---|
588 | ["Methods"
|
---|
589 | ("i" "Implement Contracts" phpactor-implement-contracts)
|
---|
590 | ("m" "Generate method" phpactor-generate-method)]
|
---|
591 | ["Navigate"
|
---|
592 | ("x" "List refs" phpactor-list-references)
|
---|
593 | ("X" "Replace refs" phpactor-replace-references)
|
---|
594 | ("." "Goto def" phpactor-goto-definition)]
|
---|
595 | ["Phpactor"
|
---|
596 | ("s" "Status" phpactor-status)
|
---|
597 | ("u" "Install" phpactor-install-or-update)]])
|
---|
598 |
|
---|
599 | ;; Empty for now (was using emacsql)
|
---|
600 | (setq lsp-sqls-server "~/go/bin/sqls")
|
---|
601 |
|
---|
602 | ;; (setq lsp-sqls-workspace-config-path nil)
|
---|
603 |
|
---|
604 | (setq lsp-sqls-connections
|
---|
605 | '(((driver . "mysql") (dataSourceName . "dbuser:mangoworms@tcp(localhost:3306)/profile24"))))
|
---|
606 |
|
---|
607 | (when (package-loaded? "org-sql")
|
---|
608 | (setq org-sql-files "~/projects/profile24/org"))
|
---|
609 |
|
---|
610 | (add-hook 'sql-interactive-mode-hook
|
---|
611 | (lambda ()
|
---|
612 | (sql-connect "profile24")
|
---|
613 | (toggle-truncate-lines t)))
|
---|
614 |
|
---|
615 | (setq sql-connection-alist
|
---|
616 | '((profile24
|
---|
617 | (sql-product 'mysql)
|
---|
618 | (sql-server "localhost")
|
---|
619 | (sql-user "dbuser")
|
---|
620 | (sql-password "123456")
|
---|
621 | (sql-database "testdb")
|
---|
622 | (sql-port 3306))))
|
---|
623 |
|
---|
624 | (load "org-ref-autoloads")
|
---|
625 |
|
---|
626 | (setq reftex-default-bibliography '("~/Documents/bibliography/references.bib"))
|
---|
627 |
|
---|
628 | ;; see org-ref for use of these variables
|
---|
629 | (setq org-ref-bibliography-notes "~/Documents/bibliography/notes.org"
|
---|
630 | org-ref-default-bibliography '("~/Documents/Bibliography/references.bib")
|
---|
631 | org-ref-pdf-directory "~/Documents/bibliography/bibtex-pdfs/")
|
---|
632 |
|
---|
633 | (when (package-loaded? "mastodon")
|
---|
634 | (setq mastodon-active-user "w96k"
|
---|
635 | mastodon-instance-url "https://fosstodon.org/"))
|
---|
636 |
|
---|
637 | (global-hl-line-mode 1)
|
---|
638 |
|
---|
639 | (add-to-list 'special-display-buffer-names "*Buffer List*")
|
---|
640 | (setq Buffer-menu-files-only t)
|
---|
641 |
|
---|
642 | (setq exec-path-from-shell-variables
|
---|
643 | '("PATH" "MANPATH"))
|
---|
644 |
|
---|
645 | (when (and (memq window-system '(mac ns x))
|
---|
646 | (not (eq system-type 'berkeley-unix)))
|
---|
647 | (exec-path-from-shell-initialize))
|
---|
648 |
|
---|
649 | (define-key global-map (kbd "C-q C-q") 'previous-buffer)
|
---|
650 | (define-key global-map (kbd "C-S-q C-S-q") 'next-buffer)
|
---|
651 |
|
---|
652 | (define-key global-map (kbd "C-h") 'delete-backward-char)
|
---|
653 | (define-key global-map (kbd "C-c h") 'help-command)
|
---|
654 |
|
---|
655 | (setq browse-url-browser-function #'eww-browse-url)
|
---|
656 |
|
---|
657 | (add-hook 'eww-mode-hook
|
---|
658 | (lambda ()
|
---|
659 | (set-fill-column 80)
|
---|
660 | (display-fill-column-indicator-mode)
|
---|
661 | (visual-fill-column-mode)))
|
---|
662 |
|
---|
663 | (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
|
---|
664 |
|
---|
665 | (load "debian-el-autoloads")
|
---|
666 | (load "dpkg-dev-el-autoloads")
|
---|
667 |
|
---|
668 | (package-loaded? "nix")
|
---|
669 |
|
---|
670 | (when (package-loaded? "direnv")
|
---|
671 | (direnv-mode))
|
---|
672 |
|
---|
673 | (defun zoom-in ()
|
---|
674 | (interactive)
|
---|
675 | (let ((x (+ (face-attribute 'default :height)
|
---|
676 | 10)))
|
---|
677 | (set-face-attribute 'default nil :height x)
|
---|
678 | (set-face-attribute 'mode-line nil :height x)
|
---|
679 | (set-face-attribute 'mode-line-inactive nil :height x)
|
---|
680 | (set-face-attribute 'mode-line-position-face nil :height x)))
|
---|
681 |
|
---|
682 | (defun zoom-out ()
|
---|
683 | (interactive)
|
---|
684 | (let ((x (- (face-attribute 'default :height)
|
---|
685 | 10)))
|
---|
686 | (set-face-attribute 'default nil :height x)
|
---|
687 | (set-face-attribute 'mode-line nil :height x)
|
---|
688 | (set-face-attribute 'mode-line-inactive nil :height x)
|
---|
689 | (set-face-attribute 'mode-line-position-face nil :height x)))
|
---|
690 |
|
---|
691 | (define-key global-map (kbd "C-=") 'zoom-in)
|
---|
692 | (define-key global-map (kbd "C-+") 'zoom-out)
|
---|
693 |
|
---|
694 | (add-to-list 'default-frame-alist '(fullscreen . maximized))
|
---|
695 |
|
---|
696 | (toggle-frame-fullscreen)
|
---|
697 |
|
---|
698 | (defun fullscreen ()
|
---|
699 | "Fullscreen."
|
---|
700 | (interactive)
|
---|
701 | (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
---|
702 | ;; if first parameter is '1', can't toggle fullscreen status
|
---|
703 | '(1 "_NET_WM_STATE_FULLSCREEN" 0)))
|
---|
704 |
|
---|
705 | ;; Better support for files with long lines
|
---|
706 | (setq-default bidi-paragraph-direction 'left-to-right)
|
---|
707 | (setq-default bidi-inhibit-bpa t)
|
---|
708 | (global-so-long-mode 1)
|
---|