unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
@ 2018-07-16  7:18 Michael Albinus
  2018-07-16 14:34 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Albinus @ 2018-07-16  7:18 UTC (permalink / raw)
  To: 32169


When a thread has died, `thread-last-error' reports the reason. But
there is no possibility to cleanup this last error, which makes it
inconvenient to check for errors in further threads. A function
`cleanup-thread-last-error' or alike would be helpful.

Or this functionality exist already, and I haven't been able to discover.


In GNU Emacs 27.0.50 (build 13, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-14 built on detlef
Repository revision: 155d7303808345dd73427302d9a352ec5461c11a
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04 LTS

Recent messages:
Mark set
Mark saved where search started
Mark set
Mark saved where search started [2 times]
Quit [3 times]
Grep finished with 5 matches found
Current locus from *grep*
Grep finished with 40 matches found
Mark set [2 times]
Current locus from *grep*

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LCMS2

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

Major mode: C/*l

Minor modes in effect:
  diff-auto-refine-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  icomplete-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
/home/albinus/src/elpa/packages/debbugs/debbugs-org hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-org
/home/albinus/src/elpa/packages/debbugs/debbugs-gnu hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-gnu
/home/albinus/src/elpa/packages/debbugs/debbugs hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs
/home/albinus/src/elpa/packages/debbugs/debbugs-autoloads hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-autoloads
/home/albinus/src/elpa/packages/debbugs/debbugs-pkg hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-pkg
/home/albinus/src/elpa/packages/debbugs/debbugs-browse hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-browse
~/lisp/telepathy hides /home/albinus/.emacs.d/elpa/telepathy-20131209.458/telepathy
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-autoloads hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-autoloads
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-pkg hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-pkg
~/src/tramp/lisp/tramp-smb hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-smb
~/src/tramp/lisp/tramp-uu hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-uu
~/src/tramp/lisp/tramp-adb hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-adb
~/src/tramp/lisp/tramp-compat hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-compat
~/src/tramp/lisp/tramp-archive hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-archive
~/src/tramp/lisp/tramp hides /usr/local/share/emacs/27.0.50/lisp/net/tramp
~/src/tramp/lisp/trampver hides /usr/local/share/emacs/27.0.50/lisp/net/trampver
~/src/tramp/lisp/tramp-ftp hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-ftp
~/src/tramp/lisp/tramp-cmds hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-cmds
~/src/tramp/lisp/tramp-gvfs hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-gvfs
~/src/tramp/lisp/tramp-loaddefs hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-loaddefs
~/lisp/dbus hides /usr/local/share/emacs/27.0.50/lisp/net/dbus
~/src/tramp/lisp/tramp-sh hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-sh
~/src/tramp/lisp/tramp-cache hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-cache

Features:
(shadow sort mail-extr warnings emacsbug message rmc puny rfc822 mml
mml-sec epa gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils find-dired grep compile
macrostep-c cmacexp macrostep cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs time-stamp misearch
multi-isearch noutline outline tramp-tests tramp-cmds files-x vc-hg
vc-bzr ert-x ert find-func ewoc debug vc-git diff-mode easy-mmode
bug-reference elec-pair erc-notify erc-networks
erc-desktop-notifications erc-match notifications dbus xml erc-goodies
erc erc-backend erc-compat thingatpt pp erc-loaddefs cperl-mode time
tramp-sh kubernetes-tramp lxc-tramp docker-tramp tramp-cache
vagrant-tramp dash term disp-table ehelp tramp trampver tramp-compat
tramp-loaddefs ucs-normalize shell pcomplete comint ansi-color ring
parse-time format-spec advice ido jka-compr icomplete paren vc
vc-dispatcher dired dired-loaddefs time-date mule-util rx edmacro kmacro
slime-autoloads info finder-inf package let-alist derived pcase cl-extra
help-mode easymenu url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq
byte-opt gv bytecomp byte-compile cconv epg epg-config subr-x
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type 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 elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic 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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 565273 73857)
 (symbols 48 40363 1)
 (miscs 40 117 479)
 (strings 32 79903 4696)
 (string-bytes 1 2431472)
 (vectors 16 59168)
 (vector-slots 8 1758716 193976)
 (floats 8 102 461)
 (intervals 56 3007 99)
 (buffers 992 19))





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16  7:18 bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error Michael Albinus
@ 2018-07-16 14:34 ` Eli Zaretskii
  2018-07-16 14:49   ` Michael Albinus
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-07-16 14:34 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 32169

> From: Michael Albinus <michael.albinus@gmx.de>
> Date: Mon, 16 Jul 2018 09:18:48 +0200
> 
> 
> When a thread has died, `thread-last-error' reports the reason. But
> there is no possibility to cleanup this last error, which makes it
> inconvenient to check for errors in further threads. A function
> `cleanup-thread-last-error' or alike would be helpful.

How about having thread-last-error clear the error as a side effect,
perhaps when called with an optional argument?

(Btw, I'd rather we made error reporting in non-main threads much more
solid than what we have now.)





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16 14:34 ` Eli Zaretskii
@ 2018-07-16 14:49   ` Michael Albinus
  2018-07-16 15:28     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Albinus @ 2018-07-16 14:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32169

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

>> When a thread has died, `thread-last-error' reports the reason. But
>> there is no possibility to cleanup this last error, which makes it
>> inconvenient to check for errors in further threads. A function
>> `cleanup-thread-last-error' or alike would be helpful.
>
> How about having thread-last-error clear the error as a side effect,
> perhaps when called with an optional argument?

I'd be happy with either variant.

> (Btw, I'd rather we made error reporting in non-main threads much more
> solid than what we have now.)

While working on making Tramp threadsafe, I use the following instead of
`signal':

(defsubst tramp-compat-signal (error-symbol data)
  "Signal an error to the main thread."
  (when tramp-compat-main-thread
    (tramp-compat-funcall
     'thread-signal tramp-compat-main-thread error-symbol data))
  (signal error-symbol data))

Works sufficient so far. `tramp-compat-main-thread' is a defconst, which
has as value (car (all-threads)). And `tramp-compat-funcall' is a Tramp
internal macro, good for backward compatibility with Emacs 24 and 25.

Best regards, Michael.

PS: Maybe I shall push this to a git branch, giving people a chance for
early tests. `find-file-noselect' survives already in simple cases, w/o
an Emacs crash.





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16 14:49   ` Michael Albinus
@ 2018-07-16 15:28     ` Eli Zaretskii
  2018-07-16 15:55       ` Michael Albinus
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-07-16 15:28 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 32169

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: 32169@debbugs.gnu.org
> Date: Mon, 16 Jul 2018 16:49:42 +0200
> 
> > How about having thread-last-error clear the error as a side effect,
> > perhaps when called with an optional argument?
> 
> I'd be happy with either variant.

Should be easy to do, I think.

> While working on making Tramp threadsafe, I use the following instead of
> `signal':
> 
> (defsubst tramp-compat-signal (error-symbol data)
>   "Signal an error to the main thread."
>   (when tramp-compat-main-thread
>     (tramp-compat-funcall
>      'thread-signal tramp-compat-main-thread error-symbol data))
>   (signal error-symbol data))
> 
> Works sufficient so far. `tramp-compat-main-thread' is a defconst, which
> has as value (car (all-threads)).

I was certain we had on master a function ti return the main thread,
but I guess I was dreaming.  We could easily add it, though.

In any case, I think it could be a good idea to describe this
technique in the ELisp manual.

> PS: Maybe I shall push this to a git branch, giving people a chance for
> early tests. `find-file-noselect' survives already in simple cases, w/o
> an Emacs crash.

SGTM, thanks.





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16 15:28     ` Eli Zaretskii
@ 2018-07-16 15:55       ` Michael Albinus
  2018-07-16 18:03         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Albinus @ 2018-07-16 15:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32169

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

>> > How about having thread-last-error clear the error as a side effect,
>> > perhaps when called with an optional argument?
>
> Should be easy to do, I think.

[...]

> I was certain we had on master a function ti return the main thread,
> but I guess I was dreaming.  We could easily add it, though.

Do you want to do it, or shall I? I know, you are overloaded ...

master or emacs-26 branch? I believe threads are not used widely, so we
won't break any code with Emacs 26.

> In any case, I think it could be a good idea to describe this
> technique in the ELisp manual.

Will do, once the changes above have arrived.

>> PS: Maybe I shall push this to a git branch, giving people a chance for
>> early tests. `find-file-noselect' survives already in simple cases, w/o
>> an Emacs crash.
>
> SGTM, thanks.

Later this week. Tomorrow, or on Wednesday, I'll be busy with merging
shadowfile.el.

Best regards, Michael.





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16 15:55       ` Michael Albinus
@ 2018-07-16 18:03         ` Eli Zaretskii
  2018-07-16 18:20           ` Michael Albinus
  2018-07-17 10:05           ` Michael Albinus
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2018-07-16 18:03 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 32169

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: 32169@debbugs.gnu.org
> Date: Mon, 16 Jul 2018 17:55:31 +0200
> 
> >> > How about having thread-last-error clear the error as a side effect,
> >> > perhaps when called with an optional argument?
> >
> > Should be easy to do, I think.
> 
> [...]
> 
> > I was certain we had on master a function ti return the main thread,
> > but I guess I was dreaming.  We could easily add it, though.
> 
> Do you want to do it, or shall I? I know, you are overloaded ...

Feel free.

> master or emacs-26 branch? I believe threads are not used widely, so we
> won't break any code with Emacs 26.

That's true, but then no one really waits for those new features, so
maybe master after all.

> > In any case, I think it could be a good idea to describe this
> > technique in the ELisp manual.
> 
> Will do, once the changes above have arrived.
> 
> >> PS: Maybe I shall push this to a git branch, giving people a chance for
> >> early tests. `find-file-noselect' survives already in simple cases, w/o
> >> an Emacs crash.
> >
> > SGTM, thanks.
> 
> Later this week. Tomorrow, or on Wednesday, I'll be busy with merging
> shadowfile.el.

Thanks.





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16 18:03         ` Eli Zaretskii
@ 2018-07-16 18:20           ` Michael Albinus
  2018-07-17 10:05           ` Michael Albinus
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2018-07-16 18:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32169

Eli Zaretskii <eliz@gnu.org> writes:

>> Do you want to do it, or shall I? I know, you are overloaded ...
>
> Feel free.

Will do tomorrow.

>> master or emacs-26 branch? I believe threads are not used widely, so we
>> won't break any code with Emacs 26.
>
> That's true, but then no one really waits for those new features, so
> maybe master after all.

OK. Btw, the changes in Tramp were not intended for Emacs 26. Too heavy.

> Thanks.

Best regards, Michael.





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-16 18:03         ` Eli Zaretskii
  2018-07-16 18:20           ` Michael Albinus
@ 2018-07-17 10:05           ` Michael Albinus
  2018-07-17 15:46             ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Albinus @ 2018-07-17 10:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32169-done

Version 27.1

Eli Zaretskii <eliz@gnu.org> writes:

>> >> > How about having thread-last-error clear the error as a side effect,
>> >> > perhaps when called with an optional argument?
>> >
>> > Should be easy to do, I think.
>> 
>> [...]
>> 
>> > I was certain we had on master a function ti return the main thread,
>> > but I guess I was dreaming.  We could easily add it, though.
>> 
>> Do you want to do it, or shall I? I know, you are overloaded ...
>
> Feel free.

Done.

Best regards, Michael.





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

* bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error
  2018-07-17 10:05           ` Michael Albinus
@ 2018-07-17 15:46             ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2018-07-17 15:46 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 32169

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: 32169-done@debbugs.gnu.org
> Date: Tue, 17 Jul 2018 12:05:47 +0200
> 
> >> > I was certain we had on master a function ti return the main thread,
> >> > but I guess I was dreaming.  We could easily add it, though.
> >> 
> >> Do you want to do it, or shall I? I know, you are overloaded ...
> >
> > Feel free.
> 
> Done.

Thanks.





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

end of thread, other threads:[~2018-07-17 15:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16  7:18 bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error Michael Albinus
2018-07-16 14:34 ` Eli Zaretskii
2018-07-16 14:49   ` Michael Albinus
2018-07-16 15:28     ` Eli Zaretskii
2018-07-16 15:55       ` Michael Albinus
2018-07-16 18:03         ` Eli Zaretskii
2018-07-16 18:20           ` Michael Albinus
2018-07-17 10:05           ` Michael Albinus
2018-07-17 15:46             ` Eli Zaretskii

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).