Fix lexical binding issue loading python language server.

This commit is contained in:
Tom Alexander
2026-09-13 22:38:34 -04:00
parent 4a6cbfad67
commit ffbd3847e7
2 changed files with 5 additions and 6 deletions

View File

@@ -12,10 +12,9 @@
"Run a command using the current buffer as stdin and replacing its contents if the command succeeds with the stdout from the command. This is useful for code formatters." "Run a command using the current buffer as stdin and replacing its contents if the command succeeds with the stdout from the command. This is useful for code formatters."
(let ( (let (
(stdout-buffer (generate-new-buffer "tmp-stdout" t)) (stdout-buffer (generate-new-buffer "tmp-stdout" t))
(full-cmd (append '(call-process-region nil nil cmd nil stdout-buffer nil) args))
) )
(unwind-protect (unwind-protect
(let ((exit-status (eval full-cmd))) (let ((exit-status (apply #'call-process-region nil nil cmd nil (list stdout-buffer nil) nil args)))
(if (eq exit-status 0) (if (eq exit-status 0)
(save-excursion (save-excursion
(replace-buffer-contents stdout-buffer) (replace-buffer-contents stdout-buffer)
@@ -32,10 +31,9 @@
"Run a command using the current buffer as stdin and replacing its contents if the command succeeds with the stdout from the command. This is useful for code formatters. This version only replaces the buffer contents if the command output some text." "Run a command using the current buffer as stdin and replacing its contents if the command succeeds with the stdout from the command. This is useful for code formatters. This version only replaces the buffer contents if the command output some text."
(let ( (let (
(stdout-buffer (generate-new-buffer "tmp-stdout" t)) (stdout-buffer (generate-new-buffer "tmp-stdout" t))
(full-cmd (append '(call-process-region nil nil cmd nil stdout-buffer nil) args))
) )
(unwind-protect (unwind-protect
(let ((exit-status (eval full-cmd))) (let ((exit-status (apply #'call-process-region nil nil cmd nil (list stdout-buffer nil) nil args)))
(if (eq exit-status 0) (if (eq exit-status 0)
(if (> (buffer-size stdout-buffer) 0) (if (> (buffer-size stdout-buffer) 0)
(save-excursion (save-excursion
@@ -56,10 +54,9 @@
(let ( (let (
(default-directory (or dir default-directory)) (default-directory (or dir default-directory))
(stdout-buffer (generate-new-buffer "tmp-stdout" t)) (stdout-buffer (generate-new-buffer "tmp-stdout" t))
(full-cmd (append '(call-process cmd nil (list stdout-buffer nil) nil) args))
) )
(unwind-protect (unwind-protect
(let ((exit-status (condition-case nil (eval full-cmd) (file-missing nil)))) (let ((exit-status (condition-case nil (apply #'call-process cmd nil (list stdout-buffer nil) nil args) (file-missing nil))))
(if (eq exit-status 0) (if (eq exit-status 0)
(progn (progn
(with-current-buffer stdout-buffer (with-current-buffer stdout-buffer

View File

@@ -15,6 +15,8 @@
;; :custom ;; :custom
;; (treesit-font-lock-level 3) ;; (treesit-font-lock-level 3)
(setq treesit-font-lock-level 4) (setq treesit-font-lock-level 4)
;; (setq treesit-auto-install-grammar t)
;; (setq treesit-enabled-modes t)
) )
(provide 'util-tree-sitter) (provide 'util-tree-sitter)