From c9653ba8aea543c7aac4d875c82329860af20231 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 27 May 2021 12:51:56 -0400 Subject: [PATCH] Fix #5104: void-function +format-lsp-enable-on-save-maybe-h --- modules/editor/format/config.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/editor/format/config.el b/modules/editor/format/config.el index 15ee5430716..1e09538ee9f 100644 --- a/modules/editor/format/config.el +++ b/modules/editor/format/config.el @@ -36,19 +36,18 @@ select buffers.") (defun +format-enable-for-lsp-on-save-maybe-h () "Enable LSP formatter when LSP client is available." + (remove-hook 'lsp-mode-hook #'+format-enable-for-lsp-on-save-maybe-h 'local) (cond ((not +format-with-lsp) nil) ((bound-and-true-p lsp-mode) - (remove-hook 'lsp-mode-hook #'+format-lsp-enable-on-save-maybe-h 'local) (when (lsp-feature? "textDocument/formatting") (+format-enable-on-save-h)) t) ((bound-and-true-p eglot--managed-mode) - (remove-hook 'eglot-managed-mode-hook #'+format-lsp-enable-on-save-maybe-h 'local) (when (eglot--server-capable :documentRangeFormattingProvider) (+format-enable-on-save-h)) t) ((bound-and-true-p lsp--buffer-deferred) - (add-hook 'lsp-mode-hook #'+format-lsp-enable-on-save-maybe-h + (add-hook 'lsp-mode-hook #'+format-enable-for-lsp-on-save-maybe-h nil 'local) t)))