unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Duncan Greatwood <dgbulk@gmail.com>
Cc: 45518@debbugs.gnu.org
Subject: bug#45518: Ctrl-G Fails to Interrupt Hung Tramp Remote-Compile in Emacs 27.1
Date: Wed, 17 Feb 2021 16:39:43 +0100	[thread overview]
Message-ID: <87mtw2u2io.fsf@gmx.de> (raw)
In-Reply-To: <CAN_Aq+pqKy5XPiuGf4Fn7bJy0gTtD1jq8oHu+s0v_BeJMF7AUQ@mail.gmail.com> (Duncan Greatwood's message of "Tue, 16 Feb 2021 21:41:39 -0800")

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

Duncan Greatwood <dgbulk@gmail.com> writes:

> Michael -

Hi Duncan,

> Prompted by your question, I downloaded Tramp 2.5.0.1 from GNU ELPA
> and copied those .el files over the tramp files in .../lisp/net,
> applied the patch in tramp-integration.el and recompiled the macos
> application. I have the patched compile.el included as well, just to
> be clear.

I seriously recommend to use Emacs' package manager for installation,
and NOT to overwrite files in Emacs' installation dir. Experience tells,
that this is always good for trouble in the long run.

> I checked in run time, tramp-compile-advice-add and
> compilation-start-hook are defined as we'd wish.
>
> Unfortunately, I see no change in behaviour. If I click on a syntax
> error message while compiling test.cpp in the autotools project via
> tramp, the compile hangs until I ctrl-g out.
>
> Not sure why the difference vs. your setup, sorry.

Strange. I've reworked the Tramp patch a little bit. Function names have
changed, and more important, it has traces now. Could you please apply
this patch instead of the previous patch in tramp-integration.el? Rerun
your test with tramp-verbose set to 6, and send the Tramp debug buffer
if it still doesn't work as expected.

> Best regards,
> Duncan.

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2346 bytes --]

*** /tmp/edifffETTJu	2021-02-17 16:37:56.993381450 +0100
--- /home/albinus/src/tramp/lisp/tramp-integration.el	2021-02-17 14:12:36.736224836 +0100
***************
*** 41,46 ****
--- 41,47 ----
  (declare-function recentf-cleanup "recentf")
  (declare-function tramp-dissect-file-name "tramp")
  (declare-function tramp-file-name-equal-p "tramp")
+ (declare-function tramp-message "tramp")
  (declare-function tramp-tramp-file-p "tramp")
  (defvar eshell-path-env)
  (defvar ido-read-file-name-non-ido)
***************
*** 261,266 ****
--- 262,303 ----
  		  (delete (info-lookup->mode-cache 'symbol ',mode)
  			  (info-lookup->topic-cache 'symbol))))))))

+ ;;; Integration of compile.el:
+
+ ;; Compilation processes use `accept-process-output' such a way that
+ ;; Tramp's parallel `accept-process-output' blocks.  See last part of
+ ;; Bug#45518.  So we forbid them to run in parallel.  There must be a
+ ;; better solution, though.
+ (defun tramp-compile-disable-goto-error (proc)
+   "Don't allow remote file operations while compiling."
+   (with-current-buffer (process-buffer proc)
+     (when (file-remote-p default-directory)
+       (advice-add 'ignore :override 'compile-goto-error)
+       (tramp-message
+        (tramp-dissect-file-name default-directory) 4
+        "Disable `compile-goto-error'"))))
+
+ (defun tramp-compile-enable-goto-error (buffer _message)
+   "Reenable remote file operations."
+   (with-current-buffer buffer
+     (when (file-remote-p  default-directory)
+       (advice-remove 'ignore 'compile-goto-error)
+       (tramp-message
+        (tramp-dissect-file-name default-directory) 4
+        "Enable `compile-goto-error'"))))
+
+ (with-eval-after-load 'compile
+   (add-hook 'compilation-start-hook
+ 	    #'tramp-compile-disable-goto-error)
+   (add-hook 'compilation-finish-functions
+ 	    #'tramp-compile-enable-goto-error)
+   (add-hook 'tramp-integration-unload-hook
+ 	    (lambda ()
+ 	      (remove-hook 'compilation-start-hook
+ 			   #'tramp-compile-disable-goto-error)
+ 	      (remove-hook 'compilation-finish-functions
+ 			   #'tramp-compile-enable-goto-error))))
+
  ;;; Default connection-local variables for Tramp:
  ;; `connection-local-set-profile-variables' and
  ;; `connection-local-set-profiles' exists since Emacs 26.1.

  reply	other threads:[~2021-02-17 15:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29  1:10 bug#45518: Ctrl-G Fails to Interrupt Hung Tramp Remote-Compile in Emacs 27.1 Duncan Greatwood
2020-12-30 10:36 ` Michael Albinus
2020-12-30 21:13 ` Duncan Greatwood
2020-12-31  8:42   ` Michael Albinus
2021-01-03 10:27     ` Michael Albinus
2021-01-03 19:27 ` Duncan Greatwood
2021-01-06 13:37   ` Michael Albinus
2021-01-06 22:54 ` Duncan Greatwood
2021-01-11 10:58   ` Michael Albinus
2021-01-11 16:52 ` Duncan Greatwood
2021-01-11 17:56   ` Michael Albinus
2021-01-12  4:34 ` Duncan Greatwood
2021-01-12  9:02   ` Michael Albinus
2021-01-12 15:02   ` Michael Albinus
2021-01-29  5:15 ` Duncan Greatwood
2021-01-29  8:53   ` Michael Albinus
2021-02-10 15:40   ` Michael Albinus
2021-02-11 15:22     ` Michael Albinus
2021-02-14  1:38 ` Duncan Greatwood
2021-02-14 14:15   ` Michael Albinus
2021-02-15 20:21 ` Duncan Greatwood
2021-02-16 20:09   ` Michael Albinus
2021-02-17  5:41 ` Duncan Greatwood
2021-02-17 15:39   ` Michael Albinus [this message]
2021-03-16  1:36 ` Duncan Greatwood
2021-03-16 18:30   ` Michael Albinus
     [not found] <CAN_Aq+rYcM7wHHWXKBqyY4P0Ew04RfkqnQUioqtUk0AOUeaRMA@mail.gmail.com>
2021-02-25 18:33 ` Michael Albinus
2021-03-15 20:49   ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtw2u2io.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=45518@debbugs.gnu.org \
    --cc=dgbulk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).