Tweak some windows stuff, and c++ eglot

This commit is contained in:
John Doty 2021-08-20 07:21:41 -07:00
parent 63be4fb598
commit 6ce2884bec

View file

@ -107,7 +107,6 @@
;; ================================================================= ;; =================================================================
;; Common stuff that's needed once ;; Common stuff that's needed once
;; ================================================================= ;; =================================================================
(require 'cl)
(require 'saveplace) ;; Am I using this? (require 'saveplace) ;; Am I using this?
(require 'ffap) ;; Am I using this? (require 'ffap) ;; Am I using this?
(require 'uniquify) ;; Unique buffers based on file name. (require 'uniquify) ;; Unique buffers based on file name.
@ -125,9 +124,8 @@
;; If you want to have comments displayed in italics, ;; If you want to have comments displayed in italics,
;; uncomment the following line. Note that this must ;; uncomment the following line. Note that this must
;; be done before font settings! (Emacs 20) ;; be done before font settings! (Emacs 20)
(setq w32-enable-italics t) (when (boundp 'w32-enable-italics)
(when (eq window-system 'w32) (setq w32-enable-italics t))
(setq tramp-default-method "plink"))
;; Shut off annoying sound ;; Shut off annoying sound
(if (fboundp 'set-message-beep) (set-message-beep 'silent)) (if (fboundp 'set-message-beep) (set-message-beep 'silent))
@ -213,8 +211,14 @@
`((font . ,my-font-choice) `((font . ,my-font-choice)
(width . 91) (width . 91)
(height . ,jd-frame-height))) (height . ,jd-frame-height)))
))
(use-package modus-themes :ensure))) (use-package modus-themes :ensure
:config
(load-theme (if (display-graphic-p)
'modus-operandi
'modus-vivendi)
t))
;; ================================================================= ;; =================================================================
;; FUN WITH KEY BINDINGS! YAAAAYYY!!! ;; FUN WITH KEY BINDINGS! YAAAAYYY!!!
@ -310,16 +314,23 @@
;; ================================================================= ;; =================================================================
;; Common configuration for LSP-based systems. ;; Common configuration for LSP-based systems.
;; ================================================================= ;; =================================================================
(defvar my-clangd-executable (executable-find "clangd") (defvar my-clangd-executable
(or (executable-find "clangd") "clangd")
"Path to the clangd binary.") "Path to the clangd binary.")
(defvar my-cppls-fbcode-executable
(or (executable-find "cppls-wrapper") "cppls-wrapper")
"The path to the fbcode C++ language service wrapper.")
(defun my-disable-flycheck-on-eglot () (defun my-disable-flycheck-on-eglot ()
"Disable flycheck in eglot-managed buffers." "Disable flycheck in eglot-managed buffers."
(message "%s %s" "Called..." (eglot-managed-p))
(flycheck-mode (if (eglot-managed-p) -1 nil))) (flycheck-mode (if (eglot-managed-p) -1 nil)))
(defvar my-cppls-fbcode-executable (executable-find "cppls-wrapper") (defun my-eglot-connect-hook (server)
"The path to the fbcode C++ language service wrapper.") "Don't send configuration information in C or C++."
(unless (or (eq major-mode 'c++-mode)
(eq major-mode 'c-mode))
(eglot-signal-didChangeConfiguration server)))
;; (use-package lsp-mode :ensure ;; (use-package lsp-mode :ensure
;; :init (setq lsp-pyls-server-command "pyls-language-server") ;; :init (setq lsp-pyls-server-command "pyls-language-server")
@ -335,11 +346,16 @@
:hook :hook
(python-mode . eglot-ensure) (python-mode . eglot-ensure)
(rust-mode . eglot-ensure) (rust-mode . eglot-ensure)
(c++-mode . eglot-ensure)
(c-mode . eglot-ensure)
:config :config
(let ((cpp-executable (or my-cppls-fbcode-executable my-clangd-executable)))
(when cpp-executable
(add-to-list 'eglot-server-programs `((c++-mode c-mode) . (,cpp-executable)))))
(add-to-list 'eglot-server-programs '(python-mode . ("pyls-language-server"))) (add-to-list 'eglot-server-programs '(python-mode . ("pyls-language-server")))
(add-to-list 'eglot-server-programs `(c++-mode . (,my-cppls-fbcode-executable ,my-clangd-executable))) (add-hook 'eglot-managed-mode-hook 'my-disable-flycheck-on-eglot)
(add-to-list 'eglot-server-programs `(c-mode . (,my-cppls-fbcode-executable ,my-clangd-executable))) (remove-hook 'eglot-connect-hook 'eglot-signal-didChangeConfiguration)
(add-hook 'eglot-managed-mode-hook 'my-disable-flycheck-on-eglot)) (add-hook 'eglot-connect-hook 'my-eglot-connect-hook))
;; NOTE: elgot defers to flymake for error information. ;; NOTE: elgot defers to flymake for error information.
(use-package flymake (use-package flymake
@ -967,6 +983,9 @@
;; Let tramp search $PATH as given to the $USER on the remote machine ;; Let tramp search $PATH as given to the $USER on the remote machine
;; (necessary to find 'hphpd' for instance) ;; (necessary to find 'hphpd' for instance)
(add-to-list 'tramp-remote-path 'tramp-own-remote-path) (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
;; Use putty on windows
(when (eq window-system 'w32)
(setq tramp-default-method "plink"))
;; ================================================================ ;; ================================================================
;; Zig ;; Zig