Merge from origin/emacs-26
17ebb6e
(origin/emacs-26) Use consistent function names in thread-tes...1c86229
Fix format error in Faccept_process_outputb38b91a
Lessen stack consumption in recursive read13eb4603
Match w32 paths in grep sans --null hits (Bug#32051)5cc7c4b
Fix previous make-network-process changed6a1b69
Another documentation improvement in flyspell.el9b49a8e
Improve documentation of Flyspell3744fda
Provide feature 'threadsef9025f
Save the server alias on reconnect (Bug#29657)db3874b
Refer to "proper lists" instead of "true lists"35e0305
Avoid turning on the global-minor-mode recursively51bf4e4
Fix Bug#32085
This commit is contained in:
commit
cda7e1850f
13 changed files with 161 additions and 77 deletions
|
@ -427,11 +427,15 @@ dictionary.
|
|||
@cindex mode, Flyspell
|
||||
@findex flyspell-mode
|
||||
Flyspell mode is a minor mode that performs automatic spell-checking
|
||||
as you type. When it finds a word that it does not recognize, it
|
||||
highlights that word. Type @kbd{M-x flyspell-mode} to toggle Flyspell
|
||||
mode in the current buffer. To enable Flyspell mode in all text mode
|
||||
buffers, add @code{flyspell-mode} to @code{text-mode-hook}.
|
||||
@xref{Hooks}.
|
||||
of the text you type as you type it. When it finds a word that it
|
||||
does not recognize, it highlights that word. Type @kbd{M-x
|
||||
flyspell-mode} to toggle Flyspell mode in the current buffer. To
|
||||
enable Flyspell mode in all text mode buffers, add
|
||||
@code{flyspell-mode} to @code{text-mode-hook}. @xref{Hooks}. Note
|
||||
that, as Flyspell mode needs to check each word across which you move,
|
||||
it will slow down cursor motion and scrolling commands. It also
|
||||
doesn't automatically check the text you didn't type or move across;
|
||||
use @code{flyspell-region} or @code{flyspell-buffer} for that.
|
||||
|
||||
@findex flyspell-correct-word
|
||||
@findex flyspell-auto-correct-word
|
||||
|
|
|
@ -50,16 +50,19 @@ convention; at the level of cons cells, the @sc{car} and @sc{cdr}
|
|||
slots have similar properties). Hence, the @sc{cdr} slot of each cons
|
||||
cell in a list refers to the following cons cell.
|
||||
|
||||
@cindex proper list
|
||||
@cindex true list
|
||||
Also by convention, the @sc{cdr} of the last cons cell in a list is
|
||||
@code{nil}. We call such a @code{nil}-terminated structure a
|
||||
@dfn{true list}. In Emacs Lisp, the symbol @code{nil} is both a
|
||||
symbol and a list with no elements. For convenience, the symbol
|
||||
@code{nil} is considered to have @code{nil} as its @sc{cdr} (and also
|
||||
as its @sc{car}).
|
||||
@dfn{proper list}@footnote{It is sometimes also referred to as a
|
||||
@dfn{true list}, but we generally do not use this terminology in this
|
||||
manual.}. In Emacs Lisp, the symbol @code{nil} is both a symbol and a
|
||||
list with no elements. For convenience, the symbol @code{nil} is
|
||||
considered to have @code{nil} as its @sc{cdr} (and also as its
|
||||
@sc{car}).
|
||||
|
||||
Hence, the @sc{cdr} of a true list is always a true list. The
|
||||
@sc{cdr} of a nonempty true list is a true list containing all the
|
||||
Hence, the @sc{cdr} of a proper list is always a proper list. The
|
||||
@sc{cdr} of a nonempty proper list is a proper list containing all the
|
||||
elements except the first.
|
||||
|
||||
@cindex dotted list
|
||||
|
@ -71,10 +74,10 @@ Pair Notation}). There is one other possibility: some cons cell's
|
|||
@sc{cdr} could point to one of the previous cons cells in the list.
|
||||
We call that structure a @dfn{circular list}.
|
||||
|
||||
For some purposes, it does not matter whether a list is true,
|
||||
For some purposes, it does not matter whether a list is proper,
|
||||
circular or dotted. If a program doesn't look far enough down the
|
||||
list to see the @sc{cdr} of the final cons cell, it won't care.
|
||||
However, some functions that operate on lists demand true lists and
|
||||
However, some functions that operate on lists demand proper lists and
|
||||
signal errors if given a dotted list. Most functions that try to find
|
||||
the end of a list enter infinite loops if given a circular list.
|
||||
|
||||
|
@ -538,7 +541,7 @@ object. The final argument is not copied or converted; it becomes the
|
|||
is itself a list, then its elements become in effect elements of the
|
||||
result list. If the final element is not a list, the result is a
|
||||
dotted list since its final @sc{cdr} is not @code{nil} as required
|
||||
in a true list.
|
||||
in a proper list (@pxref{Cons Cells}).
|
||||
@end defun
|
||||
|
||||
Here is an example of using @code{append}:
|
||||
|
|
|
@ -1355,7 +1355,7 @@ each initialized to @var{object}.
|
|||
@defun vconcat &rest sequences
|
||||
@cindex copying vectors
|
||||
This function returns a new vector containing all the elements of
|
||||
@var{sequences}. The arguments @var{sequences} may be true lists,
|
||||
@var{sequences}. The arguments @var{sequences} may be proper lists,
|
||||
vectors, strings or bool-vectors. If no @var{sequences} are given,
|
||||
the empty vector is returned.
|
||||
|
||||
|
|
|
@ -1094,6 +1094,10 @@ syntax requires a leading volume (share) name, for example:
|
|||
based on standard protocols, such as HTTP@. @option{davs} does the same
|
||||
but with SSL encryption. Both methods support the port numbers.
|
||||
|
||||
Paths being part of the WebDAV volume to be mounted by GVFS, as it is
|
||||
common for OwnCloud or NextCloud file names, are not supported by
|
||||
these methods.
|
||||
|
||||
@item @option{gdrive}
|
||||
@cindex method @option{gdrive}
|
||||
@cindex @option{gdrive} method
|
||||
|
|
|
@ -474,22 +474,26 @@ See `%s' for more information on %s."
|
|||
|
||||
;; The function that calls TURN-ON in each buffer.
|
||||
(defun ,MODE-enable-in-buffers ()
|
||||
(dolist (buf ,MODE-buffers)
|
||||
(when (buffer-live-p buf)
|
||||
(with-current-buffer buf
|
||||
(unless ,MODE-set-explicitly
|
||||
(unless (eq ,MODE-major-mode major-mode)
|
||||
(if ,mode
|
||||
(progn
|
||||
(,mode -1)
|
||||
(funcall #',turn-on))
|
||||
(funcall #',turn-on))))
|
||||
(setq ,MODE-major-mode major-mode)))))
|
||||
(let ((buffers ,MODE-buffers))
|
||||
;; Clear MODE-buffers to avoid scanning the same list of
|
||||
;; buffers in recursive calls to MODE-enable-in-buffers.
|
||||
;; Otherwise it could lead to infinite recursion.
|
||||
(setq ,MODE-buffers nil)
|
||||
(dolist (buf buffers)
|
||||
(when (buffer-live-p buf)
|
||||
(with-current-buffer buf
|
||||
(unless ,MODE-set-explicitly
|
||||
(unless (eq ,MODE-major-mode major-mode)
|
||||
(if ,mode
|
||||
(progn
|
||||
(,mode -1)
|
||||
(funcall #',turn-on))
|
||||
(funcall #',turn-on))))
|
||||
(setq ,MODE-major-mode major-mode))))))
|
||||
(put ',MODE-enable-in-buffers 'definition-name ',global-mode)
|
||||
|
||||
(defun ,MODE-check-buffers ()
|
||||
(,MODE-enable-in-buffers)
|
||||
(setq ,MODE-buffers nil)
|
||||
(remove-hook 'post-command-hook ',MODE-check-buffers))
|
||||
(put ',MODE-check-buffers 'definition-name ',global-mode)
|
||||
|
||||
|
|
|
@ -583,7 +583,7 @@ If ARG is non-nil, instead prompt for connection parameters."
|
|||
|
||||
(setq-local rcirc-connection-info
|
||||
(list server port nick user-name full-name startup-channels
|
||||
password encryption))
|
||||
password encryption server-alias))
|
||||
(setq-local rcirc-process process)
|
||||
(setq-local rcirc-server server)
|
||||
(setq-local rcirc-server-name
|
||||
|
|
|
@ -374,7 +374,9 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
|
|||
;; to handle weird file names (with colons in them) as
|
||||
;; well as possible. E.g., use [1-9][0-9]* rather than
|
||||
;; [0-9]+ so as to accept ":034:" in file names.
|
||||
"\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:"
|
||||
"\\(?1:"
|
||||
"\\(?:[a-zA-Z]:\\)?" ; Allow "C:..." for w32.
|
||||
"[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:"
|
||||
"\\)")
|
||||
1 2
|
||||
;; Calculate column positions (col . end-col) of first grep match on a line
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
;;
|
||||
;; To enable Flyspell in text representing computer programs, type
|
||||
;; M-x flyspell-prog-mode.
|
||||
;; In that mode only text inside comments is checked.
|
||||
;; In that mode only text inside comments and strings is checked.
|
||||
;;
|
||||
;; Some user variables control the behavior of flyspell. They are
|
||||
;; those defined under the `User variables' comment.
|
||||
;; those defined under the `User configuration' comment.
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
@ -137,7 +137,8 @@ This variable specifies how far to search to find such a duplicate.
|
|||
(defcustom flyspell-persistent-highlight t
|
||||
"Non-nil means misspelled words remain highlighted until corrected.
|
||||
If this variable is nil, only the most recently detected misspelled word
|
||||
is highlighted."
|
||||
is highlighted, and the highlight is turned off as soon as point moves
|
||||
off the misspelled word."
|
||||
:group 'flyspell
|
||||
:type 'boolean)
|
||||
|
||||
|
|
|
@ -2715,7 +2715,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
|
|||
int c;
|
||||
bool uninterned_symbol = false;
|
||||
bool multibyte;
|
||||
char stackbuf[MAX_ALLOCA];
|
||||
char stackbuf[128]; /* Small, as read1 is recursive (Bug#31995). */
|
||||
current_thread->stack_top = stackbuf;
|
||||
|
||||
*pch = 0;
|
||||
|
|
|
@ -3905,7 +3905,7 @@ usage: (make-network-process &rest ARGS) */)
|
|||
CHECK_STRING (name);
|
||||
|
||||
/* :local ADDRESS or :remote ADDRESS */
|
||||
if (!NILP (server))
|
||||
if (NILP (server))
|
||||
address = Fplist_get (contact, QCremote);
|
||||
else
|
||||
address = Fplist_get (contact, QClocal);
|
||||
|
@ -4612,12 +4612,11 @@ is nil, from any process) before the timeout expired. */)
|
|||
{
|
||||
Lisp_Object proc_thread_name = XTHREAD (proc->thread)->name;
|
||||
|
||||
if (STRINGP (proc_thread_name))
|
||||
error ("Attempt to accept output from process %s locked to thread %s",
|
||||
SDATA (proc->name), SDATA (proc_thread_name));
|
||||
else
|
||||
error ("Attempt to accept output from process %s locked to thread %p",
|
||||
SDATA (proc->name), XTHREAD (proc->thread));
|
||||
error ("Attempt to accept output from process %s locked to thread %s",
|
||||
SDATA (proc->name),
|
||||
STRINGP (proc_thread_name)
|
||||
? SDATA (proc_thread_name)
|
||||
: SDATA (Fprin1_to_string (proc->thread, Qt)));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1076,6 +1076,8 @@ syms_of_threads (void)
|
|||
|
||||
staticpro (&last_thread_error);
|
||||
last_thread_error = Qnil;
|
||||
|
||||
Fprovide (intern_c_string ("threads"), Qnil);
|
||||
}
|
||||
|
||||
DEFSYM (Qthreadp, "threadp");
|
||||
|
|
|
@ -343,6 +343,29 @@ meaning a range of columns starting on LINE and ending on
|
|||
END-LINE, if that matched. TYPE can be left out, in which case
|
||||
any message type is accepted.")
|
||||
|
||||
(defconst compile-tests--grep-regexp-testcases
|
||||
;; Bug#32051.
|
||||
'(("c:/Users/my.name/src/project\\src\\kbhit.hpp\0\ 29:#include <termios.h>"
|
||||
1 nil 29 "c:/Users/my.name/src/project\\src\\kbhit.hpp")
|
||||
("d:/gnu/emacs/branch/src/callproc.c\0\ 214:#ifdef DOS_NT"
|
||||
1 nil 214 "d:/gnu/emacs/branch/src/callproc.c")
|
||||
("/gnu/emacs/branch/src/callproc.c\0\ 214:#ifdef DOS_NT"
|
||||
1 nil 214 "/gnu/emacs/branch/src/callproc.c"))
|
||||
"List of tests for `grep-regexp-list'.
|
||||
The format is the same as `compile-tests--test-regexps-data', but
|
||||
the match is expected to be the same when NUL bytes are replaced
|
||||
with colon.")
|
||||
|
||||
(defconst compile-tests--grep-regexp-tricky-testcases
|
||||
;; Bug#7378.
|
||||
'(("./x11-libs---nx/3.4.0:0:C.30253.1289557929.792611.C/nx-3.4.0.exheres-0\0\ 42:some text"
|
||||
1 nil 42 "./x11-libs---nx/3.4.0:0:C.30253.1289557929.792611.C/nx-3.4.0.exheres-0")
|
||||
("2011-08-31_11:57:03_1\0\ 7:Date: Wed, 31 Aug 2011 11:57:03 +0000"
|
||||
1 nil 7 "2011-08-31_11:57:03_1"))
|
||||
"List of tricky tests for `grep-regexp-list'.
|
||||
Same as `compile-tests--grep-regexp-testcases', but these cases
|
||||
can only work with the NUL byte to disambiguate colons.")
|
||||
|
||||
(defun compile--test-error-line (test)
|
||||
(erase-buffer)
|
||||
(setq compilation-locs (make-hash-table))
|
||||
|
@ -370,7 +393,8 @@ any message type is accepted.")
|
|||
(should (equal (car (nth 2 (compilation--loc->file-struct loc)))
|
||||
(or end-line line)))
|
||||
(when type
|
||||
(should (equal type (compilation--message->type msg)))))))
|
||||
(should (equal type (compilation--message->type msg)))))
|
||||
msg))
|
||||
|
||||
(ert-deftest compile-test-error-regexps ()
|
||||
"Test the `compilation-error-regexp-alist' regexps.
|
||||
|
@ -379,4 +403,24 @@ The test data is in `compile-tests--test-regexps-data'."
|
|||
(font-lock-mode -1)
|
||||
(mapc #'compile--test-error-line compile-tests--test-regexps-data)))
|
||||
|
||||
(ert-deftest compile-test-grep-regexps ()
|
||||
"Test the `grep-regexp-alist' regexps.
|
||||
The test data is in `compile-tests--grep-regexp-testcases'."
|
||||
(with-temp-buffer
|
||||
(grep-mode)
|
||||
(setq buffer-read-only nil)
|
||||
(font-lock-mode -1)
|
||||
(dolist (testcase compile-tests--grep-regexp-testcases)
|
||||
(let (msg1 msg2)
|
||||
(setq msg1 (ert-info ((format "%S" testcase) :prefix "testcase: ")
|
||||
(compile--test-error-line testcase)))
|
||||
;; Make sure replacing the NUL character with a colon still matches.
|
||||
(setf (car testcase) (replace-regexp-in-string "\0" ":" (car testcase)))
|
||||
(setq msg2 (ert-info ((format "%S" testcase) :prefix "testcase: ")
|
||||
(compile--test-error-line testcase)))
|
||||
(should (equal msg1 msg2))))
|
||||
(dolist (testcase compile-tests--grep-regexp-tricky-testcases)
|
||||
(ert-info ((format "%S" testcase) :prefix "testcase: ")
|
||||
(compile--test-error-line testcase)))))
|
||||
|
||||
;;; compile-tests.el ends here
|
||||
|
|
|
@ -19,36 +19,56 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
;; Declare the functions in case Emacs has been configured --without-threads.
|
||||
(declare-function all-threads "thread.c" ())
|
||||
(declare-function condition-mutex "thread.c" (cond))
|
||||
(declare-function condition-name "thread.c" (cond))
|
||||
(declare-function condition-notify "thread.c" (cond &optional all))
|
||||
(declare-function condition-wait "thread.c" (cond))
|
||||
(declare-function current-thread "thread.c" ())
|
||||
(declare-function make-condition-variable "thread.c" (mutex &optional name))
|
||||
(declare-function make-mutex "thread.c" (&optional name))
|
||||
(declare-function make-thread "thread.c" (function &optional name))
|
||||
(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-join "thread.c" (thread))
|
||||
(declare-function thread-last-error "thread.c" ())
|
||||
(declare-function thread-name "thread.c" (thread))
|
||||
(declare-function thread-signal "thread.c" (thread error-symbol data))
|
||||
(declare-function thread-yield "thread.c" ())
|
||||
|
||||
(ert-deftest threads-is-one ()
|
||||
"Test for existence of a thread."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (current-thread)))
|
||||
|
||||
(ert-deftest threads-threadp ()
|
||||
"Test of threadp."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (threadp (current-thread))))
|
||||
|
||||
(ert-deftest threads-type ()
|
||||
"Test of thread type."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (eq (type-of (current-thread)) 'thread)))
|
||||
|
||||
(ert-deftest threads-name ()
|
||||
"Test for name of a thread."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(string= "hi bob" (thread-name (make-thread #'ignore "hi bob")))))
|
||||
|
||||
(ert-deftest threads-alive ()
|
||||
"Test for thread liveness."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(thread-alive-p (make-thread #'ignore))))
|
||||
|
||||
(ert-deftest threads-all-threads ()
|
||||
"Simple test for all-threads."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (listp (all-threads))))
|
||||
|
||||
(defvar threads-test-global nil)
|
||||
|
@ -58,7 +78,7 @@
|
|||
|
||||
(ert-deftest threads-basic ()
|
||||
"Basic thread test."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(progn
|
||||
(setq threads-test-global nil)
|
||||
|
@ -69,7 +89,7 @@
|
|||
|
||||
(ert-deftest threads-join ()
|
||||
"Test of `thread-join'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(progn
|
||||
(setq threads-test-global nil)
|
||||
|
@ -80,7 +100,7 @@
|
|||
|
||||
(ert-deftest threads-join-self ()
|
||||
"Cannot `thread-join' the current thread."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should-error (thread-join (current-thread))))
|
||||
|
||||
(defvar threads-test-binding nil)
|
||||
|
@ -92,7 +112,7 @@
|
|||
|
||||
(ert-deftest threads-let-binding ()
|
||||
"Simple test of threads and let bindings."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(progn
|
||||
(setq threads-test-global nil)
|
||||
|
@ -104,22 +124,22 @@
|
|||
|
||||
(ert-deftest threads-mutexp ()
|
||||
"Simple test of `mutexp'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should-not (mutexp 'hi)))
|
||||
|
||||
(ert-deftest threads-mutexp-2 ()
|
||||
"Another simple test of `mutexp'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (mutexp (make-mutex))))
|
||||
|
||||
(ert-deftest threads-mutex-type ()
|
||||
"type-of mutex."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (eq (type-of (make-mutex)) 'mutex)))
|
||||
|
||||
(ert-deftest threads-mutex-lock-unlock ()
|
||||
"Test mutex-lock and unlock."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(let ((mx (make-mutex)))
|
||||
(mutex-lock mx)
|
||||
|
@ -128,7 +148,7 @@
|
|||
|
||||
(ert-deftest threads-mutex-recursive ()
|
||||
"Test mutex recursion."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(let ((mx (make-mutex)))
|
||||
(mutex-lock mx)
|
||||
|
@ -149,7 +169,7 @@
|
|||
|
||||
(ert-deftest threads-mutex-contention ()
|
||||
"Test of mutex contention."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(progn
|
||||
(setq threads-mutex (make-mutex))
|
||||
|
@ -170,7 +190,7 @@
|
|||
|
||||
(ert-deftest threads-mutex-signal ()
|
||||
"Test signaling a blocked thread."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(progn
|
||||
(setq threads-mutex (make-mutex))
|
||||
|
@ -188,7 +208,7 @@
|
|||
|
||||
(ert-deftest threads-io-switch ()
|
||||
"Test that `accept-process-output' causes thread switch."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(progn
|
||||
(setq threads-test-global nil)
|
||||
|
@ -199,67 +219,68 @@
|
|||
|
||||
(ert-deftest threads-condvarp ()
|
||||
"Simple test of `condition-variable-p'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should-not (condition-variable-p 'hi)))
|
||||
|
||||
(ert-deftest threads-condvarp-2 ()
|
||||
"Another simple test of `condition-variable-p'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (condition-variable-p (make-condition-variable (make-mutex)))))
|
||||
|
||||
(ert-deftest threads-condvar-type ()
|
||||
"type-of condvar"
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should (eq (type-of (make-condition-variable (make-mutex)))
|
||||
'condition-variable)))
|
||||
|
||||
(ert-deftest threads-condvar-mutex ()
|
||||
"Simple test of `condition-mutex'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(let ((m (make-mutex)))
|
||||
(eq m (condition-mutex (make-condition-variable m))))))
|
||||
|
||||
(ert-deftest threads-condvar-name ()
|
||||
"Simple test of `condition-name'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(eq nil (condition-name (make-condition-variable (make-mutex))))))
|
||||
|
||||
(ert-deftest threads-condvar-name-2 ()
|
||||
"Another simple test of `condition-name'."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(should
|
||||
(string= "hi bob"
|
||||
(condition-name (make-condition-variable (make-mutex)
|
||||
"hi bob")))))
|
||||
(defun call-error ()
|
||||
|
||||
(defun threads-call-error ()
|
||||
"Call `error'."
|
||||
(error "Error is called"))
|
||||
|
||||
;; This signals an error internally; the error should be caught.
|
||||
(defun thread-custom ()
|
||||
(defcustom thread-custom-face 'highlight
|
||||
(defun threads-custom ()
|
||||
(defcustom threads-custom-face 'highlight
|
||||
"Face used for thread customizations."
|
||||
:type 'face
|
||||
:group 'widget-faces))
|
||||
|
||||
(ert-deftest thread-errors ()
|
||||
(ert-deftest threads-errors ()
|
||||
"Test what happens when a thread signals an error."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(let (th1 th2)
|
||||
(setq th1 (make-thread #'call-error "call-error"))
|
||||
(setq th1 (make-thread #'threads-call-error "call-error"))
|
||||
(should (threadp th1))
|
||||
(while (thread-alive-p th1)
|
||||
(thread-yield))
|
||||
(should (equal (thread-last-error)
|
||||
'(error "Error is called")))
|
||||
(setq th2 (make-thread #'thread-custom "thread-custom"))
|
||||
(setq th2 (make-thread #'threads-custom "threads-custom"))
|
||||
(should (threadp th2))))
|
||||
|
||||
(ert-deftest thread-sticky-point ()
|
||||
(ert-deftest threads-sticky-point ()
|
||||
"Test bug #25165 with point movement in cloned buffer."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(with-temp-buffer
|
||||
(insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
|
||||
(goto-char (point-min))
|
||||
|
@ -268,9 +289,9 @@
|
|||
(sit-for 1)
|
||||
(should (= (point) 21))))
|
||||
|
||||
(ert-deftest thread-signal-early ()
|
||||
(ert-deftest threads-signal-early ()
|
||||
"Test signaling a thread as soon as it is started by the OS."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(let ((thread
|
||||
(make-thread #'(lambda ()
|
||||
(while t (thread-yield))))))
|
||||
|
@ -291,7 +312,7 @@
|
|||
|
||||
(ert-deftest threads-condvar-wait ()
|
||||
"Test waiting on conditional variable."
|
||||
(skip-unless (fboundp 'make-thread))
|
||||
(skip-unless (featurep 'threads))
|
||||
(let ((cv-mutex (make-mutex))
|
||||
new-thread)
|
||||
;; We could have spurious threads from the previous tests still
|
||||
|
|
Loading…
Add table
Reference in a new issue