mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-08 08:43:52 -08:00
Merge from origin/emacs-26
ac7936cb8fRename thread-alive-p to thread-live-p3d09d533d1rcirc: Document /reconnect as a built-in command (Bug#29656)a1e615618d* test/lisp/calc/calc-tests.el (calc-imaginary-i): New test.
This commit is contained in:
commit
6f3cf12e4f
6 changed files with 48 additions and 59 deletions
|
|
@ -100,7 +100,7 @@ Yield execution to the next runnable thread.
|
|||
Return the name of @var{thread}, as specified to @code{make-thread}.
|
||||
@end defun
|
||||
|
||||
@defun thread-alive-p thread
|
||||
@defun thread-live-p thread
|
||||
Return @code{t} if @var{thread} is alive, or @code{nil} if it is not.
|
||||
A thread is alive as long as its function is still executing.
|
||||
@end defun
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ Hacking and Tweaking
|
|||
* Scrolling conservatively::
|
||||
* Changing the time stamp format::
|
||||
* Defining a new command::
|
||||
* Reconnecting after you have lost the connection::
|
||||
|
||||
@end detailmenu
|
||||
@end menu
|
||||
|
|
@ -401,6 +400,23 @@ This disconnects from the server and parts all channels. You can
|
|||
optionally provide a reason for quitting. When you kill the server
|
||||
buffer, you automatically quit the server and part all channels. (Also
|
||||
@code{/quit ZZZzzz...}.)
|
||||
|
||||
@item /reconnect
|
||||
@cindex /reconnect
|
||||
@cindex reconnect
|
||||
@cindex lost connection
|
||||
@cindex disconnecting servers, reconnecting
|
||||
This reconnects after you have lost the connection.
|
||||
|
||||
If you're chatting from a laptop, then you might be familiar with this
|
||||
problem: When your laptop falls asleep and wakes up later, your IRC
|
||||
client doesn't realize that it has been disconnected. It takes several
|
||||
minutes until the client decides that the connection has in fact been
|
||||
lost. The simple solution is to use @kbd{M-x rcirc}. The problem is
|
||||
that this opens an @emph{additional} connection, so you'll have two
|
||||
copies of every channel buffer, one dead and one live.
|
||||
|
||||
The real answer, therefore, is the @code{/reconnect} command.
|
||||
@end table
|
||||
|
||||
@node Useful IRC commands
|
||||
|
|
@ -787,7 +803,6 @@ Here are some examples of stuff you can do to configure @code{rcirc}.
|
|||
* Scrolling conservatively::
|
||||
* Changing the time stamp format::
|
||||
* Defining a new command::
|
||||
* Reconnecting after you have lost the connection::
|
||||
@end menu
|
||||
|
||||
@node Skipping /away messages using handlers
|
||||
|
|
@ -888,47 +903,6 @@ because @code{defun-rcirc-command} is not yet available, and without
|
|||
(concat "I use " rcirc-id-string))))
|
||||
@end smallexample
|
||||
|
||||
@node Reconnecting after you have lost the connection
|
||||
@section Reconnecting after you have lost the connection
|
||||
@cindex reconnecting
|
||||
@cindex disconnecting servers, reconnecting
|
||||
|
||||
If you're chatting from a laptop, then you might be familiar with this
|
||||
problem: When your laptop falls asleep and wakes up later, your IRC
|
||||
client doesn't realize that it has been disconnected. It takes several
|
||||
minutes until the client decides that the connection has in fact been
|
||||
lost. The simple solution is to use @kbd{M-x rcirc}. The problem is
|
||||
that this opens an @emph{additional} connection, so you'll have two
|
||||
copies of every channel buffer, one dead and one live.
|
||||
|
||||
The real answer, therefore, is a @code{/reconnect} command:
|
||||
|
||||
@smallexample
|
||||
(with-eval-after-load 'rcirc
|
||||
(defun-rcirc-command reconnect (arg)
|
||||
"Reconnect the server process."
|
||||
(interactive "i")
|
||||
(unless process
|
||||
(error "There's no process for this target"))
|
||||
(let* ((server (car (process-contact process)))
|
||||
(port (process-contact process :service))
|
||||
(nick (rcirc-nick process))
|
||||
channels query-buffers)
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(when (eq process (rcirc-buffer-process))
|
||||
(remove-hook 'change-major-mode-hook
|
||||
'rcirc-change-major-mode-hook)
|
||||
(if (rcirc-channel-p rcirc-target)
|
||||
(setq channels (cons rcirc-target channels))
|
||||
(setq query-buffers (cons buf query-buffers))))))
|
||||
(delete-process process)
|
||||
(rcirc-connect server port nick
|
||||
rcirc-default-user-name
|
||||
rcirc-default-full-name
|
||||
channels))))
|
||||
@end smallexample
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
|
|
|||
|
|
@ -99,6 +99,11 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'.
|
|||
Existing files "~/.emacs.d/shadows" and "~/.emacs.d/shadow_todo" must
|
||||
be removed prior using the changed 'shadow-*' commands.
|
||||
|
||||
+++
|
||||
** 'thread-alive-p' has been renamed to 'thread-live-p'.
|
||||
The old name is an alias of the new name. Future Emacs version will
|
||||
obsolete it.
|
||||
|
||||
|
||||
* Lisp Changes in Emacs 26.2
|
||||
|
||||
|
|
|
|||
17
src/thread.c
17
src/thread.c
|
|
@ -41,7 +41,7 @@ extern volatile int interrupt_input_blocked;
|
|||
|
||||
/* m_specpdl is set when the thread is created and cleared when the
|
||||
thread dies. */
|
||||
#define thread_alive_p(STATE) ((STATE)->m_specpdl != NULL)
|
||||
#define thread_live_p(STATE) ((STATE)->m_specpdl != NULL)
|
||||
|
||||
|
||||
|
||||
|
|
@ -904,7 +904,7 @@ If THREAD is the main thread, just the error message is shown. */)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
DEFUN ("thread-alive-p", Fthread_alive_p, Sthread_alive_p, 1, 1, 0,
|
||||
DEFUN ("thread-live-p", Fthread_live_p, Sthread_live_p, 1, 1, 0,
|
||||
doc: /* Return t if THREAD is alive, or nil if it has exited. */)
|
||||
(Lisp_Object thread)
|
||||
{
|
||||
|
|
@ -913,7 +913,7 @@ DEFUN ("thread-alive-p", Fthread_alive_p, Sthread_alive_p, 1, 1, 0,
|
|||
CHECK_THREAD (thread);
|
||||
tstate = XTHREAD (thread);
|
||||
|
||||
return thread_alive_p (tstate) ? Qt : Qnil;
|
||||
return thread_live_p (tstate) ? Qt : Qnil;
|
||||
}
|
||||
|
||||
DEFUN ("thread--blocker", Fthread_blocker, Sthread_blocker, 1, 1, 0,
|
||||
|
|
@ -943,7 +943,7 @@ thread_join_callback (void *arg)
|
|||
XSETTHREAD (thread, tstate);
|
||||
self->event_object = thread;
|
||||
self->wait_condvar = &tstate->thread_condvar;
|
||||
while (thread_alive_p (tstate) && NILP (self->error_symbol))
|
||||
while (thread_live_p (tstate) && NILP (self->error_symbol))
|
||||
sys_cond_wait (self->wait_condvar, &global_lock);
|
||||
|
||||
self->wait_condvar = NULL;
|
||||
|
|
@ -970,7 +970,7 @@ is an error for a thread to try to join itself. */)
|
|||
error_symbol = tstate->error_symbol;
|
||||
error_data = tstate->error_data;
|
||||
|
||||
if (thread_alive_p (tstate))
|
||||
if (thread_live_p (tstate))
|
||||
flush_stack_call_func (thread_join_callback, tstate);
|
||||
|
||||
if (!NILP (error_symbol))
|
||||
|
|
@ -988,7 +988,7 @@ DEFUN ("all-threads", Fall_threads, Sall_threads, 0, 0, 0,
|
|||
|
||||
for (iter = all_threads; iter; iter = iter->next_thread)
|
||||
{
|
||||
if (thread_alive_p (iter))
|
||||
if (thread_live_p (iter))
|
||||
{
|
||||
Lisp_Object thread;
|
||||
|
||||
|
|
@ -1093,7 +1093,7 @@ syms_of_threads (void)
|
|||
defsubr (&Scurrent_thread);
|
||||
defsubr (&Sthread_name);
|
||||
defsubr (&Sthread_signal);
|
||||
defsubr (&Sthread_alive_p);
|
||||
defsubr (&Sthread_live_p);
|
||||
defsubr (&Sthread_join);
|
||||
defsubr (&Sthread_blocker);
|
||||
defsubr (&Sall_threads);
|
||||
|
|
@ -1111,6 +1111,9 @@ syms_of_threads (void)
|
|||
staticpro (&last_thread_error);
|
||||
last_thread_error = Qnil;
|
||||
|
||||
Fdefalias (intern_c_string ("thread-alive-p"),
|
||||
intern_c_string ("thread-live-p"), Qnil);
|
||||
|
||||
Fprovide (intern_c_string ("threads"), Qnil);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,13 @@ An existing calc stack is reused, otherwise a new one is created."
|
|||
(math-read-expr "1m") "cm")
|
||||
'(* -100 (var cm var-cm)))))
|
||||
|
||||
(ert-deftest calc-imaginary-i ()
|
||||
"Test `math-imaginary-i' for non-special-const values."
|
||||
(let ((var-i (calcFunc-polar (calcFunc-sqrt -1))))
|
||||
(should (math-imaginary-i)))
|
||||
(let ((var-i (calcFunc-sqrt -1)))
|
||||
(should (math-imaginary-i))))
|
||||
|
||||
(ert-deftest test-calc-23889 ()
|
||||
"Test for https://debbugs.gnu.org/23889 and 25652."
|
||||
(skip-unless (>= math-bignum-digit-length 9))
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
(declare-function mutex-lock "thread.c" (mutex))
|
||||
(declare-function mutex-unlock "thread.c" (mutex))
|
||||
(declare-function thread--blocker "thread.c" (thread))
|
||||
(declare-function thread-alive-p "thread.c" (thread))
|
||||
(declare-function thread-live-p "thread.c" (thread))
|
||||
(declare-function thread-join "thread.c" (thread))
|
||||
(declare-function thread-last-error "thread.c" (&optional cleanup))
|
||||
(declare-function thread-name "thread.c" (thread))
|
||||
|
|
@ -63,11 +63,11 @@
|
|||
(should
|
||||
(string= "hi bob" (thread-name (make-thread #'ignore "hi bob")))))
|
||||
|
||||
(ert-deftest threads-alive ()
|
||||
(ert-deftest threads-live ()
|
||||
"Test for thread liveness."
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(thread-alive-p (make-thread #'ignore))))
|
||||
(thread-live-p (make-thread #'ignore))))
|
||||
|
||||
(ert-deftest threads-all-threads ()
|
||||
"Simple test for all-threads."
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
(let ((thread (make-thread #'threads-test-thread1)))
|
||||
(and (= (thread-join thread) 23)
|
||||
(= threads-test-global 23)
|
||||
(not (thread-alive-p thread)))))))
|
||||
(not (thread-live-p thread)))))))
|
||||
|
||||
(ert-deftest threads-join-self ()
|
||||
"Cannot `thread-join' the current thread."
|
||||
|
|
@ -290,7 +290,7 @@
|
|||
(let (th1 th2)
|
||||
(setq th1 (make-thread #'threads-call-error "call-error"))
|
||||
(should (threadp th1))
|
||||
(while (thread-alive-p th1)
|
||||
(while (thread-live-p th1)
|
||||
(thread-yield))
|
||||
(should (equal (thread-last-error)
|
||||
'(error "Error is called")))
|
||||
|
|
@ -319,7 +319,7 @@
|
|||
(while t (thread-yield))))))
|
||||
(thread-signal thread 'error nil)
|
||||
(sit-for 1)
|
||||
(should-not (thread-alive-p thread))
|
||||
(should-not (thread-live-p thread))
|
||||
(should (equal (thread-last-error) '(error)))))
|
||||
|
||||
(ert-deftest threads-signal-main-thread ()
|
||||
|
|
@ -364,7 +364,7 @@
|
|||
(setq new-thread (make-thread #'threads-test-condvar-wait))
|
||||
|
||||
;; Make sure new-thread is alive.
|
||||
(should (thread-alive-p new-thread))
|
||||
(should (thread-live-p new-thread))
|
||||
(should (= (length (all-threads)) 2))
|
||||
;; Wait for new-thread to become blocked on the condvar.
|
||||
(while (not (eq (thread--blocker new-thread) threads-condvar))
|
||||
|
|
@ -377,7 +377,7 @@
|
|||
(sleep-for 0.1)
|
||||
;; Make sure the thread is still there. This used to fail due to
|
||||
;; a bug in thread.c:condition_wait_callback.
|
||||
(should (thread-alive-p new-thread))
|
||||
(should (thread-live-p new-thread))
|
||||
(should (= (length (all-threads)) 2))
|
||||
(should (eq (thread--blocker new-thread) threads-condvar))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue