all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
@ 2023-07-26  2:10 Yikai Zhao
  2023-07-26  2:30 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Yikai Zhao @ 2023-07-26  2:10 UTC (permalink / raw)
  To: 64866


After updating to recent master version of emacs, emacsclient would
block for an extra 2 seconds when some error is raised from command.

Minimal reproducable command:

  emacsclient -s <...> -e '(error "x")'

Expected behavior: this command should return immediately
Current behavior: this command take 2 second


Why it affects me:

I bind some keyboard shortcut globally to a script to move either from
emacs window or i3wm window. It does something like this:

   emacsclient -e '(windmove-right)' || i3-msg focus right

It rely on the behavior that, if I'm currently in the rightmost emacs
buffer, '(windmove-right)' would return an error and fallback to use
i3-msg to move to another frame. With this bug I mentioned, it would
introduce 2-second delay on this action.



In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-07-23 built on lilac-0
Repository revision: 5d2d28458d0eb378a7e94363ef716e8648ef129a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-native-compilation=aot
 --with-sound=no --with-xwidgets --with-tree-sitter --without-gpm
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -g
 -ffile-prefix-map=/build/emacs-native-comp-git/src=/usr/src/debug/emacs-native-comp-git
 -flto=auto' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
 -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: VTerm

Minor modes in effect:
  sudo-edit-indicator-mode: t
  windmove-mode: t
  projectile-mode: t
  recentf-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  pixel-scroll-precision-mode: t
  server-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  save-place-mode: t
  vertico-mode: t
  which-key-mode: t
  global-evil-visualstar-mode: t
  evil-visualstar-mode: t
  evil-snipe-mode: t
  evil-snipe-local-mode: t
  evil-owl-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  evil-commentary-mode: t
  evil-mode: t
  evil-local-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/blahgeek/.emacs.d/lib/cmake-mode/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/home/blahgeek/.emacs.d/lib/protobuf-mode/protobuf-mode hides /usr/share/emacs/site-lisp/protobuf-mode
/home/blahgeek/.emacs.d/lib/transient/lisp/transient hides /usr/share/emacs/30.0.50/lisp/transient
/home/blahgeek/.emacs.d/lib/use-package/use-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package
/home/blahgeek/.emacs.d/lib/use-package/use-package-lint hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-lint
/home/blahgeek/.emacs.d/lib/use-package/use-package-jump hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/blahgeek/.emacs.d/lib/use-package/use-package-ensure hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/home/blahgeek/.emacs.d/lib/use-package/use-package-ensure-system-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure-system-package
/home/blahgeek/.emacs.d/lib/use-package/use-package-diminish hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/blahgeek/.emacs.d/lib/use-package/use-package-delight hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/blahgeek/.emacs.d/lib/use-package/use-package-core hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/blahgeek/.emacs.d/lib/use-package/use-package-bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/blahgeek/.emacs.d/lib/use-package/bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/bind-key

