Compare commits
10 Commits
fa9286e318
...
e6d452cac2
| Author | SHA1 | Date | |
|---|---|---|---|
| e6d452cac2 | |||
| 44f4ee000f | |||
| 1d0c8b75a3 | |||
| 1b8095559b | |||
| b33cf55170 | |||
| 0cf9d0d134 | |||
| c944c410c4 | |||
| 4cbf8c3088 | |||
| 21a1f64a1e | |||
| 7cf57b9ab8 |
451
.emacs
451
.emacs
@@ -10,12 +10,6 @@
|
|||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
'(c-basic-offset 4)
|
'(c-basic-offset 4)
|
||||||
'(c-default-style
|
|
||||||
'((c++-mode . "tuleu-c++")
|
|
||||||
(java-mode . "java")
|
|
||||||
(awk-mode . "awk")
|
|
||||||
(other . "gnu")))
|
|
||||||
'(company-idle-delay 20.0)
|
|
||||||
'(compilation-scroll-output 'first-error)
|
'(compilation-scroll-output 'first-error)
|
||||||
'(custom-safe-themes
|
'(custom-safe-themes
|
||||||
'("162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213" "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "6622bb651e72d8ebd66454bd86db6c3990324243ff4325c1b6df252aba63b13e" "2f8eadc12bf60b581674a41ddc319a40ed373dd4a7c577933acaff15d2bf7cc6" "f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc" "016f665c0dd5f76f8404124482a0b13a573d17e92ff4eb36a66b409f4d1da410" "13096a9a6e75c7330c1bc500f30a8f4407bd618431c94aeab55c9855731a95e1" "8b148cf8154d34917dfc794b5d0fe65f21e9155977a36a5985f89c09a9669aa0" "bf948e3f55a8cd1f420373410911d0a50be5a04a8886cabe8d8e471ad8fdba8e" "680f62b751481cc5b5b44aeab824e5683cf13792c006aeba1c25ce2d89826426" "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b" default))
|
'("162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213" "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "6622bb651e72d8ebd66454bd86db6c3990324243ff4325c1b6df252aba63b13e" "2f8eadc12bf60b581674a41ddc319a40ed373dd4a7c577933acaff15d2bf7cc6" "f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc" "016f665c0dd5f76f8404124482a0b13a573d17e92ff4eb36a66b409f4d1da410" "13096a9a6e75c7330c1bc500f30a8f4407bd618431c94aeab55c9855731a95e1" "8b148cf8154d34917dfc794b5d0fe65f21e9155977a36a5985f89c09a9669aa0" "bf948e3f55a8cd1f420373410911d0a50be5a04a8886cabe8d8e471ad8fdba8e" "680f62b751481cc5b5b44aeab824e5683cf13792c006aeba1c25ce2d89826426" "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b" default))
|
||||||
@@ -44,7 +38,7 @@
|
|||||||
'(org-agenda-files '("~/org/1.TODO.org"))
|
'(org-agenda-files '("~/org/1.TODO.org"))
|
||||||
'(package-enable-at-startup nil)
|
'(package-enable-at-startup nil)
|
||||||
'(package-selected-packages
|
'(package-selected-packages
|
||||||
'(clang-format+ cmake-format xterm-color dockerfile-mode web-mode prettier json-mode py-isort blacken pyvenv yaml-mode lsp-pyright ng2-mode lsp-ltex lsp-treemacs treemacs-nerd-icons treemacs-projectile treemacs lsp-ui lsp-mode which-key flycheck vterm projectile yasnippet-snippets yasnippet aggressive-indent doom-themes company-go zenburn-theme langtool smart-tabs-mode typescript-mode protobuf-mode opencl-mode glsl-mode go-mode markdown-mode srefactor irony cmake-mode company magit use-package))
|
'(code-cells clang-format+ cmake-format xterm-color dockerfile-mode web-mode prettier json-mode py-isort blacken pyvenv yaml-mode lsp-pyright ng2-mode lsp-ltex lsp-treemacs treemacs-nerd-icons treemacs-projectile treemacs lsp-ui lsp-mode which-key flycheck vterm projectile yasnippet-snippets yasnippet aggressive-indent doom-themes company-go zenburn-theme langtool smart-tabs-mode typescript-mode protobuf-mode opencl-mode glsl-mode go-mode markdown-mode srefactor irony cmake-mode company magit use-package))
|
||||||
'(safe-local-variable-values
|
'(safe-local-variable-values
|
||||||
'((vc-follow-symlinks . t)
|
'((vc-follow-symlinks . t)
|
||||||
(TeX-master . t)
|
(TeX-master . t)
|
||||||
@@ -75,22 +69,31 @@
|
|||||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||||
("gnu" . "https://elpa.gnu.org/packages/")))
|
("gnu" . "https://elpa.gnu.org/packages/")))
|
||||||
(package-initialize)
|
(package-initialize)
|
||||||
(eval-when-compile
|
|
||||||
(unless (package-installed-p 'use-package)
|
|
||||||
(unless package-archive-contents
|
|
||||||
(package-refresh-contents))
|
|
||||||
(package-install 'use-package)
|
|
||||||
)
|
|
||||||
(require 'use-package)
|
|
||||||
)
|
|
||||||
|
|
||||||
(require 'use-package)
|
(defvar bootstrap-version)
|
||||||
|
(let ((bootstrap-file
|
||||||
|
(expand-file-name
|
||||||
|
"straight/repos/straight.el/bootstrap.el"
|
||||||
|
(or (bound-and-true-p straight-base-dir)
|
||||||
|
user-emacs-directory)))
|
||||||
|
(bootstrap-version 7))
|
||||||
|
(unless (file-exists-p bootstrap-file)
|
||||||
|
(with-current-buffer
|
||||||
|
(url-retrieve-synchronously
|
||||||
|
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
||||||
|
'silent 'inhibit-cookies)
|
||||||
|
(goto-char (point-max))
|
||||||
|
(eval-print-last-sexp)))
|
||||||
|
(load bootstrap-file nil 'nomessage))
|
||||||
|
|
||||||
|
(straight-use-package 'use-package)
|
||||||
(require 'use-package-ensure)
|
(require 'use-package-ensure)
|
||||||
(setq use-package-always-ensure t)
|
(setq use-package-always-ensure t)
|
||||||
|
|
||||||
|
|
||||||
(use-package use-package-ensure-system-package)
|
(use-package use-package-ensure-system-package)
|
||||||
|
|
||||||
|
|
||||||
;; required because vterm wants this before loading.
|
;; required because vterm wants this before loading.
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
:demand t
|
:demand t
|
||||||
@@ -98,9 +101,201 @@
|
|||||||
(cmake . cmake)
|
(cmake . cmake)
|
||||||
("/usr/include/vterm.h" . libvterm-dev)
|
("/usr/include/vterm.h" . libvterm-dev)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:init
|
||||||
|
;; Add prompt indicator to `completing-read-multiple'.
|
||||||
|
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
|
||||||
|
(defun crm-indicator (args)
|
||||||
|
(cons (format "[CRM%s] %s"
|
||||||
|
(replace-regexp-in-string
|
||||||
|
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
|
||||||
|
crm-separator)
|
||||||
|
(car args))
|
||||||
|
(cdr args)))
|
||||||
|
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
||||||
|
|
||||||
|
;; Do not allow the cursor in the minibuffer prompt
|
||||||
|
(setq minibuffer-prompt-properties
|
||||||
|
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||||||
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||||||
|
|
||||||
|
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
|
||||||
|
;; Vertico commands are hidden in normal buffers.
|
||||||
|
(setq read-extended-command-predicate
|
||||||
|
#'command-completion-default-include-p)
|
||||||
|
|
||||||
|
;; Enable recursive minibuffers
|
||||||
|
(setq enable-recursive-minibuffers t)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
;; Enable vertico
|
||||||
|
(use-package vertico
|
||||||
|
:init
|
||||||
|
(vertico-mode)
|
||||||
|
|
||||||
|
;; Different scroll margin
|
||||||
|
;; (setq vertico-scroll-margin 0)
|
||||||
|
|
||||||
|
;; Show more candidates
|
||||||
|
(setq vertico-count 10)
|
||||||
|
|
||||||
|
;; Grow and shrink the Vertico minibuffer
|
||||||
|
(setq vertico-resize t)
|
||||||
|
|
||||||
|
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
|
||||||
|
(setq vertico-cycle t)
|
||||||
|
:config
|
||||||
|
(vertico-reverse-mode)
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||||
|
(use-package savehist
|
||||||
|
:init
|
||||||
|
(savehist-mode))
|
||||||
|
|
||||||
|
|
||||||
|
;; Optionally use the `orderless' completion style.
|
||||||
|
(use-package orderless
|
||||||
|
:init
|
||||||
|
;; Configure a custom style dispatcher (see the Consult wiki)
|
||||||
|
;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)
|
||||||
|
;; orderless-component-separator #'orderless-escapable-split-on-space)
|
||||||
|
(setq completion-styles '(orderless basic)
|
||||||
|
completion-category-defaults nil
|
||||||
|
completion-category-overrides '((file (styles partial-completion))))
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Example configuration for Consult
|
||||||
|
(use-package consult
|
||||||
|
;; Replace bindings. Lazily loaded due by `use-package'.
|
||||||
|
:bind (;; C-c bindings in `mode-specific-map'
|
||||||
|
("C-c M-x" . consult-mode-command)
|
||||||
|
("C-c h" . consult-history)
|
||||||
|
("C-c k" . consult-kmacro)
|
||||||
|
("C-c M" . consult-man)
|
||||||
|
("C-c i" . consult-info)
|
||||||
|
([remap Info-search] . consult-info)
|
||||||
|
;; C-x bindings in `ctl-x-map'
|
||||||
|
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
|
||||||
|
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
||||||
|
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
||||||
|
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
||||||
|
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
|
||||||
|
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
|
||||||
|
;; Custom M-# bindings for fast register access
|
||||||
|
("M-#" . consult-register-load)
|
||||||
|
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
|
||||||
|
("C-M-#" . consult-register)
|
||||||
|
;; Other custom bindings
|
||||||
|
("M-y" . consult-yank-pop) ;; orig. yank-pop
|
||||||
|
;; M-g bindings in `goto-map'
|
||||||
|
("M-g e" . consult-compile-error)
|
||||||
|
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
|
||||||
|
("M-g g" . consult-goto-line) ;; orig. goto-line
|
||||||
|
("M-g M-g" . consult-goto-line) ;; orig. goto-line
|
||||||
|
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
||||||
|
("M-g m" . consult-mark)
|
||||||
|
("M-g k" . consult-global-mark)
|
||||||
|
("M-g i" . consult-imenu)
|
||||||
|
("M-g I" . consult-imenu-multi)
|
||||||
|
;; M-s bindings in `search-map'
|
||||||
|
("M-s d" . consult-find) ;; Alternative: consult-fd
|
||||||
|
("M-s D" . consult-locate)
|
||||||
|
("M-s g" . consult-grep)
|
||||||
|
("M-s G" . consult-git-grep)
|
||||||
|
("M-s r" . consult-ripgrep)
|
||||||
|
("M-s l" . consult-line)
|
||||||
|
("M-s L" . consult-line-multi)
|
||||||
|
("M-s k" . consult-keep-lines)
|
||||||
|
("M-s u" . consult-focus-lines)
|
||||||
|
;; Isearch integration
|
||||||
|
("M-s e" . consult-isearch-history)
|
||||||
|
:map isearch-mode-map
|
||||||
|
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
|
||||||
|
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
|
||||||
|
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
|
||||||
|
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
|
||||||
|
;; Minibuffer history
|
||||||
|
:map minibuffer-local-map
|
||||||
|
("M-s" . consult-history) ;; orig. next-matching-history-element
|
||||||
|
("M-r" . consult-history)) ;; orig. previous-matching-history-element
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
;; Optionally configure the register formatting. This improves the register
|
||||||
|
;; preview for `consult-register', `consult-register-load',
|
||||||
|
;; `consult-register-store' and the Emacs built-ins.
|
||||||
|
(setq register-preview-delay 0.5
|
||||||
|
register-preview-function #'consult-register-format)
|
||||||
|
|
||||||
|
;; Optionally tweak the register preview window.
|
||||||
|
;; This adds thin lines, sorting and hides the mode line of the window.
|
||||||
|
(advice-add #'register-preview :override #'consult-register-window)
|
||||||
|
|
||||||
|
;; Use Consult to select xref locations with preview
|
||||||
|
(setq xref-show-xrefs-function #'consult-xref
|
||||||
|
xref-show-definitions-function #'consult-xref)
|
||||||
|
|
||||||
|
:config
|
||||||
|
|
||||||
|
;; Optionally configure preview. The default value
|
||||||
|
;; is 'any, such that any key triggers the preview.
|
||||||
|
;; (setq consult-preview-key 'any)
|
||||||
|
;; (setq consult-preview-key "M-.")
|
||||||
|
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
|
||||||
|
;; For some commands and buffer sources it is useful to configure the
|
||||||
|
;; :preview-key on a per-command basis using the `consult-customize' macro.
|
||||||
|
(consult-customize
|
||||||
|
consult-theme :preview-key '(:debounce 0.2 any)
|
||||||
|
consult-ripgrep consult-git-grep consult-grep
|
||||||
|
consult-bookmark consult-recent-file consult-xref
|
||||||
|
consult--source-bookmark consult--source-file-register
|
||||||
|
consult--source-recent-file consult--source-project-recent-file
|
||||||
|
;; :preview-key "M-."
|
||||||
|
:preview-key '(:debounce 0.4 any))
|
||||||
|
|
||||||
|
;; Optionally configure the narrowing key.
|
||||||
|
;; Both < and C-+ work reasonably well.
|
||||||
|
(setq consult-narrow-key "<") ;; "C-+"
|
||||||
|
|
||||||
|
(autoload 'projectile-project-root "projectile")
|
||||||
|
(setq consult-project-function (lambda (_) (projectile-project-root)))
|
||||||
|
)
|
||||||
|
|
||||||
|
(use-package marginalia
|
||||||
|
:config
|
||||||
|
(marginalia-mode))
|
||||||
|
|
||||||
|
(use-package embark
|
||||||
|
:bind
|
||||||
|
("C-x m" . embark-act) ;; pick some comfortable binding
|
||||||
|
("M-." . embark-dwim) ;; good alternative: M-.
|
||||||
|
("C-h B" . embark-bindings) ;; alternative for `describe-bindings'
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
;; Optionally replace the key help with a completing-read interface
|
||||||
|
(setq prefix-help-command #'embark-prefix-help-command)
|
||||||
|
|
||||||
|
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
|
||||||
|
;; strategy, if you want to see the documentation from multiple providers.
|
||||||
|
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
|
||||||
|
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
|
||||||
|
|
||||||
|
:config
|
||||||
|
|
||||||
|
;; Hide the mode line of the Embark live/completions buffers
|
||||||
|
(add-to-list 'display-buffer-alist
|
||||||
|
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||||
|
nil
|
||||||
|
(window-parameters (mode-line-format . none)))))
|
||||||
|
|
||||||
|
;; Consult users will also want the embark-consult package.
|
||||||
|
(use-package embark-consult
|
||||||
|
:demand t
|
||||||
|
:hook
|
||||||
|
(embark-collect-mode . consult-preview-at-point-mode))
|
||||||
|
|
||||||
(use-package doom-modeline
|
(use-package doom-modeline
|
||||||
:init
|
:init
|
||||||
@@ -229,8 +424,26 @@
|
|||||||
(use-package company
|
(use-package company
|
||||||
:delight
|
:delight
|
||||||
:bind ( ("M-TAB" . company-complete) )
|
:bind ( ("M-TAB" . company-complete) )
|
||||||
|
:init
|
||||||
|
(defun atu/company-prog-mode ()
|
||||||
|
"Starts yas company and set up backends accordingly"
|
||||||
|
(yas-minor-mode)
|
||||||
|
(company-mode)
|
||||||
|
)
|
||||||
:config
|
:config
|
||||||
(global-company-mode t)
|
(setq
|
||||||
|
company-minimum-prefix-length 1
|
||||||
|
company-idle-delay 0.5)
|
||||||
|
(setq company-backends
|
||||||
|
'(
|
||||||
|
(company-capf :separate company-yasnippet)
|
||||||
|
company-files
|
||||||
|
company-keywords
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
:hook
|
||||||
|
(prog-mode . atu/company-prog-mode)
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package cmake-mode
|
(use-package cmake-mode
|
||||||
@@ -238,28 +451,72 @@
|
|||||||
(cmake . cmake)
|
(cmake . cmake)
|
||||||
(pip . python3-pip)
|
(pip . python3-pip)
|
||||||
(cmake-format . "pip install --user cmakelang[YAML]")
|
(cmake-format . "pip install --user cmakelang[YAML]")
|
||||||
|
(cmake-language-server . "pip install --user cmake-language-server")
|
||||||
)
|
)
|
||||||
:config
|
:config
|
||||||
(setq cmake-tab-width 4)
|
(setq cmake-tab-width 4)
|
||||||
|
|
||||||
|
(defun atu/create-or-erase-buffer (buffer-name)
|
||||||
|
""
|
||||||
|
(let ((existing-buffer (get-buffer buffer-name)))
|
||||||
|
(when existing-buffer
|
||||||
|
(with-current-buffer existing-buffer
|
||||||
|
(erase-buffer)))
|
||||||
|
(get-buffer-create buffer-name))
|
||||||
|
)
|
||||||
|
|
||||||
(defun atu/cmake-format-buffer ()
|
(defun atu/cmake-format-buffer ()
|
||||||
"Formats the current buffer using cmake-format"
|
"Formats the current buffer using cmake-format"
|
||||||
(interactive)
|
(interactive)
|
||||||
(shell-command-on-region
|
(let ((error-buffer (atu/create-or-erase-buffer "*cmake-format:stderr*")))
|
||||||
;; region to execute on
|
(setq-local atu/after-save-message nil)
|
||||||
|
(if (eq 0 (call-process-region
|
||||||
|
;;region
|
||||||
(point-min)
|
(point-min)
|
||||||
(point-max)
|
(point-max)
|
||||||
;; command
|
"cmake-format"
|
||||||
"cmake-format -"
|
nil ;do not delete buffer
|
||||||
;; replace
|
;; discard stdout copy stderr to buffer
|
||||||
t
|
error-buffer
|
||||||
;; name of the error bufer
|
nil ;dont-redisplay buffer
|
||||||
"* cmake-format Error Buffer *"
|
"-"
|
||||||
;;
|
))
|
||||||
t))
|
(let ((current-point (point)))
|
||||||
|
(call-process-region
|
||||||
|
(point-min) (point-max)
|
||||||
|
"cmake-format"
|
||||||
|
t t t; replace current buffer and redisplay it
|
||||||
|
"-"
|
||||||
|
)
|
||||||
|
(goto-char (+ (point-min) current-point))
|
||||||
|
nil
|
||||||
|
)
|
||||||
|
(message
|
||||||
|
"cmake-format: could not format %s see buffer %s for details"
|
||||||
|
(buffer-name) error-buffer)
|
||||||
|
(current-message)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun atu/cmake-before-save-hook ()
|
||||||
|
""
|
||||||
|
(setq-local atu/after-save-message (atu/cmake-format-buffer))
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun atu/cmake-after-save-hook ()
|
||||||
|
""
|
||||||
|
(when atu/after-save-message
|
||||||
|
(message atu/after-save-message)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
:hook
|
:hook
|
||||||
(cmake-mode . lsp-deferred)
|
(cmake-mode . lsp-deferred)
|
||||||
(cmake-mode . (lambda () (add-hook 'before-save-hook 'atu/cmake-format-buffer nil 'local)))
|
(cmake-mode . (lambda ()
|
||||||
|
(add-hook 'before-save-hook 'atu/cmake-before-save-hook nil 'local)
|
||||||
|
(add-hook 'after-save-hook 'atu/cmake-after-save-hook nil 'local))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package cc-mode
|
(use-package cc-mode
|
||||||
@@ -281,15 +538,24 @@
|
|||||||
(use-package yasnippet
|
(use-package yasnippet
|
||||||
:delight yas-minor-mode
|
:delight yas-minor-mode
|
||||||
:config
|
:config
|
||||||
(yas-global-mode)
|
|
||||||
:after (company)
|
|
||||||
:bind ( :map yas-minor-mode-map
|
:bind ( :map yas-minor-mode-map
|
||||||
("TAB" . nil)
|
("TAB" . nil)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(use-package yasnippet-snippets
|
(use-package yasnippet-snippets
|
||||||
:after (yasnippet)
|
:after yasnippet
|
||||||
|
)
|
||||||
|
|
||||||
|
(use-package yasnippet-licenses
|
||||||
|
:straight (yasnippet-licenses
|
||||||
|
:type git
|
||||||
|
:host github
|
||||||
|
:repo "atuleu/yasnippet-licenses"
|
||||||
|
:files (:defaults "*.el" "snippets")
|
||||||
|
)
|
||||||
|
:after yasnippet
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package projectile
|
(use-package projectile
|
||||||
@@ -306,6 +572,73 @@
|
|||||||
:test "ng test --progress=false"
|
:test "ng test --progress=false"
|
||||||
:run "ng serve"
|
:run "ng serve"
|
||||||
:test-suffix ".spec")
|
:test-suffix ".spec")
|
||||||
|
(defun atu/cmake-cc-inference (dir)
|
||||||
|
"Detects if the current root is a CMake C/C++ project"
|
||||||
|
(let ((cmakelists-file (projectile-expand-root "CMakeLists.txt" dir)))
|
||||||
|
(if (file-exists-p cmakelists-file)
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents cmakelists-file)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(re-search-forward "project[[:space:]]*([^)]+\\([[:space:]]C\\(XX\\)?[[:space:]]\\)[^)]+)" nil t)
|
||||||
|
)))
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun atu/cc-related-files (path)
|
||||||
|
"Returns related files path for a C/C++ file for a given path"
|
||||||
|
(let* (
|
||||||
|
(ext (file-name-extension path))
|
||||||
|
(basename (file-name-base path))
|
||||||
|
(dirpath (file-name-directory path))
|
||||||
|
(impl-rx "\\([.-]?[Ii]mp[l]?\\)$")
|
||||||
|
)
|
||||||
|
(if (member ext '("h" "hh" "hpp"))
|
||||||
|
(if (string-match impl-rx basename)
|
||||||
|
(list :other (concat dirpath
|
||||||
|
(string-replace
|
||||||
|
(match-string 1 basename)
|
||||||
|
""
|
||||||
|
basename)
|
||||||
|
"."
|
||||||
|
ext))
|
||||||
|
(list :other
|
||||||
|
(mapcar (lambda (sfx) (concat dirpath basename sfx))
|
||||||
|
(list
|
||||||
|
(concat "Imp." ext)
|
||||||
|
(concat "Impl." ext)
|
||||||
|
(concat "imp." ext)
|
||||||
|
(concat "impl." ext)
|
||||||
|
(concat ".Imp." ext)
|
||||||
|
(concat ".Impl." ext)
|
||||||
|
(concat ".imp." ext)
|
||||||
|
(concat ".impl." ext)
|
||||||
|
(concat "-Imp." ext)
|
||||||
|
(concat "-Impl." ext)
|
||||||
|
(concat "-imp." ext)
|
||||||
|
(concat "-impl." ext)
|
||||||
|
".cpp"
|
||||||
|
)))
|
||||||
|
)
|
||||||
|
(when (member ext '("c" "cc" "cpp"))
|
||||||
|
(list :other
|
||||||
|
(mapcar (lambda (sfx) (concat dirpath basename sfx))
|
||||||
|
'( ".h" ".hh" ".hpp" )))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(projectile-register-project-type 'cmake-cc #'atu/cmake-cc-inference
|
||||||
|
:project-file "CMakeLists.txt"
|
||||||
|
:configure "cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=On"
|
||||||
|
:compile "cmake --build build"
|
||||||
|
:test "cmake --build build --target check"
|
||||||
|
:related-files-fn
|
||||||
|
(list
|
||||||
|
#'atu/cc-related-files
|
||||||
|
(projectile-related-files-fn-test-with-suffix "cpp" "Test")
|
||||||
|
(projectile-related-files-fn-test-with-suffix "cpp" "UTest")
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package vterm)
|
(use-package vterm)
|
||||||
@@ -348,7 +681,6 @@
|
|||||||
(setq lsp-keymap-prefix "C-c l")
|
(setq lsp-keymap-prefix "C-c l")
|
||||||
:bind-keymap ("C-c l" . lsp-command-map)
|
:bind-keymap ("C-c l" . lsp-command-map)
|
||||||
:config
|
:config
|
||||||
(yas-minor-mode)
|
|
||||||
(if (display-graphic-p)
|
(if (display-graphic-p)
|
||||||
(setq lsp-ui-doc-use-webkit t)
|
(setq lsp-ui-doc-use-webkit t)
|
||||||
)
|
)
|
||||||
@@ -360,6 +692,7 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(setq lsp-completion-provider :none)
|
||||||
:bind (
|
:bind (
|
||||||
("C-c C-d" . lsp-ui-doc-toggle)
|
("C-c C-d" . lsp-ui-doc-toggle)
|
||||||
)
|
)
|
||||||
@@ -538,8 +871,52 @@
|
|||||||
(add-hook 'before-save-hook 'py-isort-before-save)))
|
(add-hook 'before-save-hook 'py-isort-before-save)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(use-package code-cells
|
||||||
|
:mode ("\\.sync.py'" . code-cells-mode)
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c-c++-header))
|
:config
|
||||||
|
(defun atu/jupyter-ascending-sync ()
|
||||||
|
"Runs synchronization with jupyter-ascending "
|
||||||
|
(interactive)
|
||||||
|
(when (string-match-p ".sync.py\\'" (buffer-name))
|
||||||
|
(unless (and (boundp 'atu/jupyter-sync-inhibit) atu/jupyter-sync-inhibit)
|
||||||
|
(call-process "python"
|
||||||
|
nil nil nil
|
||||||
|
"-m" "jupyter_ascending.requests.sync" "--filename" (buffer-file-name)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun atu/jupyter-ascending-eval (start end)
|
||||||
|
"Runs cell via jupyter-ascending or python-shell-send-region"
|
||||||
|
(interactive)
|
||||||
|
(if (not (string-match-p ".sync.py\\'" (buffer-name)))
|
||||||
|
(python-shell-send-region start end)
|
||||||
|
(setq-local atu/jupyter-sync-inhibit t)
|
||||||
|
(save-buffer)
|
||||||
|
(setq-local atu/jupyter-sync-inhibit nil)
|
||||||
|
(call-process "python"
|
||||||
|
nil nil nil
|
||||||
|
"-m" "jupyter_ascending.requests.execute"
|
||||||
|
"--filename" (buffer-file-name)
|
||||||
|
"--linenumber" (number-to-string (line-number-at-pos))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(setq code-cells-eval-region-commands
|
||||||
|
(mapcar (lambda (pair)
|
||||||
|
(if (eq (car pair) 'python-mode)
|
||||||
|
(cons 'python-mode 'atu/jupyter-ascending-eval)
|
||||||
|
pair))
|
||||||
|
code-cells-eval-region-commands))
|
||||||
|
|
||||||
|
:hook
|
||||||
|
(python-mode . code-cells-mode-maybe)
|
||||||
|
(code-cells-mode . (lambda ()
|
||||||
|
(add-hook 'after-save-hook 'atu/jupyter-ascending-sync nil 'local)))
|
||||||
|
)
|
||||||
|
|
||||||
(use-package markdown-mode)
|
(use-package markdown-mode)
|
||||||
|
|
||||||
@@ -547,17 +924,19 @@
|
|||||||
:after (projectile)
|
:after (projectile)
|
||||||
:config
|
:config
|
||||||
(unbind-key "C-c C-d" go-mode-map)
|
(unbind-key "C-c C-d" go-mode-map)
|
||||||
(defun go-compile-command ()
|
(defun atu/go-compile-command ()
|
||||||
"returns a string to compile a go project"
|
"returns a string to compile a go project"
|
||||||
(setq project-makefile (concat (file-name-as-directory (projectile-project-root)) "Makefile"))
|
(interactive)
|
||||||
|
(let ((project-makefile (concat (file-name-as-directory (projectile-project-root)) "Makefile")))
|
||||||
(if (file-exists-p project-makefile)
|
(if (file-exists-p project-makefile)
|
||||||
"make"
|
"make"
|
||||||
"go build && go test && go vet"
|
"go build && go test && go vet"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(projectile-update-project-type
|
(projectile-update-project-type
|
||||||
'go
|
'go
|
||||||
:compile 'go-compile-command)
|
:compile 'atu/go-compile-command)
|
||||||
:hook
|
:hook
|
||||||
(go-mode . lsp-deferred)
|
(go-mode . lsp-deferred)
|
||||||
(go-mode . (lambda ()
|
(go-mode . (lambda ()
|
||||||
|
|||||||
Reference in New Issue
Block a user