unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Adam Ibrahim <ibrahimadam193@gmail.com>
Cc: 63629@debbugs.gnu.org
Subject: bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions
Date: Fri, 26 May 2023 13:29:38 +0300	[thread overview]
Message-ID: <837csvl71p.fsf@gnu.org> (raw)
In-Reply-To: <CAHdC_iKGaf6EFOs5CF_RWmSjf6e434ZUpywLKgF-d-auNgA-aw@mail.gmail.com> (message from Adam Ibrahim on Wed, 24 May 2023 08:08:13 -0400)

> From: Adam Ibrahim <ibrahimadam193@gmail.com>
> Date: Wed, 24 May 2023 08:08:13 -0400
> Cc: 63629@debbugs.gnu.org
> 
> Makes sense. Thanks.

I eventually found a way of showing the error message in almost all
cases, and installed the fix with those changes on the master branch.
Please try the patch below and see if it produces better results.

diff --git a/lisp/server.el b/lisp/server.el
index 608e5df..c3325e5 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1143,8 +1143,18 @@ server-process-filter
 	  (process-put proc :authenticated t)
 	  (server-log "Authentication successful" proc))
       (server-log "Authentication failed" proc)
+      ;; Display the error as a message and give the user time to see
+      ;; it, in case the error written by emacsclient to stderr is not
+      ;; visible for some reason.
+      (message "Authentication failed")
+      (sit-for 2)
       (server-send-string
        proc (concat "-error " (server-quote-arg "Authentication failed")))
+      (unless (eq system-type 'windows-nt)
+        (let ((terminal (process-get proc 'terminal)))
+          ;; Only delete the terminal if it is non-nil.
+          (when (and terminal (eq (terminal-live-p terminal) t))
+	    (delete-terminal terminal))))
       ;; Before calling `delete-process', give emacsclient time to
       ;; receive the error string and shut down on its own.
       (sit-for 1)
@@ -1462,10 +1472,20 @@ server-execute
 
 (defun server-return-error (proc err)
   (ignore-errors
+    ;; Display the error as a message and give the user time to see
+    ;; it, in case the error written by emacsclient to stderr is not
+    ;; visible for some reason.
+    (message (error-message-string err))
+    (sit-for 2)
     (server-send-string
      proc (concat "-error " (server-quote-arg
                              (error-message-string err))))
     (server-log (error-message-string err) proc)
+    (unless (eq system-type 'windows-nt)
+      (let ((terminal (process-get proc 'terminal)))
+        ;; Only delete the terminal if it is non-nil.
+        (when (and terminal (eq (terminal-live-p terminal) t))
+	  (delete-terminal terminal))))
     ;; Before calling `delete-process', give emacsclient time to
     ;; receive the error string and shut down on its own.
     (sit-for 5)





  reply	other threads:[~2023-05-26 10:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-21 18:08 bug#63629: 28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions Adam Ibrahim
2023-05-21 18:22 ` Eli Zaretskii
     [not found]   ` <CAHdC_iKdG9viw__B0j9Pqa4Wq9QMpLk5SSc12Ead_SSGfAFJhw@mail.gmail.com>
2023-05-21 18:57     ` bug#63629: Fwd: " Adam Ibrahim
2023-05-22 13:31       ` Eli Zaretskii
2023-05-23 20:30         ` Adam Ibrahim
2023-05-24 10:52           ` Eli Zaretskii
2023-05-24 12:08             ` Adam Ibrahim
2023-05-26 10:29               ` Eli Zaretskii [this message]
2023-05-31 13:20                 ` Eli Zaretskii
2023-05-21 19:05     ` Eli Zaretskii

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=837csvl71p.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63629@debbugs.gnu.org \
    --cc=ibrahimadam193@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).