Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility issues with lsp-tramp-connection and emacs 28 #2514

Closed
tshu-w opened this issue Jan 10, 2021 · 3 comments
Closed

compatibility issues with lsp-tramp-connection and emacs 28 #2514

tshu-w opened this issue Jan 10, 2021 · 3 comments

Comments

@tshu-w
Copy link

tshu-w commented Jan 10, 2021

Describe the bug
In emacs GNU Emacs 28.0.50, start-file-process-shell-command was update from:

(defun start-file-process-shell-command (name buffer &rest args)
  "Start a program in a subprocess.  Return the process object for it.
Similar to `start-process-shell-command', but calls `start-file-process'."
  (declare (advertised-calling-convention (name buffer command) "23.1"))
  ;; On remote hosts, the local `shell-file-name' might be useless.
  (with-connection-local-variables
   (start-file-process
    name buffer
    shell-file-name shell-command-switch
    (mapconcat 'identity args " "))))

to:

(defun start-file-process-shell-command (name buffer command)
  "Start a program in a subprocess.  Return the process object for it.
Similar to `start-process-shell-command', but calls `start-file-process'."
  ;; On remote hosts, the local `shell-file-name' might be useless.
  (with-connection-local-variables
   (start-file-process
    name buffer shell-file-name shell-command-switch command)))

which make lsp-tramp-connection unusable.

A temporary solution on user side:

    (defun start-file-process-shell-command@around (start-file-process-shell-command name buffer &rest args)
      "Start a program in a subprocess.  Return the process object for it.
Similar to `start-process-shell-command', but calls `start-file-process'."
      ;; On remote hosts, the local `shell-file-name' might be useless.
      (let ((command (mapconcat 'identity args " ")))
        (funcall start-file-process-shell-command name buffer command)))

    (advice-add 'start-file-process-shell-command :around #'start-file-process-shell-command@around)

By the way, tramp complain about when lsp make tramp connection:

Error processing message (remote-file-error "Forbidden reentrant call of Tramp").
Remote file error: Forbidden reentrant call of Tramp

TRAMP user manual explains that

Timers, process filters and sentinels, and other event based functions can run at any time, when a remote file operation is still running. This can cause TRAMP to block. When such a situation is detected, this error is triggered. It shall be fixed in the respective function (an error report will help).

Is this the reason why lsp tramp often blocks emacs? #1845. Is there any way to improve lsp-tramp-connection?

@tshu-w tshu-w changed the title Compatibility issues with lsp-tramp-connection and emacs 28 compatibility issues with lsp-tramp-connection and emacs 28 Jan 10, 2021
@martin5233
Copy link

@tshu-w: Take a look at #2375, which contains information about the changes applied on both the tramp and the lsp side.

@tshu-w
Copy link
Author

tshu-w commented Jan 13, 2021

Thanks and let's discuss in #2375

@tshu-w tshu-w closed this as completed Jan 13, 2021
@tshu-w
Copy link
Author

tshu-w commented Jan 13, 2021

maybe write an around of start-file-process-shell-command is a better choise:

    (defun start-file-process-shell-command@around (start-file-process-shell-command name buffer &rest args)
      "Start a program in a subprocess.  Return the process object for it.
Similar to `start-process-shell-command', but calls `start-file-process'."
      ;; On remote hosts, the local `shell-file-name' might be useless.
      (let ((command (mapconcat 'identity args " ")))
        (funcall start-file-process-shell-command name buffer command)))

    (advice-add 'start-file-process-shell-command :around #'start-file-process-shell-command@around)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants