bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61350: Eglot over Tramp freezes with large project


From: João Távora
Subject: bug#61350: Eglot over Tramp freezes with large project
Date: Thu, 16 Mar 2023 15:58:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

João Távora <joaotavora@gmail.com> writes:

> Jim Porter <jporterbugs@gmail.com> writes:
>    (setq answer-from-proc (catch 'done
>                             (process-put proc 'busy t)
>                             (process-send-string proc "OPEN THE POD BAY 
> DOORS\n")
>                             (while (accept-process-output))))
>
> This is very simplified (and untested), but that's the gist.  

The gist it is, but also very broken.  As ever, vapourware sucks. This
is what that snippet should have been:

  ;;; hal.el --- asdasd                                -*- lexical-binding: t; 
-*-
  (defvar hal-proc nil)
  (defun hal-connect()
    (interactive)
    (when (processp hal-proc) (delete-process hal-proc))
    (setq hal-proc
          (make-process
           :name "halproc"
           :command (list (expand-file-name "hal" default-directory))
           :buffer (generate-new-buffer "*halbuf*")
           :filter (lambda (proc output)
                     (internal-default-process-filter proc output)
                     (when-let* ((buffer (process-buffer proc))
                                 (callback (and (buffer-live-p buffer)
                                                (process-get proc 'callback))))
                       (with-current-buffer buffer
                         (save-excursion
                           (goto-char (point-min))
                           (when (search-forward ", DAVE\n" nil t)
                             (unwind-protect (funcall callback
                                                      (buffer-substring
                                                       (point-min) (point)))
                               (process-put proc 'callback nil)
                               (delete-region (point-min)
                               (point)))))))))))
   
  (defun hal-command ()  "Synch command to HAL that doesn't block others."
    (interactive)
    (message
     (catch 'hal-done
       (process-put hal-proc 'callback
                    (lambda (result) (throw 'hal-done result)))
       (process-send-string hal-proc "OPEN THE POD BAY DOORS!\n")
       (while (accept-process-output hal-proc)))))

You can test this with this very complex C++ program
    
   #include <cstdlib>
   #include <iostream>
   #include <string>
   #include <array>
    
   int main() {
     std::string line;
     const char* retorts[] = {
       "I'M AFRAID I CAN'T DO THAT",
       "I'D RATHER NOT",
       "THINK OF THE CONSEQUENCES",
       "PLEASE STOP"
     };
     while (std::cin >> line)
       std::cout << retorts[std::rand()%4] << ", DAVE" << std::endl;
   }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]