Features:
(shadow sort mail-extr emacsbug evil-collection-woman woman
evil-collection-man man rfc2104 sudo-edit conf-mode cl-print pulse
consult-xref jka-compr evil-collection-shortdoc shortdoc dired-aux
dired-x help-fns tramp-cmds windmove tramp-cache time-stamp
lsp-diagnostics lsp-modeline evil-collection-view view lsp-zig lsp-tilt
lsp-steep lsp-svelte lsp-sqls lsp-ruby-syntax-tree lsp-ruby-lsp lsp-yaml
lsp-xml lsp-vimscript lsp-vhdl lsp-volar lsp-vetur lsp-html lsp-verilog
lsp-vala lsp-v lsp-typeprof lsp-ttcn3 lsp-toml lsp-terraform lsp-tex
lsp-sorbet lsp-solargraph lsp-rust lsp-rf lsp-ruff-lsp lsp-remark
lsp-racket lsp-r lsp-purescript lsp-pylsp lsp-pyls lsp-pwsh lsp-php
lsp-pls lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-magik
lsp-nix lsp-nim lsp-nginx lsp-mint lsp-marksman lsp-markdown lsp-lua
lsp-kotlin lsp-json lsp-javascript lsp-idris lsp-haxe lsp-groovy
lsp-hack lsp-graphql lsp-glsl lsp-gleam lsp-go lsp-completion
lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-emmet
lsp-elixir lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp
gnutls lsp-crystal lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd
dom lsp-beancount lsp-bash lsp-astro lsp-ansible lsp-angular lsp-ada
lsp-actionscript lsp-haskell haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support evil-collection-flymake
flymake-proc flymake etags fileloop generator dabbrev haskell-customize
lsp-pyright lsp-mode lsp-protocol evil-collection-xref xref spinner
network-stream nsm evil-collection-markdown-mode markdown-mode lv inline
ht ewoc vertico-directory evil-vimish-fold vimish-fold f f-shortdoc
git-gutter-fringe fringe-helper git-gutter flycheck-posframe posframe
flycheck-google-cpplint evil-collection-flycheck flycheck ligature
whitespace hl-line display-line-numbers elec-pair hl-todo dtrt-indent
tempel copilot evil-collection-org org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities evil-collection-outline noutline
outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs evil-collection-calendar cal-menu
calendar cal-loaddefs org-version org-compat org-macs editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch s
jsonrpc xonsh-mode evil-collection-sh-script sh-script smie executable
evil-collection-python python treesit orderless projectile project
evil-collection-grep grep ibuf-ext evil-collection-ibuffer ibuffer
ibuffer-loaddefs recentf tree-widget wid-edit evil-collection-consult
consult autoinsert vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
evil-collection-log-view log-view evil-collection-vc-git vc-git vc
vc-dispatcher bug-reference company-keywords company-dabbrev-code
company-dabbrev company-capf company-files company magit-bookmark
evil-collection-magit magit-submodule 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 evil-collection-package-menu package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-handlers magit-repos magit-apply magit-wip
magit-log which-func evil-collection-imenu imenu magit-diff smerge-mode
diff evil-collection-diff-mode diff-mode git-commit
evil-collection-log-edit log-edit message sendmail mailcap yank-media
puny rfc822 mml mml-sec evil-collection-epa epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor magit-mode
transient magit-git magit-base evil-collection-magit-section
magit-section cursor-sensor crm dash time pixel-scroll cua-base
auth-source-pass url-parse url-vars server fcitx dbus xml winner
evil-collection-vterm vterm evil-collection-bookmark bookmark pp
face-remap evil-collection-compile compile text-property-search
evil-collection-term term disp-table ehelp find-func vterm-module
term/xterm xterm cc-styles cc-align cc-engine cc-vars cc-defs
google-c-style autorevert filenotify saveplace tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat xdg shell
pcomplete evil-collection-comint comint ansi-osc parse-time iso8601
time-date auth-source eieio eieio-core password-cache json map
ansi-color cus-load evil-collection-vertico vertico compat
solarized-light-theme solarized-theme solarized solarized-faces color
evil-collection-which-key which-key fringe-scale switch-buffer-functions
evil-visualstar evil-snipe evil-owl format-spec evil-surround
evil-commentary evil-commentary-integration
evil-collection-tabulated-list evil-collection-tab-bar
evil-collection-simple evil-collection-replace
evil-collection-process-menu evil-collection-info evil-collection-indent
evil-collection-image image-mode evil-collection-dired dired
dired-loaddefs exif evil-collection-help evil-collection-elisp-mode
evil-collection-eldoc evil-collection-buff-menu evil-collection annalist
evil evil-integration evil-maps evil-commands reveal evil-jumps
evil-command-window evil-search evil-ex evil-types evil-macros
evil-repeat evil-states evil-core advice evil-common thingatpt rect
evil-digraphs evil-vars ring edmacro kmacro byte-opt delight comp
comp-cstr warnings icons cl-macs gv use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core yaml-mode-autoloads xonsh-mode-autoloads
with-editor-autoloads which-key-autoloads wgrep-autoloads
vterm-autoloads vimrc-mode-autoloads vimish-fold-autoloads
vertico-autoloads use-package-autoloads treepy-autoloads
transient-autoloads tempel-autoloads switch-buffer-functions-autoloads
suggest-autoloads sudo-edit-autoloads spinner-autoloads
solarized-theme-autoloads s-autoloads rust-mode-autoloads rg-autoloads
rainbow-mode-autoloads pydoc-autoloads protobuf-mode-autoloads
projectile-autoloads pr-review-autoloads posframe-autoloads
popup-autoloads pkg-info-autoloads package-lint-autoloads
org-tree-slide-autoloads orderless-autoloads markdown-mode-autoloads
magit-autoloads lv-autoloads lua-mode-autoloads lsp-pyright-autoloads
lsp-mode-autoloads lsp-haskell-autoloads loop-autoloads llama-autoloads
ligature-autoloads kotlin-mode-autoloads just-mode-autoloads
jsonnet-mode-autoloads jinja2-mode-autoloads ht-autoloads
hl-todo-autoloads haskell-mode-autoloads groovy-mode-autoloads
gptel-autoloads goto-chg-autoloads google-c-style-autoloads
go-mode-autoloads gn-mode-autoloads git-link-autoloads
git-gutter-fringe-autoloads git-gutter-autoloads ghub-autoloads
fringe-helper-autoloads flycheck-posframe-autoloads
flycheck-package-autoloads flycheck-autoloads fish-mode-autoloads
fcitx-autoloads f-autoloads exec-path-from-shell-autoloads
evil-visualstar-autoloads evil-vimish-fold-autoloads
evil-surround-autoloads evil-snipe-autoloads evil-owl-autoloads
evil-commentary-autoloads evil-collection-autoloads evil-autoloads
epl-autoloads epkg-autoloads embark-autoloads emacsql-autoloads
emacs-fringe-scale-autoloads editorconfig-autoloads dumb-jump-autoloads
dtrt-indent-autoloads dockerfile-mode-autoloads
devdocs-browser-autoloads delight-autoloads dash-autoloads
cuda-mode-autoloads corfu-autoloads copilot-autoloads
consult-flycheck-autoloads consult-autoloads compat-autoloads
company-emoji-autoloads company-autoloads cmake-mode-autoloads
closql-autoloads bpftrace-mode-autoloads borg-autoloads bazel-autoloads
rx annalist-autoloads cl-extra help-mode add-node-modules-path-autoloads
cl-seq borg loaddefs-gen generate-lisp-file lisp-mnt radix-tree subr-x
pcase info cl-loaddefs cl-lib bytecomp byte-compile 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
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x
multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 914042 1065405) (symbols 48 49562 0)
 (strings 32 230924 32235) (string-bytes 1 8178630)
 (vectors 16 107518) (vector-slots 8 2649746 403281)
 (floats 8 648 8033) (intervals 56 29932 3912) (buffers 984 39))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26  2:10 bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command Yikai Zhao
