diff options
| author | Glenn Morris | 2018-07-13 09:28:15 -0700 |
|---|---|---|
| committer | Glenn Morris | 2018-07-13 09:28:15 -0700 |
| commit | cda7e1850f2f19a5025fd163ff2c6c6cba275acf (patch) | |
| tree | 1fdb0014a632e936da813128ead6353051436cbd | |
| parent | 1013e0392b78ee0e2199fb51859dc9e939315f9b (diff) | |
| parent | 17ebb6e5ae9cdd2586d1b4d6f2347ae09c6f653f (diff) | |
| download | emacs-cda7e1850f2f19a5025fd163ff2c6c6cba275acf.tar.gz emacs-cda7e1850f2f19a5025fd163ff2c6c6cba275acf.zip | |
Merge from origin/emacs-26
17ebb6e (origin/emacs-26) Use consistent function names in thread-tes...
1c86229 Fix format error in Faccept_process_output
b38b91a Lessen stack consumption in recursive read1
3eb4603 Match w32 paths in grep sans --null hits (Bug#32051)
5cc7c4b Fix previous make-network-process change
d6a1b69 Another documentation improvement in flyspell.el
9b49a8e Improve documentation of Flyspell
3744fda Provide feature 'threads
ef9025f 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 recursively
51bf4e4 Fix Bug#32085
| -rw-r--r-- | doc/emacs/fixit.texi | 14 | ||||
| -rw-r--r-- | doc/lispref/lists.texi | 23 | ||||
| -rw-r--r-- | doc/lispref/sequences.texi | 2 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 28 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 4 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 7 | ||||
| -rw-r--r-- | src/lread.c | 2 | ||||
| -rw-r--r-- | src/process.c | 13 | ||||
| -rw-r--r-- | src/thread.c | 2 | ||||
| -rw-r--r-- | test/lisp/progmodes/compile-tests.el | 46 | ||||
| -rw-r--r-- | test/src/thread-tests.el | 93 |
13 files changed, 162 insertions, 78 deletions
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index ec26a35d682..8277278f521 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi | |||
| @@ -427,11 +427,15 @@ dictionary. | |||
| 427 | @cindex mode, Flyspell | 427 | @cindex mode, Flyspell |
| 428 | @findex flyspell-mode | 428 | @findex flyspell-mode |
| 429 | Flyspell mode is a minor mode that performs automatic spell-checking | 429 | Flyspell mode is a minor mode that performs automatic spell-checking |
| 430 | as you type. When it finds a word that it does not recognize, it | 430 | of the text you type as you type it. When it finds a word that it |
| 431 | highlights that word. Type @kbd{M-x flyspell-mode} to toggle Flyspell | 431 | does not recognize, it highlights that word. Type @kbd{M-x |
| 432 | mode in the current buffer. To enable Flyspell mode in all text mode | 432 | flyspell-mode} to toggle Flyspell mode in the current buffer. To |
| 433 | buffers, add @code{flyspell-mode} to @code{text-mode-hook}. | 433 | enable Flyspell mode in all text mode buffers, add |
| 434 | @xref{Hooks}. | 434 | @code{flyspell-mode} to @code{text-mode-hook}. @xref{Hooks}. Note |
| 435 | that, as Flyspell mode needs to check each word across which you move, | ||
| 436 | it will slow down cursor motion and scrolling commands. It also | ||
| 437 | doesn't automatically check the text you didn't type or move across; | ||
| 438 | use @code{flyspell-region} or @code{flyspell-buffer} for that. | ||
| 435 | 439 | ||
| 436 | @findex flyspell-correct-word | 440 | @findex flyspell-correct-word |
| 437 | @findex flyspell-auto-correct-word | 441 | @findex flyspell-auto-correct-word |
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 57cefeac962..b7bb3cf6be1 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi | |||
| @@ -50,16 +50,19 @@ convention; at the level of cons cells, the @sc{car} and @sc{cdr} | |||
| 50 | slots have similar properties). Hence, the @sc{cdr} slot of each cons | 50 | slots have similar properties). Hence, the @sc{cdr} slot of each cons |
| 51 | cell in a list refers to the following cons cell. | 51 | cell in a list refers to the following cons cell. |
| 52 | 52 | ||
| 53 | @cindex proper list | ||
| 53 | @cindex true list | 54 | @cindex true list |
| 54 | Also by convention, the @sc{cdr} of the last cons cell in a list is | 55 | Also by convention, the @sc{cdr} of the last cons cell in a list is |
| 55 | @code{nil}. We call such a @code{nil}-terminated structure a | 56 | @code{nil}. We call such a @code{nil}-terminated structure a |
| 56 | @dfn{true list}. In Emacs Lisp, the symbol @code{nil} is both a | 57 | @dfn{proper list}@footnote{It is sometimes also referred to as a |
| 57 | symbol and a list with no elements. For convenience, the symbol | 58 | @dfn{true list}, but we generally do not use this terminology in this |
| 58 | @code{nil} is considered to have @code{nil} as its @sc{cdr} (and also | 59 | manual.}. In Emacs Lisp, the symbol @code{nil} is both a symbol and a |
| 59 | as its @sc{car}). | 60 | list with no elements. For convenience, the symbol @code{nil} is |
| 60 | 61 | considered to have @code{nil} as its @sc{cdr} (and also as its | |
| 61 | Hence, the @sc{cdr} of a true list is always a true list. The | 62 | @sc{car}). |
| 62 | @sc{cdr} of a nonempty true list is a true list containing all the | 63 | |
| 64 | Hence, the @sc{cdr} of a proper list is always a proper list. The | ||
| 65 | @sc{cdr} of a nonempty proper list is a proper list containing all the | ||
| 63 | elements except the first. | 66 | elements except the first. |
| 64 | 67 | ||
| 65 | @cindex dotted list | 68 | @cindex dotted list |
| @@ -71,10 +74,10 @@ Pair Notation}). There is one other possibility: some cons cell's | |||
| 71 | @sc{cdr} could point to one of the previous cons cells in the list. | 74 | @sc{cdr} could point to one of the previous cons cells in the list. |
| 72 | We call that structure a @dfn{circular list}. | 75 | We call that structure a @dfn{circular list}. |
| 73 | 76 | ||
| 74 | For some purposes, it does not matter whether a list is true, | 77 | For some purposes, it does not matter whether a list is proper, |
| 75 | circular or dotted. If a program doesn't look far enough down the | 78 | circular or dotted. If a program doesn't look far enough down the |
| 76 | list to see the @sc{cdr} of the final cons cell, it won't care. | 79 | list to see the @sc{cdr} of the final cons cell, it won't care. |
| 77 | However, some functions that operate on lists demand true lists and | 80 | However, some functions that operate on lists demand proper lists and |
| 78 | signal errors if given a dotted list. Most functions that try to find | 81 | signal errors if given a dotted list. Most functions that try to find |
| 79 | the end of a list enter infinite loops if given a circular list. | 82 | the end of a list enter infinite loops if given a circular list. |
| 80 | 83 | ||
| @@ -538,7 +541,7 @@ object. The final argument is not copied or converted; it becomes the | |||
| 538 | is itself a list, then its elements become in effect elements of the | 541 | is itself a list, then its elements become in effect elements of the |
| 539 | result list. If the final element is not a list, the result is a | 542 | result list. If the final element is not a list, the result is a |
| 540 | dotted list since its final @sc{cdr} is not @code{nil} as required | 543 | dotted list since its final @sc{cdr} is not @code{nil} as required |
| 541 | in a true list. | 544 | in a proper list (@pxref{Cons Cells}). |
| 542 | @end defun | 545 | @end defun |
| 543 | 546 | ||
| 544 | Here is an example of using @code{append}: | 547 | Here is an example of using @code{append}: |
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index b98889eb099..be7a4020625 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -1355,7 +1355,7 @@ each initialized to @var{object}. | |||
| 1355 | @defun vconcat &rest sequences | 1355 | @defun vconcat &rest sequences |
| 1356 | @cindex copying vectors | 1356 | @cindex copying vectors |
| 1357 | This function returns a new vector containing all the elements of | 1357 | This function returns a new vector containing all the elements of |
| 1358 | @var{sequences}. The arguments @var{sequences} may be true lists, | 1358 | @var{sequences}. The arguments @var{sequences} may be proper lists, |
| 1359 | vectors, strings or bool-vectors. If no @var{sequences} are given, | 1359 | vectors, strings or bool-vectors. If no @var{sequences} are given, |
| 1360 | the empty vector is returned. | 1360 | the empty vector is returned. |
| 1361 | 1361 | ||
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index d8f4b41e2f2..f2d7786940f 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -1094,6 +1094,10 @@ syntax requires a leading volume (share) name, for example: | |||
| 1094 | based on standard protocols, such as HTTP@. @option{davs} does the same | 1094 | based on standard protocols, such as HTTP@. @option{davs} does the same |
| 1095 | but with SSL encryption. Both methods support the port numbers. | 1095 | but with SSL encryption. Both methods support the port numbers. |
| 1096 | 1096 | ||
| 1097 | Paths being part of the WebDAV volume to be mounted by GVFS, as it is | ||
| 1098 | common for OwnCloud or NextCloud file names, are not supported by | ||
| 1099 | these methods. | ||
| 1100 | |||
| 1097 | @item @option{gdrive} | 1101 | @item @option{gdrive} |
| 1098 | @cindex method @option{gdrive} | 1102 | @cindex method @option{gdrive} |
| 1099 | @cindex @option{gdrive} method | 1103 | @cindex @option{gdrive} method |
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index b83b53a8e52..4d8a5020267 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -474,22 +474,26 @@ See `%s' for more information on %s." | |||
| 474 | 474 | ||
| 475 | ;; The function that calls TURN-ON in each buffer. | 475 | ;; The function that calls TURN-ON in each buffer. |
| 476 | (defun ,MODE-enable-in-buffers () | 476 | (defun ,MODE-enable-in-buffers () |
| 477 | (dolist (buf ,MODE-buffers) | 477 | (let ((buffers ,MODE-buffers)) |
| 478 | (when (buffer-live-p buf) | 478 | ;; Clear MODE-buffers to avoid scanning the same list of |
| 479 | (with-current-buffer buf | 479 | ;; buffers in recursive calls to MODE-enable-in-buffers. |
| 480 | (unless ,MODE-set-explicitly | 480 | ;; Otherwise it could lead to infinite recursion. |
| 481 | (unless (eq ,MODE-major-mode major-mode) | 481 | (setq ,MODE-buffers nil) |
| 482 | (if ,mode | 482 | (dolist (buf buffers) |
| 483 | (progn | 483 | (when (buffer-live-p buf) |
| 484 | (,mode -1) | 484 | (with-current-buffer buf |
| 485 | (funcall #',turn-on)) | 485 | (unless ,MODE-set-explicitly |
| 486 | (funcall #',turn-on)))) | 486 | (unless (eq ,MODE-major-mode major-mode) |
| 487 | (setq ,MODE-major-mode major-mode))))) | 487 | (if ,mode |
| 488 | (progn | ||
| 489 | (,mode -1) | ||
| 490 | (funcall #',turn-on)) | ||
| 491 | (funcall #',turn-on)))) | ||
| 492 | (setq ,MODE-major-mode major-mode)))))) | ||
| 488 | (put ',MODE-enable-in-buffers 'definition-name ',global-mode) | 493 | (put ',MODE-enable-in-buffers 'definition-name ',global-mode) |
| 489 | 494 | ||
| 490 | (defun ,MODE-check-buffers () | 495 | (defun ,MODE-check-buffers () |
| 491 | (,MODE-enable-in-buffers) | 496 | (,MODE-enable-in-buffers) |
| 492 | (setq ,MODE-buffers nil) | ||
| 493 | (remove-hook 'post-command-hook ',MODE-check-buffers)) | 497 | (remove-hook 'post-command-hook ',MODE-check-buffers)) |
| 494 | (put ',MODE-check-buffers 'definition-name ',global-mode) | 498 | (put ',MODE-check-buffers 'definition-name ',global-mode) |
| 495 | 499 | ||
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 5b63e0c34df..108e368373f 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -583,7 +583,7 @@ If ARG is non-nil, instead prompt for connection parameters." | |||
| 583 | 583 | ||
| 584 | (setq-local rcirc-connection-info | 584 | (setq-local rcirc-connection-info |
| 585 | (list server port nick user-name full-name startup-channels | 585 | (list server port nick user-name full-name startup-channels |
| 586 | password encryption)) | 586 | password encryption server-alias)) |
| 587 | (setq-local rcirc-process process) | 587 | (setq-local rcirc-process process) |
| 588 | (setq-local rcirc-server server) | 588 | (setq-local rcirc-server server) |
| 589 | (setq-local rcirc-server-name | 589 | (setq-local rcirc-server-name |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 519b768ab40..0ededb1b155 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -374,7 +374,9 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies | |||
| 374 | ;; to handle weird file names (with colons in them) as | 374 | ;; to handle weird file names (with colons in them) as |
| 375 | ;; well as possible. E.g., use [1-9][0-9]* rather than | 375 | ;; well as possible. E.g., use [1-9][0-9]* rather than |
| 376 | ;; [0-9]+ so as to accept ":034:" in file names. | 376 | ;; [0-9]+ so as to accept ":034:" in file names. |
| 377 | "\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:" | 377 | "\\(?1:" |
| 378 | "\\(?:[a-zA-Z]:\\)?" ; Allow "C:..." for w32. | ||
| 379 | "[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:" | ||
| 378 | "\\)") | 380 | "\\)") |
| 379 | 1 2 | 381 | 1 2 |
| 380 | ;; Calculate column positions (col . end-col) of first grep match on a line | 382 | ;; Calculate column positions (col . end-col) of first grep match on a line |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 8ad6832880a..4d5b11cca89 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -31,10 +31,10 @@ | |||
| 31 | ;; | 31 | ;; |
| 32 | ;; To enable Flyspell in text representing computer programs, type | 32 | ;; To enable Flyspell in text representing computer programs, type |
| 33 | ;; M-x flyspell-prog-mode. | 33 | ;; M-x flyspell-prog-mode. |
| 34 | ;; In that mode only text inside comments is checked. | 34 | ;; In that mode only text inside comments and strings is checked. |
| 35 | ;; | 35 | ;; |
| 36 | ;; Some user variables control the behavior of flyspell. They are | 36 | ;; Some user variables control the behavior of flyspell. They are |
| 37 | ;; those defined under the `User variables' comment. | 37 | ;; those defined under the `User configuration' comment. |
| 38 | 38 | ||
| 39 | ;;; Code: | 39 | ;;; Code: |
| 40 | 40 | ||
| @@ -137,7 +137,8 @@ This variable specifies how far to search to find such a duplicate. | |||
| 137 | (defcustom flyspell-persistent-highlight t | 137 | (defcustom flyspell-persistent-highlight t |
| 138 | "Non-nil means misspelled words remain highlighted until corrected. | 138 | "Non-nil means misspelled words remain highlighted until corrected. |
| 139 | If this variable is nil, only the most recently detected misspelled word | 139 | If this variable is nil, only the most recently detected misspelled word |
| 140 | is highlighted." | 140 | is highlighted, and the highlight is turned off as soon as point moves |
| 141 | off the misspelled word." | ||
| 141 | :group 'flyspell | 142 | :group 'flyspell |
| 142 | :type 'boolean) | 143 | :type 'boolean) |
| 143 | 144 | ||
diff --git a/src/lread.c b/src/lread.c index d4e5be21b4b..4ce6a442c36 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2715,7 +2715,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2715 | int c; | 2715 | int c; |
| 2716 | bool uninterned_symbol = false; | 2716 | bool uninterned_symbol = false; |
| 2717 | bool multibyte; | 2717 | bool multibyte; |
| 2718 | char stackbuf[MAX_ALLOCA]; | 2718 | char stackbuf[128]; /* Small, as read1 is recursive (Bug#31995). */ |
| 2719 | current_thread->stack_top = stackbuf; | 2719 | current_thread->stack_top = stackbuf; |
| 2720 | 2720 | ||
| 2721 | *pch = 0; | 2721 | *pch = 0; |
diff --git a/src/process.c b/src/process.c index 5bd8c255a26..3fccd962da6 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3905,7 +3905,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3905 | CHECK_STRING (name); | 3905 | CHECK_STRING (name); |
| 3906 | 3906 | ||
| 3907 | /* :local ADDRESS or :remote ADDRESS */ | 3907 | /* :local ADDRESS or :remote ADDRESS */ |
| 3908 | if (!NILP (server)) | 3908 | if (NILP (server)) |
| 3909 | address = Fplist_get (contact, QCremote); | 3909 | address = Fplist_get (contact, QCremote); |
| 3910 | else | 3910 | else |
| 3911 | address = Fplist_get (contact, QClocal); | 3911 | address = Fplist_get (contact, QClocal); |
| @@ -4612,12 +4612,11 @@ is nil, from any process) before the timeout expired. */) | |||
| 4612 | { | 4612 | { |
| 4613 | Lisp_Object proc_thread_name = XTHREAD (proc->thread)->name; | 4613 | Lisp_Object proc_thread_name = XTHREAD (proc->thread)->name; |
| 4614 | 4614 | ||
| 4615 | if (STRINGP (proc_thread_name)) | 4615 | error ("Attempt to accept output from process %s locked to thread %s", |
| 4616 | error ("Attempt to accept output from process %s locked to thread %s", | 4616 | SDATA (proc->name), |
| 4617 | SDATA (proc->name), SDATA (proc_thread_name)); | 4617 | STRINGP (proc_thread_name) |
| 4618 | else | 4618 | ? SDATA (proc_thread_name) |
| 4619 | error ("Attempt to accept output from process %s locked to thread %p", | 4619 | : SDATA (Fprin1_to_string (proc->thread, Qt))); |
| 4620 | SDATA (proc->name), XTHREAD (proc->thread)); | ||
| 4621 | } | 4620 | } |
| 4622 | } | 4621 | } |
| 4623 | else | 4622 | else |
diff --git a/src/thread.c b/src/thread.c index f11e3e5addb..3eba25b7b43 100644 --- a/src/thread.c +++ b/src/thread.c | |||
| @@ -1076,6 +1076,8 @@ syms_of_threads (void) | |||
| 1076 | 1076 | ||
| 1077 | staticpro (&last_thread_error); | 1077 | staticpro (&last_thread_error); |
| 1078 | last_thread_error = Qnil; | 1078 | last_thread_error = Qnil; |
| 1079 | |||
| 1080 | Fprovide (intern_c_string ("threads"), Qnil); | ||
| 1079 | } | 1081 | } |
| 1080 | 1082 | ||
| 1081 | DEFSYM (Qthreadp, "threadp"); | 1083 | DEFSYM (Qthreadp, "threadp"); |
diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index a106030aea1..4e2dc86eae0 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el | |||
| @@ -343,6 +343,29 @@ meaning a range of columns starting on LINE and ending on | |||
| 343 | END-LINE, if that matched. TYPE can be left out, in which case | 343 | END-LINE, if that matched. TYPE can be left out, in which case |
| 344 | any message type is accepted.") | 344 | any message type is accepted.") |
| 345 | 345 | ||
| 346 | (defconst compile-tests--grep-regexp-testcases | ||
| 347 | ;; Bug#32051. | ||
| 348 | '(("c:/Users/my.name/src/project\\src\\kbhit.hpp\0\ 29:#include <termios.h>" | ||
| 349 | 1 nil 29 "c:/Users/my.name/src/project\\src\\kbhit.hpp") | ||
| 350 | ("d:/gnu/emacs/branch/src/callproc.c\0\ 214:#ifdef DOS_NT" | ||
| 351 | 1 nil 214 "d:/gnu/emacs/branch/src/callproc.c") | ||
| 352 | ("/gnu/emacs/branch/src/callproc.c\0\ 214:#ifdef DOS_NT" | ||
| 353 | 1 nil 214 "/gnu/emacs/branch/src/callproc.c")) | ||
| 354 | "List of tests for `grep-regexp-list'. | ||
| 355 | The format is the same as `compile-tests--test-regexps-data', but | ||
| 356 | the match is expected to be the same when NUL bytes are replaced | ||
| 357 | with colon.") | ||
| 358 | |||
| 359 | (defconst compile-tests--grep-regexp-tricky-testcases | ||
| 360 | ;; Bug#7378. | ||
| 361 | '(("./x11-libs---nx/3.4.0:0:C.30253.1289557929.792611.C/nx-3.4.0.exheres-0\0\ 42:some text" | ||
| 362 | 1 nil 42 "./x11-libs---nx/3.4.0:0:C.30253.1289557929.792611.C/nx-3.4.0.exheres-0") | ||
| 363 | ("2011-08-31_11:57:03_1\0\ 7:Date: Wed, 31 Aug 2011 11:57:03 +0000" | ||
| 364 | 1 nil 7 "2011-08-31_11:57:03_1")) | ||
| 365 | "List of tricky tests for `grep-regexp-list'. | ||
| 366 | Same as `compile-tests--grep-regexp-testcases', but these cases | ||
| 367 | can only work with the NUL byte to disambiguate colons.") | ||
| 368 | |||
| 346 | (defun compile--test-error-line (test) | 369 | (defun compile--test-error-line (test) |
| 347 | (erase-buffer) | 370 | (erase-buffer) |
| 348 | (setq compilation-locs (make-hash-table)) | 371 | (setq compilation-locs (make-hash-table)) |
| @@ -370,7 +393,8 @@ any message type is accepted.") | |||
| 370 | (should (equal (car (nth 2 (compilation--loc->file-struct loc))) | 393 | (should (equal (car (nth 2 (compilation--loc->file-struct loc))) |
| 371 | (or end-line line))) | 394 | (or end-line line))) |
| 372 | (when type | 395 | (when type |
| 373 | (should (equal type (compilation--message->type msg))))))) | 396 | (should (equal type (compilation--message->type msg))))) |
| 397 | msg)) | ||
| 374 | 398 | ||
| 375 | (ert-deftest compile-test-error-regexps () | 399 | (ert-deftest compile-test-error-regexps () |
| 376 | "Test the `compilation-error-regexp-alist' regexps. | 400 | "Test the `compilation-error-regexp-alist' regexps. |
| @@ -379,4 +403,24 @@ The test data is in `compile-tests--test-regexps-data'." | |||
| 379 | (font-lock-mode -1) | 403 | (font-lock-mode -1) |
| 380 | (mapc #'compile--test-error-line compile-tests--test-regexps-data))) | 404 | (mapc #'compile--test-error-line compile-tests--test-regexps-data))) |
| 381 | 405 | ||
| 406 | (ert-deftest compile-test-grep-regexps () | ||
| 407 | "Test the `grep-regexp-alist' regexps. | ||
| 408 | The test data is in `compile-tests--grep-regexp-testcases'." | ||
| 409 | (with-temp-buffer | ||
| 410 | (grep-mode) | ||
| 411 | (setq buffer-read-only nil) | ||
| 412 | (font-lock-mode -1) | ||
| 413 | (dolist (testcase compile-tests--grep-regexp-testcases) | ||
| 414 | (let (msg1 msg2) | ||
| 415 | (setq msg1 (ert-info ((format "%S" testcase) :prefix "testcase: ") | ||
| 416 | (compile--test-error-line testcase))) | ||
| 417 | ;; Make sure replacing the NUL character with a colon still matches. | ||
| 418 | (setf (car testcase) (replace-regexp-in-string "\0" ":" (car testcase))) | ||
| 419 | (setq msg2 (ert-info ((format "%S" testcase) :prefix "testcase: ") | ||
| 420 | (compile--test-error-line testcase))) | ||
| 421 | (should (equal msg1 msg2)))) | ||
| 422 | (dolist (testcase compile-tests--grep-regexp-tricky-testcases) | ||
| 423 | (ert-info ((format "%S" testcase) :prefix "testcase: ") | ||
| 424 | (compile--test-error-line testcase))))) | ||
| 425 | |||
| 382 | ;;; compile-tests.el ends here | 426 | ;;; compile-tests.el ends here |
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el index 0e909d3e511..a00a9c84bd6 100644 --- a/test/src/thread-tests.el +++ b/test/src/thread-tests.el | |||
| @@ -19,36 +19,56 @@ | |||
| 19 | 19 | ||
| 20 | ;;; Code: | 20 | ;;; Code: |
| 21 | 21 | ||
| 22 | ;; Declare the functions in case Emacs has been configured --without-threads. | ||
| 23 | (declare-function all-threads "thread.c" ()) | ||
| 24 | (declare-function condition-mutex "thread.c" (cond)) | ||
| 25 | (declare-function condition-name "thread.c" (cond)) | ||
| 26 | (declare-function condition-notify "thread.c" (cond &optional all)) | ||
| 27 | (declare-function condition-wait "thread.c" (cond)) | ||
| 28 | (declare-function current-thread "thread.c" ()) | ||
| 29 | (declare-function make-condition-variable "thread.c" (mutex &optional name)) | ||
| 30 | (declare-function make-mutex "thread.c" (&optional name)) | ||
| 31 | (declare-function make-thread "thread.c" (function &optional name)) | ||
| 32 | (declare-function mutex-lock "thread.c" (mutex)) | ||
| 33 | (declare-function mutex-unlock "thread.c" (mutex)) | ||
| 34 | (declare-function thread--blocker "thread.c" (thread)) | ||
| 35 | (declare-function thread-alive-p "thread.c" (thread)) | ||
| 36 | (declare-function thread-join "thread.c" (thread)) | ||
| 37 | (declare-function thread-last-error "thread.c" ()) | ||
| 38 | (declare-function thread-name "thread.c" (thread)) | ||
| 39 | (declare-function thread-signal "thread.c" (thread error-symbol data)) | ||
| 40 | (declare-function thread-yield "thread.c" ()) | ||
| 41 | |||
| 22 | (ert-deftest threads-is-one () | 42 | (ert-deftest threads-is-one () |
| 23 | "Test for existence of a thread." | 43 | "Test for existence of a thread." |
| 24 | (skip-unless (fboundp 'make-thread)) | 44 | (skip-unless (featurep 'threads)) |
| 25 | (should (current-thread))) | 45 | (should (current-thread))) |
| 26 | 46 | ||
| 27 | (ert-deftest threads-threadp () | 47 | (ert-deftest threads-threadp () |
| 28 | "Test of threadp." | 48 | "Test of threadp." |
| 29 | (skip-unless (fboundp 'make-thread)) | 49 | (skip-unless (featurep 'threads)) |
| 30 | (should (threadp (current-thread)))) | 50 | (should (threadp (current-thread)))) |
| 31 | 51 | ||
| 32 | (ert-deftest threads-type () | 52 | (ert-deftest threads-type () |
| 33 | "Test of thread type." | 53 | "Test of thread type." |
| 34 | (skip-unless (fboundp 'make-thread)) | 54 | (skip-unless (featurep 'threads)) |
| 35 | (should (eq (type-of (current-thread)) 'thread))) | 55 | (should (eq (type-of (current-thread)) 'thread))) |
| 36 | 56 | ||
| 37 | (ert-deftest threads-name () | 57 | (ert-deftest threads-name () |
| 38 | "Test for name of a thread." | 58 | "Test for name of a thread." |
| 39 | (skip-unless (fboundp 'make-thread)) | 59 | (skip-unless (featurep 'threads)) |
| 40 | (should | 60 | (should |
| 41 | (string= "hi bob" (thread-name (make-thread #'ignore "hi bob"))))) | 61 | (string= "hi bob" (thread-name (make-thread #'ignore "hi bob"))))) |
| 42 | 62 | ||
| 43 | (ert-deftest threads-alive () | 63 | (ert-deftest threads-alive () |
| 44 | "Test for thread liveness." | 64 | "Test for thread liveness." |
| 45 | (skip-unless (fboundp 'make-thread)) | 65 | (skip-unless (featurep 'threads)) |
| 46 | (should | 66 | (should |
| 47 | (thread-alive-p (make-thread #'ignore)))) | 67 | (thread-alive-p (make-thread #'ignore)))) |
| 48 | 68 | ||
| 49 | (ert-deftest threads-all-threads () | 69 | (ert-deftest threads-all-threads () |
| 50 | "Simple test for all-threads." | 70 | "Simple test for all-threads." |
| 51 | (skip-unless (fboundp 'make-thread)) | 71 | (skip-unless (featurep 'threads)) |
| 52 | (should (listp (all-threads)))) | 72 | (should (listp (all-threads)))) |
| 53 | 73 | ||
| 54 | (defvar threads-test-global nil) | 74 | (defvar threads-test-global nil) |
| @@ -58,7 +78,7 @@ | |||
| 58 | 78 | ||
| 59 | (ert-deftest threads-basic () | 79 | (ert-deftest threads-basic () |
| 60 | "Basic thread test." | 80 | "Basic thread test." |
| 61 | (skip-unless (fboundp 'make-thread)) | 81 | (skip-unless (featurep 'threads)) |
| 62 | (should | 82 | (should |
| 63 | (progn | 83 | (progn |
| 64 | (setq threads-test-global nil) | 84 | (setq threads-test-global nil) |
| @@ -69,7 +89,7 @@ | |||
| 69 | 89 | ||
| 70 | (ert-deftest threads-join () | 90 | (ert-deftest threads-join () |
| 71 | "Test of `thread-join'." | 91 | "Test of `thread-join'." |
| 72 | (skip-unless (fboundp 'make-thread)) | 92 | (skip-unless (featurep 'threads)) |
| 73 | (should | 93 | (should |
| 74 | (progn | 94 | (progn |
| 75 | (setq threads-test-global nil) | 95 | (setq threads-test-global nil) |
| @@ -80,7 +100,7 @@ | |||
| 80 | 100 | ||
| 81 | (ert-deftest threads-join-self () | 101 | (ert-deftest threads-join-self () |
| 82 | "Cannot `thread-join' the current thread." | 102 | "Cannot `thread-join' the current thread." |
| 83 | (skip-unless (fboundp 'make-thread)) | 103 | (skip-unless (featurep 'threads)) |
| 84 | (should-error (thread-join (current-thread)))) | 104 | (should-error (thread-join (current-thread)))) |
| 85 | 105 | ||
| 86 | (defvar threads-test-binding nil) | 106 | (defvar threads-test-binding nil) |
| @@ -92,7 +112,7 @@ | |||
| 92 | 112 | ||
| 93 | (ert-deftest threads-let-binding () | 113 | (ert-deftest threads-let-binding () |
| 94 | "Simple test of threads and let bindings." | 114 | "Simple test of threads and let bindings." |
| 95 | (skip-unless (fboundp 'make-thread)) | 115 | (skip-unless (featurep 'threads)) |
| 96 | (should | 116 | (should |
| 97 | (progn | 117 | (progn |
| 98 | (setq threads-test-global nil) | 118 | (setq threads-test-global nil) |
| @@ -104,22 +124,22 @@ | |||
| 104 | 124 | ||
| 105 | (ert-deftest threads-mutexp () | 125 | (ert-deftest threads-mutexp () |
| 106 | "Simple test of `mutexp'." | 126 | "Simple test of `mutexp'." |
| 107 | (skip-unless (fboundp 'make-thread)) | 127 | (skip-unless (featurep 'threads)) |
| 108 | (should-not (mutexp 'hi))) | 128 | (should-not (mutexp 'hi))) |
| 109 | 129 | ||
| 110 | (ert-deftest threads-mutexp-2 () | 130 | (ert-deftest threads-mutexp-2 () |
| 111 | "Another simple test of `mutexp'." | 131 | "Another simple test of `mutexp'." |
| 112 | (skip-unless (fboundp 'make-thread)) | 132 | (skip-unless (featurep 'threads)) |
| 113 | (should (mutexp (make-mutex)))) | 133 | (should (mutexp (make-mutex)))) |
| 114 | 134 | ||
| 115 | (ert-deftest threads-mutex-type () | 135 | (ert-deftest threads-mutex-type () |
| 116 | "type-of mutex." | 136 | "type-of mutex." |
| 117 | (skip-unless (fboundp 'make-thread)) | 137 | (skip-unless (featurep 'threads)) |
| 118 | (should (eq (type-of (make-mutex)) 'mutex))) | 138 | (should (eq (type-of (make-mutex)) 'mutex))) |
| 119 | 139 | ||
| 120 | (ert-deftest threads-mutex-lock-unlock () | 140 | (ert-deftest threads-mutex-lock-unlock () |
| 121 | "Test mutex-lock and unlock." | 141 | "Test mutex-lock and unlock." |
| 122 | (skip-unless (fboundp 'make-thread)) | 142 | (skip-unless (featurep 'threads)) |
| 123 | (should | 143 | (should |
| 124 | (let ((mx (make-mutex))) | 144 | (let ((mx (make-mutex))) |
| 125 | (mutex-lock mx) | 145 | (mutex-lock mx) |
| @@ -128,7 +148,7 @@ | |||
| 128 | 148 | ||
| 129 | (ert-deftest threads-mutex-recursive () | 149 | (ert-deftest threads-mutex-recursive () |
| 130 | "Test mutex recursion." | 150 | "Test mutex recursion." |
| 131 | (skip-unless (fboundp 'make-thread)) | 151 | (skip-unless (featurep 'threads)) |
| 132 | (should | 152 | (should |
| 133 | (let ((mx (make-mutex))) | 153 | (let ((mx (make-mutex))) |
| 134 | (mutex-lock mx) | 154 | (mutex-lock mx) |
| @@ -149,7 +169,7 @@ | |||
| 149 | 169 | ||
| 150 | (ert-deftest threads-mutex-contention () | 170 | (ert-deftest threads-mutex-contention () |
| 151 | "Test of mutex contention." | 171 | "Test of mutex contention." |
| 152 | (skip-unless (fboundp 'make-thread)) | 172 | (skip-unless (featurep 'threads)) |
| 153 | (should | 173 | (should |
| 154 | (progn | 174 | (progn |
| 155 | (setq threads-mutex (make-mutex)) | 175 | (setq threads-mutex (make-mutex)) |
| @@ -170,7 +190,7 @@ | |||
| 170 | 190 | ||
| 171 | (ert-deftest threads-mutex-signal () | 191 | (ert-deftest threads-mutex-signal () |
| 172 | "Test signaling a blocked thread." | 192 | "Test signaling a blocked thread." |
| 173 | (skip-unless (fboundp 'make-thread)) | 193 | (skip-unless (featurep 'threads)) |
| 174 | (should | 194 | (should |
| 175 | (progn | 195 | (progn |
| 176 | (setq threads-mutex (make-mutex)) | 196 | (setq threads-mutex (make-mutex)) |
| @@ -188,7 +208,7 @@ | |||
| 188 | 208 | ||
| 189 | (ert-deftest threads-io-switch () | 209 | (ert-deftest threads-io-switch () |
| 190 | "Test that `accept-process-output' causes thread switch." | 210 | "Test that `accept-process-output' causes thread switch." |
| 191 | (skip-unless (fboundp 'make-thread)) | 211 | (skip-unless (featurep 'threads)) |
| 192 | (should | 212 | (should |
| 193 | (progn | 213 | (progn |
| 194 | (setq threads-test-global nil) | 214 | (setq threads-test-global nil) |
| @@ -199,67 +219,68 @@ | |||
| 199 | 219 | ||
| 200 | (ert-deftest threads-condvarp () | 220 | (ert-deftest threads-condvarp () |
| 201 | "Simple test of `condition-variable-p'." | 221 | "Simple test of `condition-variable-p'." |
| 202 | (skip-unless (fboundp 'make-thread)) | 222 | (skip-unless (featurep 'threads)) |
| 203 | (should-not (condition-variable-p 'hi))) | 223 | (should-not (condition-variable-p 'hi))) |
| 204 | 224 | ||
| 205 | (ert-deftest threads-condvarp-2 () | 225 | (ert-deftest threads-condvarp-2 () |
| 206 | "Another simple test of `condition-variable-p'." | 226 | "Another simple test of `condition-variable-p'." |
| 207 | (skip-unless (fboundp 'make-thread)) | 227 | (skip-unless (featurep 'threads)) |
| 208 | (should (condition-variable-p (make-condition-variable (make-mutex))))) | 228 | (should (condition-variable-p (make-condition-variable (make-mutex))))) |
| 209 | 229 | ||
| 210 | (ert-deftest threads-condvar-type () | 230 | (ert-deftest threads-condvar-type () |
| 211 | "type-of condvar" | 231 | "type-of condvar" |
| 212 | (skip-unless (fboundp 'make-thread)) | 232 | (skip-unless (featurep 'threads)) |
| 213 | (should (eq (type-of (make-condition-variable (make-mutex))) | 233 | (should (eq (type-of (make-condition-variable (make-mutex))) |
| 214 | 'condition-variable))) | 234 | 'condition-variable))) |
| 215 | 235 | ||
| 216 | (ert-deftest threads-condvar-mutex () | 236 | (ert-deftest threads-condvar-mutex () |
| 217 | "Simple test of `condition-mutex'." | 237 | "Simple test of `condition-mutex'." |
| 218 | (skip-unless (fboundp 'make-thread)) | 238 | (skip-unless (featurep 'threads)) |
| 219 | (should | 239 | (should |
| 220 | (let ((m (make-mutex))) | 240 | (let ((m (make-mutex))) |
| 221 | (eq m (condition-mutex (make-condition-variable m)))))) | 241 | (eq m (condition-mutex (make-condition-variable m)))))) |
| 222 | 242 | ||
| 223 | (ert-deftest threads-condvar-name () | 243 | (ert-deftest threads-condvar-name () |
| 224 | "Simple test of `condition-name'." | 244 | "Simple test of `condition-name'." |
| 225 | (skip-unless (fboundp 'make-thread)) | 245 | (skip-unless (featurep 'threads)) |
| 226 | (should | 246 | (should |
| 227 | (eq nil (condition-name (make-condition-variable (make-mutex)))))) | 247 | (eq nil (condition-name (make-condition-variable (make-mutex)))))) |
| 228 | 248 | ||
| 229 | (ert-deftest threads-condvar-name-2 () | 249 | (ert-deftest threads-condvar-name-2 () |
| 230 | "Another simple test of `condition-name'." | 250 | "Another simple test of `condition-name'." |
| 231 | (skip-unless (fboundp 'make-thread)) | 251 | (skip-unless (featurep 'threads)) |
| 232 | (should | 252 | (should |
| 233 | (string= "hi bob" | 253 | (string= "hi bob" |
| 234 | (condition-name (make-condition-variable (make-mutex) | 254 | (condition-name (make-condition-variable (make-mutex) |
| 235 | "hi bob"))))) | 255 | "hi bob"))))) |
| 236 | (defun call-error () | 256 | |
| 257 | (defun threads-call-error () | ||
| 237 | "Call `error'." | 258 | "Call `error'." |
| 238 | (error "Error is called")) | 259 | (error "Error is called")) |
| 239 | 260 | ||
| 240 | ;; This signals an error internally; the error should be caught. | 261 | ;; This signals an error internally; the error should be caught. |
| 241 | (defun thread-custom () | 262 | (defun threads-custom () |
| 242 | (defcustom thread-custom-face 'highlight | 263 | (defcustom threads-custom-face 'highlight |
| 243 | "Face used for thread customizations." | 264 | "Face used for thread customizations." |
| 244 | :type 'face | 265 | :type 'face |
| 245 | :group 'widget-faces)) | 266 | :group 'widget-faces)) |
| 246 | 267 | ||
| 247 | (ert-deftest thread-errors () | 268 | (ert-deftest threads-errors () |
| 248 | "Test what happens when a thread signals an error." | 269 | "Test what happens when a thread signals an error." |
| 249 | (skip-unless (fboundp 'make-thread)) | 270 | (skip-unless (featurep 'threads)) |
| 250 | (let (th1 th2) | 271 | (let (th1 th2) |
| 251 | (setq th1 (make-thread #'call-error "call-error")) | 272 | (setq th1 (make-thread #'threads-call-error "call-error")) |
| 252 | (should (threadp th1)) | 273 | (should (threadp th1)) |
| 253 | (while (thread-alive-p th1) | 274 | (while (thread-alive-p th1) |
| 254 | (thread-yield)) | 275 | (thread-yield)) |
| 255 | (should (equal (thread-last-error) | 276 | (should (equal (thread-last-error) |
| 256 | '(error "Error is called"))) | 277 | '(error "Error is called"))) |
| 257 | (setq th2 (make-thread #'thread-custom "thread-custom")) | 278 | (setq th2 (make-thread #'threads-custom "threads-custom")) |
| 258 | (should (threadp th2)))) | 279 | (should (threadp th2)))) |
| 259 | 280 | ||
| 260 | (ert-deftest thread-sticky-point () | 281 | (ert-deftest threads-sticky-point () |
| 261 | "Test bug #25165 with point movement in cloned buffer." | 282 | "Test bug #25165 with point movement in cloned buffer." |
| 262 | (skip-unless (fboundp 'make-thread)) | 283 | (skip-unless (featurep 'threads)) |
| 263 | (with-temp-buffer | 284 | (with-temp-buffer |
| 264 | (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") | 285 | (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") |
| 265 | (goto-char (point-min)) | 286 | (goto-char (point-min)) |
| @@ -268,9 +289,9 @@ | |||
| 268 | (sit-for 1) | 289 | (sit-for 1) |
| 269 | (should (= (point) 21)))) | 290 | (should (= (point) 21)))) |
| 270 | 291 | ||
| 271 | (ert-deftest thread-signal-early () | 292 | (ert-deftest threads-signal-early () |
| 272 | "Test signaling a thread as soon as it is started by the OS." | 293 | "Test signaling a thread as soon as it is started by the OS." |
| 273 | (skip-unless (fboundp 'make-thread)) | 294 | (skip-unless (featurep 'threads)) |
| 274 | (let ((thread | 295 | (let ((thread |
| 275 | (make-thread #'(lambda () | 296 | (make-thread #'(lambda () |
| 276 | (while t (thread-yield)))))) | 297 | (while t (thread-yield)))))) |
| @@ -291,7 +312,7 @@ | |||
| 291 | 312 | ||
| 292 | (ert-deftest threads-condvar-wait () | 313 | (ert-deftest threads-condvar-wait () |
| 293 | "Test waiting on conditional variable." | 314 | "Test waiting on conditional variable." |
| 294 | (skip-unless (fboundp 'make-thread)) | 315 | (skip-unless (featurep 'threads)) |
| 295 | (let ((cv-mutex (make-mutex)) | 316 | (let ((cv-mutex (make-mutex)) |
| 296 | new-thread) | 317 | new-thread) |
| 297 | ;; We could have spurious threads from the previous tests still | 318 | ;; We could have spurious threads from the previous tests still |