Change back to eglot and flymake

This commit is contained in:
Alexander Rosenberg 2023-11-27 15:53:58 -08:00
parent 95719dabf0
commit f3b3d60363
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

249
init.el
View File

@ -347,8 +347,8 @@ visual states."
(defun my/consult-setup-minibuffer-completion () (defun my/consult-setup-minibuffer-completion ()
(setq-local completion-in-region-function #'consult-completion-in-region)) (setq-local completion-in-region-function #'consult-completion-in-region))
(evil-declare-motion #'consult-line)) (evil-declare-motion #'consult-line))
;; (use-package consult-eglot (use-package consult-eglot
;; :commands consult-eglot-symbols) :commands consult-eglot-symbols)
;; integration for embark and consult ;; integration for embark and consult
(use-package embark-consult (use-package embark-consult
@ -406,30 +406,30 @@ visual states."
(use-package posframe) (use-package posframe)
;; flymake ;; flymake
;; (use-package flymake (use-package flymake
;; :bind (:map flymake-mode-map :bind (:map flymake-mode-map
;; ("C-c e" . my/flymake-show-diagnostic-at-point) ("C-c e" . my/flymake-show-diagnostic-at-point)
;; ("C-c C-e" . consult-flymake)) ("C-c C-e" . consult-flymake))
;; ;; :hook (emacs-lisp-mode . flymake-mode) :hook (emacs-lisp-mode . flymake-mode)
;; :init :init
;; (defun my/flymake-show-diagnostic-at-point () (defun my/flymake-show-diagnostic-at-point ()
;; (interactive) (interactive)
;; (if-let ((pos (point)) (if-let ((pos (point))
;; (diag (and flymake-mode (diag (and flymake-mode
;; (get-char-property pos 'flymake-diagnostic))) (get-char-property pos 'flymake-diagnostic)))
;; (message (flymake--diag-text diag))) (message (flymake--diag-text diag)))
;; (if (display-graphic-p) (if (display-graphic-p)
;; (progn (progn
;; (posframe-show " *flymake-error-posframe*" (posframe-show " *flymake-error-posframe*"
;; :string message :string message
;; :position (point) :position (point)
;; :max-width 80 :max-width 80
;; :border-width 2 :border-width 2
;; :border-color "white") :border-color "white")
;; (clear-this-command-keys) (clear-this-command-keys)
;; (push (read-event) unread-command-events) (push (read-event) unread-command-events)
;; (posframe-hide " *flymake-error-posframe*")) (posframe-hide " *flymake-error-posframe*"))
;; (popup-tip message))))) (popup-tip message)))))
;; eldoc ;; eldoc
(use-package eldoc (use-package eldoc
@ -443,104 +443,104 @@ visual states."
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) (add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
;; eglot ;; eglot
;; (use-package eglot (use-package eglot
;; :demand t :demand t
;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
;; latex-mode markdown-mode blueprint-ts-mode) . eglot-ensure) latex-mode markdown-mode blueprint-ts-mode) . eglot-ensure)
;; (eglot-managed-mode . my/-eglot-setup)) (eglot-managed-mode . my/-eglot-setup))
;; :init :init
;; (defvar my/-eglot-documentation-buffer nil (defvar my/-eglot-documentation-buffer nil
;; "Buffer for showing documentation for `my/eglot-documentation-at-point'.") "Buffer for showing documentation for `my/eglot-documentation-at-point'.")
;; (defun my/eglot-documentation-at-point () (defun my/eglot-documentation-at-point ()
;; "Show documentation for a symbol at point." "Show documentation for a symbol at point."
;; (interactive) (interactive)
;; (if-let (server (eglot-current-server)) (if-let (server (eglot-current-server))
;; (progn (progn
;; (if-let* (((not (buffer-live-p my/-eglot-documentation-buffer))) (if-let* (((not (buffer-live-p my/-eglot-documentation-buffer)))
;; (name (generate-new-buffer-name "*eglot documentation*"))) (name (generate-new-buffer-name "*eglot documentation*")))
;; (setq my/-eglot-documentation-buffer (generate-new-buffer name))) (setq my/-eglot-documentation-buffer (generate-new-buffer name)))
;; (eglot-hover-eldoc-function (eglot-hover-eldoc-function
;; (lambda (info _ _) (lambda (info _ _)
;; (if-let (((not (seq-empty-p info))) (if-let (((not (seq-empty-p info)))
;; (buff (current-buffer))) (buff (current-buffer)))
;; (with-current-buffer my/-eglot-documentation-buffer (with-current-buffer my/-eglot-documentation-buffer
;; (read-only-mode -1) (read-only-mode -1)
;; (erase-buffer) (erase-buffer)
;; (insert info) (insert info)
;; (special-mode) (special-mode)
;; (read-only-mode 1) (read-only-mode 1)
;; (when (not (get-buffer-window my/-eglot-documentation-buffer nil)) (when (not (get-buffer-window my/-eglot-documentation-buffer nil))
;; (switch-to-buffer-other-window my/-eglot-documentation-buffer t) (switch-to-buffer-other-window my/-eglot-documentation-buffer t)
;; (switch-to-buffer-other-window buff t))))))))) (switch-to-buffer-other-window buff t)))))))))
;; (defun my/-eglot-setup () (defun my/-eglot-setup ()
;; "Setup eldoc variables for `eglot-managed-mode-hook'." "Setup eldoc variables for `eglot-managed-mode-hook'."
;; (setq-local eldoc-echo-area-use-multiline-p nil (setq-local eldoc-echo-area-use-multiline-p nil
;; evil-lookup-func #'my/eglot-documentation-at-point) evil-lookup-func #'my/eglot-documentation-at-point)
;; (evil-define-key '(normal motion) 'local (evil-define-key '(normal motion) 'local
;; "K" #'evil-lookup "K" #'evil-lookup
;; "gR" #'eglot-rename "gR" #'eglot-rename
;; "gA" #'eglot-code-actions "gA" #'eglot-code-actions
;; "gs" #'consult-eglot-symbols) "gs" #'consult-eglot-symbols)
;; (eglot-inlay-hints-mode -1)) (eglot-inlay-hints-mode -1))
;; (setq eglot-autoshutdown t) (setq eglot-autoshutdown t)
;; :config :config
;; (add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
;; (cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode) (cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode)
;; '("clangd" "--all-scopes-completion" "--background-index" '("clangd" "--all-scopes-completion" "--background-index"
;; "--clang-tidy" "--completion-style=detailed" "--clang-tidy" "--completion-style=detailed"
;; "--header-insertion=never" "--pch-storage=memory" "--header-insertion=never" "--pch-storage=memory"
;; "--malloc-trim" "--function-arg-placeholders")))) "--malloc-trim" "--function-arg-placeholders"))))
;; flycheck ;; flycheck
(use-package flycheck ;; (use-package flycheck
:hook (emacs-lisp-mode . flycheck-mode) ;; :hook (emacs-lisp-mode . flycheck-mode)
:bind (:map flycheck-mode-map ;; :bind (:map flycheck-mode-map
("C-c e" . my/flycheck-show-diagnostic-at-point)) ;; ("C-c e" . my/flycheck-show-diagnostic-at-point))
:init ;; :init
(setq flycheck-display-errors-function nil) ;; (setq flycheck-display-errors-function nil)
(defun my/flycheck-show-diagnostic-at-point () ;; (defun my/flycheck-show-diagnostic-at-point ()
(interactive) ;; (interactive)
(if-let ((flycheck-mode) ;; (if-let ((flycheck-mode)
(errors (flycheck-overlay-errors-at (point))) ;; (errors (flycheck-overlay-errors-at (point)))
(message (apply 'concat ;; (message (apply 'concat
(mapcar ;; (mapcar
(lambda (error) ;; (lambda (error)
(concat "" (flycheck-error-message error) "\n")) ;; (concat "•" (flycheck-error-message error) "\n"))
errors)))) ;; errors))))
(if (display-graphic-p) ;; (if (display-graphic-p)
(progn ;; (progn
(posframe-show " *flycheck-error-posframe*" ;; (posframe-show " *flycheck-error-posframe*"
:string message ;; :string message
:position (point) ;; :position (point)
:max-width 80 ;; :max-width 80
:border-width 2 ;; :border-width 2
:border-color "white") ;; :border-color "white")
(clear-this-command-keys) ;; (clear-this-command-keys)
(push (read-event) unread-command-events) ;; (push (read-event) unread-command-events)
(posframe-hide " *flycheck-error-posframe*")) ;; (posframe-hide " *flycheck-error-posframe*"))
(popup-tip message))))) ;; (popup-tip message)))))
(use-package consult-flycheck ;; (use-package consult-flycheck
:bind (:map flycheck-mode-map ;; :bind (:map flycheck-mode-map
("C-c C-e" . consult-flycheck))) ;; ("C-c C-e" . consult-flycheck)))
;; lsp-mode ;; lsp-mode
(use-package consult-lsp) ;; (use-package consult-lsp)
(use-package lsp-mode ;; (use-package lsp-mode
:hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode ;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
latex-mode markdown-mode blueprint-ts-mode) . lsp-mode) ;; latex-mode markdown-mode blueprint-ts-mode) . lsp-mode)
(lsp-mode . my/-setup-lsp-mode-buffer)) ;; (lsp-mode . my/-setup-lsp-mode-buffer))
:init ;; :init
(setq lsp-completion-provider :none ;; (setq lsp-completion-provider :none
lsp-headerline-breadcrumb-enable nil ;; lsp-headerline-breadcrumb-enable nil
lsp-inlay-hint-enable nil ;; lsp-inlay-hint-enable nil
lsp-signature-doc-lines 1) ;; lsp-signature-doc-lines 1)
(defun my/-setup-lsp-mode-buffer () ;; (defun my/-setup-lsp-mode-buffer ()
"Called by `lsp-mode-hook' to setup lsp-mode buffers." ;; "Called by `lsp-mode-hook' to setup lsp-mode buffers."
(evil-define-key '(normal visual motion) 'local ;; (evil-define-key '(normal visual motion) 'local
"gR" #'lsp-rename ;; "gR" #'lsp-rename
"gA" #'lsp-execute-code-action ;; "gA" #'lsp-execute-code-action
"gs" #'consult-lsp-symbols) ;; "gs" #'consult-lsp-symbols)
(setq-local evil-lookup-func #'lsp-describe-thing-at-point))) ;; (setq-local evil-lookup-func #'lsp-describe-thing-at-point)))
;; yasnippet ;; yasnippet
(use-package yasnippet (use-package yasnippet
@ -645,13 +645,12 @@ COMMAND and COMINT are like `compile'."
(use-package markdown-mode) (use-package markdown-mode)
;; cmake ;; cmake
(use-package cmake-mode (require 'cmake-mode)
:ensure nil (with-eval-after-load 'cmake-mode
:hook (cmake-ts-mode . my/setup-cmake-ts-mode)
:init
(defun my/setup-cmake-ts-mode () (defun my/setup-cmake-ts-mode ()
"Setup `cmake-ts-mode' buffers." "Setup `cmake-ts-mode' buffers."
(setq-local indent-line-function #'cmake-indent))) (setq-local indent-line-function #'cmake-indent))
(add-hook 'cmake-ts-mode-hook #'my/setup-cmake-ts-mode))
;; json ;; json
(use-package json-mode) (use-package json-mode)