@ 2023-07-26  2:30 ` Eli Zaretskii
  2023-07-26 15:50   ` Yikai Zhao
  2023-07-26 18:07   ` Jim Porter
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2023-07-26  2:30 UTC (permalink / raw)
  To: Yikai Zhao; +Cc: 64866

> From: Yikai Zhao <yikai@z1k.dev>
> Date: Wed, 26 Jul 2023 10:10:08 +0800
> 
> 
> After updating to recent master version of emacs, emacsclient would
> block for an extra 2 seconds when some error is raised from command.

That's deliberate: we want to allow the user to see the error message.
It is not a bug.

> Why it affects me:
> 
> I bind some keyboard shortcut globally to a script to move either from
> emacs window or i3wm window. It does something like this:
> 
>    emacsclient -e '(windmove-right)' || i3-msg focus right
> 
> It rely on the behavior that, if I'm currently in the rightmost emacs
> buffer, '(windmove-right)' would return an error and fallback to use
> i3-msg to move to another frame. With this bug I mentioned, it would
> introduce 2-second delay on this action.

I don't think your quite special use case is a reason good enough to
prevent users from seeing error messages.  An error message that
cannot be read is useless.

Sorry.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26  2:30 ` Eli Zaretskii
@ 2023-07-26 15:50   ` Yikai Zhao
  2023-07-26 15:58     ` Eli Zaretskii
  2023-07-26 18:07   ` Jim Porter
  1 sibling, 1 reply; 9+ messages in thread
From: Yikai Zhao @ 2023-07-26 15:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64866

Thanks for your reply.

That's OK, I understand your point. Previously I thought this should
be treated as a bug because in my mind, "emacsclient -e xxxx" is
similar to "emacs --eval=xxx" (and further, similar to "python -c
xxxx"), which is a general interface to evaluate code (but maybe in a
specific environment (the server)). In that case, arbitrarily sleeping
some extra seconds in some valid evaluation scenarios seems
unexpected. Now I can see why that's not the case as the primary
function of emacsclient is to "tell a running Emacs to visit a file".


For any others who may be interested, my use case can be workaround by
using a slightly more complex command:

    RES="$(emacsclient -e "(condition-case nil (progn (windmove-right)
t) (error nil))")"
    if [ "$RES" != "t" ]; then
        return 1
    fi


On Wed, Jul 26, 2023 at 10:29 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Yikai Zhao <yikai@z1k.dev>
> > Date: Wed, 26 Jul 2023 10:10:08 +0800
> >
> >
> > After updating to recent master version of emacs, emacsclient would
> > block for an extra 2 seconds when some error is raised from command.
>
> That's deliberate: we want to allow the user to see the error message.
> It is not a bug.
>
> > Why it affects me:
> >
> > I bind some keyboard shortcut globally to a script to move either from
> > emacs window or i3wm window. It does something like this:
> >
> >    emacsclient -e '(windmove-right)' || i3-msg focus right
> >
> > It rely on the behavior that, if I'm currently in the rightmost emacs
> > buffer, '(windmove-right)' would return an error and fallback to use
> > i3-msg to move to another frame. With this bug I mentioned, it would
> > introduce 2-second delay on this action.
>
> I don't think your quite special use case is a reason good enough to
> prevent users from seeing error messages.  An error message that
> cannot be read is useless.
>
> Sorry.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26 15:50   ` Yikai Zhao
@ 2023-07-26 15:58     ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2023-07-26 15:58 UTC (permalink / raw)
  To: Yikai Zhao; +Cc: 64866-done

> From: Yikai Zhao <yikai@z1k.dev>
> Date: Wed, 26 Jul 2023 23:50:43 +0800
> Cc: 64866@debbugs.gnu.org
> 
> That's OK, I understand your point. Previously I thought this should
> be treated as a bug because in my mind, "emacsclient -e xxxx" is
> similar to "emacs --eval=xxx" (and further, similar to "python -c
> xxxx"), which is a general interface to evaluate code (but maybe in a
> specific environment (the server)). In that case, arbitrarily sleeping
> some extra seconds in some valid evaluation scenarios seems
> unexpected. Now I can see why that's not the case as the primary
> function of emacsclient is to "tell a running Emacs to visit a file".
> 
> 
> For any others who may be interested, my use case can be workaround by
> using a slightly more complex command:
> 
>     RES="$(emacsclient -e "(condition-case nil (progn (windmove-right)
> t) (error nil))")"
>     if [ "$RES" != "t" ]; then
>         return 1
>     fi

Thanks, I'm therefore closing this bug.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26  2:30 ` Eli Zaretskii
  2023-07-26 15:50   ` Yikai Zhao
@ 2023-07-26 18:07   ` Jim Porter
  2023-07-26 18:48     ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Jim Porter @ 2023-07-26 18:07 UTC (permalink / raw)
  To: Eli Zaretskii, Yikai Zhao; +Cc: 64866

On 7/25/2023 7:30 PM, Eli Zaretskii wrote:
> I don't think your quite special use case is a reason good enough to
> prevent users from seeing error messages.  An error message that
> cannot be read is useless.

In this case, the user *can* see the error though: it's printed in the 
terminal that they called `emacsclient -e '(error "oops")'` from. Even 
without the 2 second delay, I don't think there would be any loss of 
information to the user (at least not that I can see).

I've actually seen a related issue come up elsewhere: in our regression 
tests. When testing programmable completion in Eshell, I had to let-bind 
'minibuffer-message-timeout' to 0 to prevent the 2 second delay, which 
occurred even in batch mode. (See 
'em-cmpl-test/variable-ref-completion/directory' in 
"test/lisp/eshell/em-cmpl-tests.el".) I'm not sure why this delay is 
present in batch mode. (Going back to the original bug report, I'd 
consider 'emacsclient -e blah' to be analogous to batch mode.)

Strangely, I tried running this and I still see a 2 second delay:

   emacsclient -e '(let ((minibuffer-message-timeout 0)) (error "oops"))'

