]> git.eshelyaron.com Git - emacs.git/commit
Don't use file-truepath in Eglot (bug#70036)
authorTheodor Thornhill <theo@thornhill.no>
Sat, 30 Mar 2024 19:52:41 +0000 (20:52 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 4 Apr 2024 11:40:19 +0000 (13:40 +0200)
commit19b85e5d83c5f35ee003fa08cef4610d8a77cc59
tree497e05ed4ff51bd711acc7299c7942fabdb212ed
parent86a607100155bbf6f1616968c8faf31dc6cb7376
Don't use file-truepath in Eglot (bug#70036)

`file-truepath' is slow because of recursive calls and being implemented
in lisp.  It seems to not be needed in eglot, but it is used behind the
scenes in `find-buffer-visiting', thus appearing in profiles.  Moving
the implementation to a hash map will yield similar performance
benefits, but wouldn't require us to rewrite `file-truename' in C.

* lisp/progmodes/eglot.el (eglot-lsp-server): Convert 'managed-buffers'
to a hashmap.
(eglot-uri-to-path): Don't use file-truepath, as it is too slow to be
included in the hot path.
(eglot--on-shutdown): Use buffers from buffer map.
(eglot--managed-mode): Add buffer to map, rather than list. Also remove
it from the map on deactivation.
(eglot-handle-notification): Expose server and get buffer from the
buffer map.

(cherry picked from commit 08c80c45ddea17df87fc768a39dff353ccc13d3b)
lisp/progmodes/eglot.el