[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 5ea4049 68/69: Fix #324: let user keep control of
From: |
João Távora |
Subject: |
[elpa] externals/eglot 5ea4049 68/69: Fix #324: let user keep control of some variables during Eglot sessions |
Date: |
Sun, 20 Oct 2019 08:21:55 -0400 (EDT) |
branch: externals/eglot
commit 5ea40496ce1f07476f9da9406cb50618275b9ee7
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Fix #324: let user keep control of some variables during Eglot sessions
* NEWS.md: Mention new variable eglot-stay-out-of
* eglot.el (eglot-stay-out-of): New variable.
(eglot--setq-saving): Use it.
(eglot--managed-mode): Use eglot--setq-saving for imenu. No need
to remove 'eglot-flymake-backend from diagnostic functions.
---
NEWS.md | 9 +++++++++
eglot.el | 30 +++++++++++++++++++++++++++---
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 33808ea..86f3a76 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,13 @@
# 1.5 (upcoming)
+##### New variable `eglot-stay-out-of` ([#324][github#324])
+
+For the duration of an Eglot session, certain variables pertaining to
+Flymake, Xref, Company, etc. are set in such a way that they override
+user's customization. However, for users interested in keeping full
+control of these variables, Eglot will refrain setting any variables
+matched in 'eglot-stay-out-of'.
+
##### Prevent Eldoc flicker when moving around ([#198][github#198])
##### Show large docs in help buffer instead of echo area by default
([#198][github#198])
@@ -150,4 +158,5 @@ TCP connection finds a listening server.
[github#158]: https://github.com/joaotavora/eglot/issues/158
[github#160]: https://github.com/joaotavora/eglot/issues/160
[github#167]: https://github.com/joaotavora/eglot/issues/167
+[github#324]: https://github.com/joaotavora/eglot/issues/324
diff --git a/eglot.el b/eglot.el
index 09c1461..7a22b5c 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1172,8 +1172,33 @@ and just return it. PROMPT shouldn't end with a
question mark."
(defvar-local eglot--saved-bindings nil
"Bindings saved by `eglot--setq-saving'.")
+(defvar eglot-stay-out-of '()
+ "List of Emacs things that Eglot should try to stay of.
+Before Eglot starts \"managing\" a particular buffer, it
+opinionatedly sets some peripheral Emacs facilites, such as
+Flymake, Xref and Company. These overriding settings help ensure
+consistent Eglot behaviour and only stay in place until
+\"managing\" stops (usually via `eglot-shutdown'), whereupon the
+previous settings are restored.
+
+However, if you wish for Eglot to stay out of a particular Emacs
+facility that you'd like to keep control of, add a string, a
+symbol, or a regexp here that will be matched against the
+variable's name, and Eglot will refrain from setting it.
+
+For example, to keep your Company customization use
+
+(add-to-list 'eglot-stay-out-of 'company)")
+
(defmacro eglot--setq-saving (symbol binding)
- `(when (boundp ',symbol)
+ `(when (and (boundp ',symbol)
+ (not (cl-find (symbol-name ',symbol)
+ eglot-stay-out-of
+ :test
+ (lambda (s thing)
+ (let ((re (if (symbolp thing) (symbol-name thing)
+ thing)))
+ (string-match re s))))))
(push (cons ',symbol (symbol-value ',symbol))
eglot--saved-bindings)
(setq-local ,symbol ,binding)))
@@ -1200,11 +1225,10 @@ and just return it. PROMPT shouldn't end with a
question mark."
(eglot--setq-saving xref-prompt-for-identifier nil)
(eglot--setq-saving flymake-diagnostic-functions '(eglot-flymake-backend
t))
(eglot--setq-saving company-backends '(company-capf))
- (add-function :around (local 'imenu-create-index-function) #'eglot-imenu)
+ (eglot--setq-saving imenu-create-index-function #'eglot-imenu)
(flymake-mode 1)
(eldoc-mode 1))
(t
- (remove-hook 'flymake-diagnostic-functions 'eglot-flymake-backend t)
(remove-hook 'after-change-functions 'eglot--after-change t)
(remove-hook 'before-change-functions 'eglot--before-change t)
(remove-hook 'kill-buffer-hook 'eglot--signal-textDocument/didClose t)
- [elpa] externals/eglot 6e93622 27/69: Fix #273: leniently handle invalid positions sent by some servers, (continued)
- [elpa] externals/eglot 6e93622 27/69: Fix #273: leniently handle invalid positions sent by some servers, João Távora, 2019/10/20
- [elpa] externals/eglot 254fee0 46/69: Use more pyls and less rls in tests, João Távora, 2019/10/20
- [elpa] externals/eglot 0e5e08d 51/69: Support goto-{declaration, implementation, typeDefinition}, João Távora, 2019/10/20
- [elpa] externals/eglot 5a21670 59/69: Fix bug in workspace/didChangeWatchedfiles, João Távora, 2019/10/20
- [elpa] externals/eglot 9359c15 58/69: Close #316: add support for the Ada Language Server, João Távora, 2019/10/20
- [elpa] externals/eglot d6508e0 29/69: Fix #273: fix a typo, João Távora, 2019/10/20
- [elpa] externals/eglot 28ecd5d 34/69: Change the default of eglot-move-to-column-function, João Távora, 2019/10/20
- [elpa] externals/eglot 7a70c97 33/69: Require array package to use current-line (#294), João Távora, 2019/10/20
- [elpa] externals/eglot f7a1bf6 49/69: Fix #236: much less noisy mode line, João Távora, 2019/10/20
- [elpa] externals/eglot 4c5d0d4 53/69: Misc improvements to the xref glue code, João Távora, 2019/10/20
- [elpa] externals/eglot 5ea4049 68/69: Fix #324: let user keep control of some variables during Eglot sessions,
João Távora <=
- [elpa] externals/eglot 33a4f86 69/69: * eglot.el (Version): Bump to 1.5, João Távora, 2019/10/20
- [elpa] externals/eglot cf161b0 41/69: Test with emacs master on Travis, João Távora, 2019/10/20
- [elpa] externals/eglot 9e70cd2 40/69: * eglot-tests.el (python-autopep-formatting): Attempt to fix test., João Távora, 2019/10/20
- [elpa] externals/eglot c3bae0a 44/69: New test for the eglot-autoshutdown defcustom, João Távora, 2019/10/20
- [elpa] externals/eglot 28d8ffe 48/69: Fix #285: unbreak Elm language server which does use :triggerCharacters, João Távora, 2019/10/20
- [elpa] externals/eglot 06ff65d 52/69: Rework and correct major part of xref glue code, João Távora, 2019/10/20
- [elpa] externals/eglot 9951dc5 62/69: Add a test for vscode-json-languageserver's completions, João Távora, 2019/10/20
- [elpa] externals/eglot 124a833 56/69: Add a test for #311 and #279, João Távora, 2019/10/20
- [elpa] externals/eglot d774754 37/69: Merge pull request #298 from jorams/nil-capabilities-as-false, João Távora, 2019/10/20
- [elpa] externals/eglot 20195e5 42/69: On buffer kill, first send didClose then teardown local structures, João Távora, 2019/10/20