I'm not sure why that doesn't work...





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26 18:07   ` Jim Porter
@ 2023-07-26 18:48     ` Eli Zaretskii
  2023-07-26 19:48       ` Jim Porter
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-07-26 18:48 UTC (permalink / raw)
  To: Jim Porter; +Cc: 64866, yikai

> Date: Wed, 26 Jul 2023 11:07:24 -0700
> Cc: 64866@debbugs.gnu.org
> From: Jim Porter <jporterbugs@gmail.com>
> 
> On 7/25/2023 7:30 PM, Eli Zaretskii wrote:
> > I don't think your quite special use case is a reason good enough to
> > prevent users from seeing error messages.  An error message that
> > cannot be read is useless.
> 
> In this case, the user *can* see the error though: it's printed in the 
> terminal that they called `emacsclient -e '(error "oops")'` from.

emacsclient writes the error message to its stderr, but it immediately
exits.  When it exits and the Emacs frame is deleted, if it was a TTY
frame which was displayed on that sane terminal, the message is
deleted because Emacs clears the terminal when it deletes the frame.

I guess your experience is from GUI frames or something?  But even in
that case it is not guaranteed that the error message will be seen,
because emacsclient could be called with -nowait and in background.

So I consider relying on this message as not a good idea, especially
for error messages that usually tell something about the problem.
Imagine the frustration of a user who sees the message flashing, but
cannot read it.

I think the delay that sometimes gets in the way is a small price to
pay for this important feature.

> Strangely, I tried running this and I still see a 2 second delay:
> 
>    emacsclient -e '(let ((minibuffer-message-timeout 0)) (error "oops"))'
> 
> I'm not sure why that doesn't work...

Why did you think it should?  According to its documentation it only
affects minibuffer-message.  The 2-sec delay in the above case is done
by an explicit call to sit-for with a hard-coded argument of 2 sec.
See server-return-error.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26 18:48     ` Eli Zaretskii
@ 2023-07-26 19:48       ` Jim Porter
  2023-07-27  4:48         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Jim Porter @ 2023-07-26 19:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64866, yikai

On 7/26/2023 11:48 AM, Eli Zaretskii wrote:
> emacsclient writes the error message to its stderr, but it immediately
> exits.  When it exits and the Emacs frame is deleted, if it was a TTY
> frame which was displayed on that sane terminal, the message is
> deleted because Emacs clears the terminal when it deletes the frame.
> 
> I guess your experience is from GUI frames or something?  But even in
> that case it is not guaranteed that the error message will be seen,
> because emacsclient could be called with -nowait and in background.

I was testing this without any frames (well, except for the invisible 
daemon frame). I see what you mean, though. Since most uses of 
"emacsclient" involve creating/using an Emacs frame, it makes sense that 
the code would be oriented around that case.

> Why did you think it should?  According to its documentation it only
> affects minibuffer-message.  The 2-sec delay in the above case is done
> by an explicit call to sit-for with a hard-coded argument of 2 sec.
> See server-return-error.

Thanks for the pointer to this code. Looking at it, it doesn't seem easy 
to avoid this delay without causing the problems that you've mentioned.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-26 19:48       ` Jim Porter
@ 2023-07-27  4:48         ` Eli Zaretskii
  2023-07-27  5:34           ` Jim Porter
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-07-27  4:48 UTC (permalink / raw)
  To: Jim Porter; +Cc: 64866, yikai

> Date: Wed, 26 Jul 2023 12:48:38 -0700
> Cc: 64866@debbugs.gnu.org, yikai@z1k.dev
> From: Jim Porter <jporterbugs@gmail.com>
> 
> On 7/26/2023 11:48 AM, Eli Zaretskii wrote:
> > Why did you think it should?  According to its documentation it only
> > affects minibuffer-message.  The 2-sec delay in the above case is done
> > by an explicit call to sit-for with a hard-coded argument of 2 sec.
> > See server-return-error.
> 
> Thanks for the pointer to this code. Looking at it, it doesn't seem easy 
> to avoid this delay without causing the problems that you've mentioned.

Yes, see bug#63629 for the problems that code attempts to solve.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
  2023-07-27  4:48         ` Eli Zaretskii
@ 2023-07-27  5:34           ` Jim Porter
  0 siblings, 0 replies; 9+ messages in thread
From: Jim Porter @ 2023-07-27  5:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64866, yikai

On 7/26/2023 9:48 PM, Eli Zaretskii wrote:
>> Date: Wed, 26 Jul 2023 12:48:38 -0700
>> Cc: 64866@debbugs.gnu.org, yikai@z1k.dev
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> On 7/26/2023 11:48 AM, Eli Zaretskii wrote:
>>> Why did you think it should?  According to its documentation it only
>>> affects minibuffer-message.  The 2-sec delay in the above case is done
>>> by an explicit call to sit-for with a hard-coded argument of 2 sec.
>>> See server-return-error.
>>
>> Thanks for the pointer to this code. Looking at it, it doesn't seem easy
>> to avoid this delay without causing the problems that you've mentioned.
> 
> Yes, see bug#63629 for the problems that code attempts to solve.

Thanks. I'll take a look at that in more detail in the next week or so, 
since at this point I'm just curious as to whether there's a way to get 
the best of both worlds. (At minimum, maybe I can add a regression test.)






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-27  5:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26  2:10 bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command Yikai Zhao
2023-07-26  2:30 ` Eli Zaretskii
2023-07-26 15:50   ` Yikai Zhao
2023-07-26 15:58     ` Eli Zaretskii
2023-07-26 18:07   ` Jim Porter
2023-07-26 18:48     ` Eli Zaretskii
2023-07-26 19:48       ` Jim Porter
2023-07-27  4:48         ` Eli Zaretskii
2023-07-27  5:34           ` Jim Porter

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.