From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 12 15:43:00 2023 Received: (at submit) by debbugs.gnu.org; 12 Sep 2023 19:43:00 +0000 Received: from localhost ([127.0.0.1]:60119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg9Hn-0006un-M3 for submit@debbugs.gnu.org; Tue, 12 Sep 2023 15:43:00 -0400 Received: from lists.gnu.org ([2001:470:142::17]:37378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg9Hl-0006uV-Bn for submit@debbugs.gnu.org; Tue, 12 Sep 2023 15:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qg9HW-00038L-Eg for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 15:42:43 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qg9HT-0000Qq-Na for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 15:42:42 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: 29.1.50; Debugging errors surfaced through emacsclient is hard Date: Tue, 12 Sep 2023 15:42:37 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Errors which happen through emacsclient never trigger the debugger and only print a simple error message, which makes it very difficult to debug them. If there's an error which, for some reason, only happens when running emacsclient, then life becomes very difficult. I just encountered this with one of my users - I still have no idea why the error only affected emacsclient, or how I could have reproduced it without emacsclient, I eventually fixed it by bisecting their .emacs. Toy example: 1. emacs -Q 2. (server-start) 3. (add-hook 'before-make-frame-hook (lambda () (error "frame hook error"))) 4. emacsclient -c The output of emacsclient is: Waiting for Emacs... *ERROR*: frame hook error That's all, there is no way to get more information about the error that happened. Ideally, when emacsclient encounters an error and debug-on-error is non-nil, it should cause Emacs to enter the debugger. In GNU Emacs 29.1.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2023-09-11 built on Repository revision: f9bc92d0b36bc631d11c194e4b580f43b7b8dcba Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.8 (Green Obsidian) Configured using: 'configure --config-cache --with-x-toolkit=lucid --with-gif=ifavailable' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: ELisp/l Minor modes in effect: bug-reference-prog-mode: t global-so-long-mode: t pixel-scroll-precision-mode: t jane-fe-minor-mode: t jane-fe-jenga-minor-mode: t editorconfig-mode: t which-function-mode: t global-git-commit-mode: t magit-auto-revert-mode: t auto-revert-mode: t shell-dirtrack-mode: t server-mode: t windmove-mode: t savehist-mode: t save-place-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t context-menu-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Features: (shadow emacsbug calc calc-loaddefs rect calc-macs pcmpl-unix pcmpl-gnu mule-util reposition face-remap package-x descr-text etags fileloop cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs log-view bug-reference cus-start qp sort smiley gnus-cite mail-extr textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check gnus-async gnus-bcklg gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml gnus-msg disp-table nndoc gnus-cache gnus-dup mm-archive url-http-ntlm ntlm hmac-md5 hex-util md4 network-stream url-cache debbugs-gnu debbugs-compat debbugs soap-client url-http url-gw nsm rng-xsd rng-dt rng-util xsd-regexp vc-git shortdoc async-bytecomp async tramp-cmds tramp-sh tramp-cache time-stamp hl-line vc vc-dispatcher sh-script treesit cl-print help-fns radix-tree misc conf-mode dabbrev display-line-numbers goto-addr executable pulse misearch multi-isearch dired-aux org-element org-persist org-id org-refile avl-tree generator oc-basic ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range gnus-win ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi vc-fe find-dired so-long jane-fe-read-feature pixel-scroll cua-base vc-hg tramp tramp-loaddefs trampver tramp-integration tramp-compat parse-time iso8601 ffap jane-merlin merlin-imenu let-alist merlin-xref merlin-cap merlin jane-async-merlin jane-completion grep jane-common jane-comint org-protocol jane-fe-project xref files-x jane-fe-menu ecaml_plugin view gopcaml magit-bookmark bookmark image+ advice image-file image-converter editorconfig editorconfig-core editorconfig-core-handle editorconfig-fnmatch whitespace jane-auto-modes vba-mode markdown-mode color jane jane-yasnippet jane-micro-features ert ewoc debug backtrace jane-diff unified-test-mode shell-file core core-buffer core-error jane-sexp jane-python jane-ocaml jane-tuareg-theme tuareg tuareg-compat tuareg-opam skeleton flymake-proc flymake warnings thingatpt smie caml-types caml-help caml-emacs find-file compile jane-cr jane-codeium jane-align jane-deprecated jane-smerge gnu-elpa-keyring-update jane-ocp-indent ocp-indent jane-eglot yasnippet-autoloads swiper-autoloads htmlize-autoloads eglot-autoloads editorconfig-autoloads codeium-autoloads jane-autoloads jane-util ob-shell page-ext dired-x magit-extras project magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff diff-mode git-commit log-edit message sendmail yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process with-editor shell server magit-mode transient edmacro kmacro magit-git magit-section magit-utils crm dash gnus nnheader gnus-util text-property-search mail-utils range mm-util mail-prsvr cl-extra help-mode windmove org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete pcomplete org-list org-footnote org-faces org-entities time-date noutline outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs org-version org-compat org-macs format-spec gdb-mi bindat gud easy-mmode comint ansi-osc ansi-color ring vundo modus-vivendi-theme modus-themes pcase savehist saveplace cus-edit pp cus-load icons wid-edit adaptive-wrap-autoloads csv-mode-autoloads cyberpunk-theme-autoloads evil-autoloads exwm-autoloads helm-autoloads helm-core-autoloads async-autoloads ivy-autoloads magit-autoloads git-commit-autoloads finder-inf magit-section-autoloads dash-autoloads popup-autoloads url-http-ntlm-autoloads url-auth vc-hgcmd-autoloads vundo-autoloads info with-editor-autoloads xelb-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 1290183 152090) (symbols 48 57370 1) (strings 32 222722 19140) (string-bytes 1 8502817) (vectors 16 116575) (vector-slots 8 2371281 184939) (floats 8 770 630) (intervals 56 99161 3193) (buffers 976 171)) From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 10:54:52 2023 Received: (at 65897) by debbugs.gnu.org; 14 Sep 2023 14:54:52 +0000 Received: from localhost ([127.0.0.1]:40836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnk4-0002uM-2h for submit@debbugs.gnu.org; Thu, 14 Sep 2023 10:54:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnk2-0002u9-E8 for 65897@debbugs.gnu.org; Thu, 14 Sep 2023 10:54:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgnjq-0003aU-GZ; Thu, 14 Sep 2023 10:54:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=AYiBs0+zYVs3HrnpRQmelgA2YEDQP72zCp5RABDmA2k=; b=aZL4tx+05LM4 7e9seAOazir2QWKRvFsDj6db8pgnK/lDsGawOqjIGcAlF/Pv0EINX2KGgVljhNxsS/Vqa2wMtj/Db gqmwzMne0/7GBUF7jLOScyHFHeV3zsvUlTFCI6Zo+w8B6ulHPPJXyd6cI+ucm3N6Wq7w1aBHLExM7 yZT19L073d7HdeN88vlBASPDVadLA6mRbOpydTdRVQCpcRPIa/kBPRNX2WwxbqwFr63F0NiGIwY2t cnbGO4EnSucYZlJtefpXdNPG04+ef8Y/w5hHKJb+Gopq5gGo3TiSG8vfQGlGW3rjvnLSpDAGzbvST oYVuce+cVGmQgG2SIGA1/w==; Date: Thu, 14 Sep 2023 17:54:28 +0300 Message-Id: <83msxols9n.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh , Stefan Monnier In-Reply-To: (message from Spencer Baugh on Tue, 12 Sep 2023 15:42:37 -0400) Subject: Re: bug#65897: 29.1.50; Debugging errors surfaced through emacsclient is hard References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65897 Cc: 65897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Date: Tue, 12 Sep 2023 15:42:37 -0400 > > Toy example: > 1. emacs -Q > 2. (server-start) > 3. (add-hook 'before-make-frame-hook (lambda () (error "frame hook error"))) > 4. emacsclient -c > > The output of emacsclient is: > > Waiting for Emacs... > *ERROR*: frame hook error > > That's all, there is no way to get more information about the error that > happened. > > Ideally, when emacsclient encounters an error and debug-on-error is > non-nil, it should cause Emacs to enter the debugger. I'm not sure we can allow entering the debugger from server-execute. That function is documented as being called from timers and process filters, so entering the debugger might be unsafe. Stefan, any comments? From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 18 10:02:15 2023 Received: (at 65897) by debbugs.gnu.org; 18 Sep 2023 14:02:15 +0000 Received: from localhost ([127.0.0.1]:53941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiEpL-0005jA-In for submit@debbugs.gnu.org; Mon, 18 Sep 2023 10:02:15 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiEpI-0005ip-Ae for 65897@debbugs.gnu.org; Mon, 18 Sep 2023 10:02:14 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AAF22806AC; Mon, 18 Sep 2023 10:01:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1695045717; bh=YZVPqJPVE1hQf3TJGfs84Ac6T31ocj6oCeP6FfVnQXY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kwuPJnR1mJ4egrbhIov72Lcrz4Hm0e4pQxXhzVR0UisV5+YAbSrl8Cje9dtbGbYXy xTig/mTbA1BQ5T7F5kfgBBNh7YOtGxRqyKY2SikKFSEAl81rWYaB+kz6JiExS58Nzb eEVyQVJ1rb2Q4iY3cpan07Igbv1yuctXBFZMv8AuMsBtxJ0gQpB4mBZgzctwvMADu4 RqoWEvEH4B+e3VVnClcHVrORz2ONDo2RAy1cI8UXxpcMr5FJFtxyE5fDryFE1Rl80B VMKCfOSfuEbl2hw6a30OV5vZKNry8wA5fQnfnryPwM047MsnmYw7UjBNz5DrPyEHM5 gpMBDg9nwXwWQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 83D5480250; Mon, 18 Sep 2023 10:01:57 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 731CB1201C6; Mon, 18 Sep 2023 10:01:57 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#65897: 29.1.50; Debugging errors surfaced through emacsclient is hard In-Reply-To: <83msxols9n.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Sep 2023 17:54:28 +0300") Message-ID: References: <83msxols9n.fsf@gnu.org> Date: Mon, 18 Sep 2023 10:00:42 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.098 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65897 Cc: Spencer Baugh , 65897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Toy example: >> 1. emacs -Q >> 2. (server-start) >> 3. (add-hook 'before-make-frame-hook (lambda () (error "frame hook error"))) >> 4. emacsclient -c >> >> The output of emacsclient is: >> >> Waiting for Emacs... >> *ERROR*: frame hook error >> >> That's all, there is no way to get more information about the error that >> happened. >> >> Ideally, when emacsclient encounters an error and debug-on-error is >> non-nil, it should cause Emacs to enter the debugger. > > I'm not sure we can allow entering the debugger from server-execute. > That function is documented as being called from timers and process > filters, so entering the debugger might be unsafe. AFAIK it is perfectly safe to drop into the debugger when running timers and process-filters. I believe the reason why this doesn't happen here is because of the `condition-case` used to grab the error and send it to Emacsclient's output. See patch below. We could also offer a way to grab the backtrace and send it over to Emacsclient's output. Stefan diff --git a/lisp/server.el b/lisp/server.el index 10f15598221..2536a9c6591 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1175,7 +1175,7 @@ server-process-filter (when prev (setq string (concat prev string)) (process-put proc 'previous-string nil))) - (condition-case err + (condition-case-unless-debug err (progn (server-add-client proc) ;; Send our pid From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 29 17:02:18 2025 Received: (at 65897) by debbugs.gnu.org; 29 Aug 2025 21:02:18 +0000 Received: from localhost ([127.0.0.1]:43502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1us6Ej-0001yZ-Ow for submit@debbugs.gnu.org; Fri, 29 Aug 2025 17:02:18 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:55673) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1us6Eh-0001xJ-4I for 65897@debbugs.gnu.org; Fri, 29 Aug 2025 17:02:16 -0400 From: Spencer Baugh To: Stefan Monnier Subject: Re: bug#65897: 29.1.50; Debugging errors surfaced through emacsclient is hard In-Reply-To: (Stefan Monnier's message of "Mon, 18 Sep 2023 10:00:42 -0400") References: <83msxols9n.fsf@gnu.org> Date: Fri, 29 Aug 2025 17:02:09 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1756501329; bh=HcBIO+zmt2PAEQYJVoM8INzm91axNqiiCAs1WZyd26Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=mWSKp6+EXoRM0zLmlLwQ/TrelArZZMwlJmDGrXpw1iclEq3fRumcd0TloFMnfOOc8 o2l6XQdKAkncNzJ4J9bgqw6fknv5P4BmV/O596peZU+ORxgQ46UnEzTPS+bZ2oLAQH WBqZM/oR/p7FIlnChFBqWTVMNK53JW7ktHshQ/sMnSgXmnPMznSTGHGFiSQVVr3Mr0 Nd4n3jKPUplsne0FG0kNZVVXDJz5px5xgwk8NLYe11zC4mi/qgzzaIP6/BMsoEt9uH pCKybhFfrH1hO8mo1WYG1SHhGlX286fzAd+qDB+O0j1sOavdg/3livoRx1afk2ETeG MWz2yWqEcOlHg== X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65897 Cc: Eli Zaretskii , 65897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Stefan Monnier writes: >>> Toy example: >>> 1. emacs -Q >>> 2. (server-start) >>> 3. (add-hook 'before-make-frame-hook (lambda () (error "frame hook error"))) >>> 4. emacsclient -c >>> >>> The output of emacsclient is: >>> >>> Waiting for Emacs... >>> *ERROR*: frame hook error >>> >>> That's all, there is no way to get more information about the error that >>> happened. >>> >>> Ideally, when emacsclient encounters an error and debug-on-error is >>> non-nil, it should cause Emacs to enter the debugger. >> >> I'm not sure we can allow entering the debugger from server-execute. >> That function is documented as being called from timers and process >> filters, so entering the debugger might be unsafe. > > AFAIK it is perfectly safe to drop into the debugger when running timers > and process-filters. I believe the reason why this doesn't happen here is > because of the `condition-case` used to grab the error and send it to > Emacsclient's output. See patch below. > > We could also offer a way to grab the backtrace and send it over to > Emacsclient's output. > > > Stefan > > > diff --git a/lisp/server.el b/lisp/server.el > index 10f15598221..2536a9c6591 100644 > --- a/lisp/server.el > +++ b/lisp/server.el > @@ -1175,7 +1175,7 @@ server-process-filter > (when prev > (setq string (concat prev string)) > (process-put proc 'previous-string nil))) > - (condition-case err > + (condition-case-unless-debug err > (progn > (server-add-client proc) > ;; Send our pid I tested this and it works for me. I suggest we should install this. Here's a modernized version as a patch which applies to trunk. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Allow-entering-the-debugger-on-error-in-server-conne.patch >From b9aa445c6eb92481ac5b02f69eb99f404aca5cdf Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Fri, 29 Aug 2025 17:00:47 -0400 Subject: [PATCH] Allow entering the debugger on error in server connection * lisp/server.el (server--process-filter-1): Use condition-case-unless-debug. (bug#65897) --- lisp/server.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/server.el b/lisp/server.el index 4415c45971e..70299d52f18 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1232,7 +1232,7 @@ server--process-filter-1 (when prev (setq string (concat prev string)) (process-put proc 'previous-string nil))) - (condition-case err + (condition-case-unless-debug err (progn (server-add-client proc) ;; Send our pid -- 2.43.7 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 31 00:33:19 2025 Received: (at 65897) by debbugs.gnu.org; 31 Aug 2025 04:33:19 +0000 Received: from localhost ([127.0.0.1]:51299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1usZkl-0007gD-0F for submit@debbugs.gnu.org; Sun, 31 Aug 2025 00:33:19 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60577) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1usZkg-0007fq-8p for 65897@debbugs.gnu.org; Sun, 31 Aug 2025 00:33:15 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 14A6610025E; Sun, 31 Aug 2025 00:33:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1756614787; bh=RoTvjA8PD5B+KantlGFzXIsYkjpHE6LhwnVMLGSmgFA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mdTZxTfbrWuHuVipdx6MiN/9JIsMfQgDInOUXhCF6dfPKQQWKOyCTdOKB3MLYslmU zvTBQPPqKJ6twt4YDPB4JcBMn0DzIYlLVeImFpJqkTgp1hPdXzDRByYWx+xKKAH8q+ R5d/aEboBUNoGhOIk4taZPK4vzXHGyqs7eQjw7h/r1qjinyXJa9PWb73EBLG/ciJd8 oeBOE/azweKksqpBqsqoyA0gxZZkogYZEr5oDJ001NhSZph9gB9IKRkEL9zVARCOx+ PajD0WmxMFTaAIDZNwXRi4fFwDVao3REClBYEPs+MxIAG0Chu9Cf4m5zgxaD+rpoFo MBA8ENkhkRiSg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5713910002E; Sun, 31 Aug 2025 00:33:07 -0400 (EDT) Received: from pastel (69-165-161-194.dsl.teksavvy.com [69.165.161.194]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2B0A01203CD; Sun, 31 Aug 2025 00:33:07 -0400 (EDT) From: Stefan Monnier To: Spencer Baugh Subject: Re: bug#65897: 29.1.50; Debugging errors surfaced through emacsclient is hard In-Reply-To: Message-ID: References: <83msxols9n.fsf@gnu.org> Date: Sun, 31 Aug 2025 00:33:06 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65897 Cc: Eli Zaretskii , 65897@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I tested this and it works for me. I suggest we should install this. > Here's a modernized version as a patch which applies to trunk. LGTM, Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 31 02:55:55 2025 Received: (at 65897-done) by debbugs.gnu.org; 31 Aug 2025 06:55:55 +0000 Received: from localhost ([127.0.0.1]:51761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1usbyl-0002E3-BS for submit@debbugs.gnu.org; Sun, 31 Aug 2025 02:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37862) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1usbyi-0002De-CE for 65897-done@debbugs.gnu.org; Sun, 31 Aug 2025 02:55:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usbyc-0000FV-Ef; Sun, 31 Aug 2025 02:55:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1bVhsymrQ1bvhaWMjlxq9YNlfbXZSxxtGjVNtrRZ+Bg=; b=ae2q2uY/Xsnu ksdj3+ymxM/jwPtrfciJPDCsIsawu6uNIMNARLYYbXvsVwuoUy+PszWWx0UyZLnTvhBqXOZXl0AqK +vgjtbssLuRLZ/DAPYHkv6ZMOMbUCTanVhjem/PfyGF//T4hQY/4z/4Rnui141ogmeXfO2cl2GDM+ LVoGL/zZeehz+odhZ2+dElvHqSJvaNGLFR5Gz0TI68pIfH8yPKNpoNTlXAS56Af2hSHhxgRns8Ok1 8GMEnxk0Bks5RuEWUxpMIA3nHaFbOplGFKztilFeQ23/BSKusTnehM2u6e01l+4zqi5ovq/r92kAQ R/EwB3kvG6P+qbj2dJlJmQ==; Date: Sun, 31 Aug 2025 09:55:43 +0300 Message-Id: <86tt1onfo0.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Sun, 31 Aug 2025 00:33:06 -0400) Subject: Re: bug#65897: 29.1.50; Debugging errors surfaced through emacsclient is hard References: <83msxols9n.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65897-done Cc: sbaugh@janestreet.com, 65897-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Eli Zaretskii , 65897@debbugs.gnu.org > Date: Sun, 31 Aug 2025 00:33:06 -0400 > > > I tested this and it works for me. I suggest we should install this. > > Here's a modernized version as a patch which applies to trunk. > > LGTM, Thanks, installed on master (with the missing NEWS entry), and closing the bug.