aboutsummaryrefslogtreecommitdiffstats
path: root/test/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Port format-time-string to MS-Windows betterPaul Eggert2017-05-011-12/+15
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone): Port test cases to MS-Windows.
* ; Fix typoKen Brown2017-05-011-1/+1
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone): Fix typo in timezone specification.
* ; Fix commentary in a recent commitEli Zaretskii2017-05-011-7/+7
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone): Minor copyedit in the commentary.
* Warn about missing backslashes during loadPhilipp Stephani2017-05-011-0/+26
| | | | | | | | | | | | | | | | * src/lread.c (load_warn_unescaped_character_literals, Fload, read1) (syms_of_lread): Warn if unescaped character literals are found (Bug#20152). * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check for unescaped character literals during byte compilation. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): New unit test. (lread-tests--with-temp-file, lread-tests--last-message): Helper functions for unit test. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): New unit test. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-temp-file): Helper macro for unit test.
* Don’t stress-test time zones near the EpochPaul Eggert2017-05-011-11/+28
| | | | | | | * test/src/editfns-tests.el (format-time-string-with-zone) (format-time-string-with-outlandish-zone): Don’t format timestamps near the Epoch, as this runs into bugs on MS-Windows, and we don’t want to worry about those bugs.
* Integrate module test with normal test suitePhilipp Stephani2017-04-291-0/+148
| | | | | | | | | | | | | | | | | | | | * test/Makefile.in (ELFILES): Exclude module test if modules aren't configured. (EMACS_TEST_DIRECTORY): Expand test directory so that it's set correctly even if Emacs changes the current directory. ($(srcdir)/src/emacs-module-tests.log) ($(test_module)): Proper dependency tracking for test module. * test/data/emacs-module/Makefile (ROOT): Adapt to new location. Remove 'check' target and EMACS variable, which are no longer necessary. (SO): Change to include period. * test/src/emacs-module-tests.el (mod-test): Use EMACS_TEST_DIRECTORY environment variable to reliably find test data. * configure.ac (HAVE_MODULES, MODULES_SUFFIX): Add necessary substitutions.
* Test format-time-string with zone argPaul Eggert2017-04-271-0/+21
| | | | | * test/src/editfns-tests.el (format-time-string-with-zone) (format-time-string-with-outlandish-zone): New tests.
* Don't require bytecomp for running ert testsNoam Postavsky2017-04-221-0/+2
| | | | | | | | | | | | "Fix ert-tests when running compiled" 2016-12-06 accidentally introduced a dependency on `bytecomp' into `ert'. As mentioned in "Avoid ert test failures" 2017-04-18, the accidental dependency of ert on bytecomp was masked by loading other libraries until recently. * lisp/emacs-lisp/ert.el (ert--expand-should-1): Only use `byte-compile-macro-environment' if it's bound. * test/src/eval-tests.el: Add defvar for dynamic variable `byte-compile-debug'.
* Fix circular read syntax for records.Lars Brinkhoff2017-04-081-0/+4
| | | | | | * lread.c (substitute_object_recurse): Work with records. * lread-tests.el (lread-record-1): New test.
* Deprecate copy-record in favor of copy-sequencePaul Eggert2017-04-071-1/+1
| | | | | | | | | | | | | | | | | Since copy-sequence seems to be needed anyway for records, have it work on records, and remove copy-record as being superfluous. * doc/lispref/records.texi (Records, Record Functions): * lisp/emacs-lisp/cl-macs.el (cl-defstruct): * lisp/emacs-lisp/eieio.el (make-instance, clone): * test/src/alloc-tests.el (record-3): Use copy-sequence, not copy-record, to copy records. * doc/lispref/sequences.texi (Sequence Functions) (Array Functions): Document that aref and copy-sequence work on records. * etc/NEWS: Omit copy-record. * src/alloc.c (Fcopy_record): Remove. * src/data.c (Faref): Document that arg can be a record. * src/fns.c (Fcopy_sequence): Copy records, too.
* Implement special sigma casing rule (bug#24603)Michal Nazarewicz2017-04-061-6/+9
| | | | | | | | | | | | | | | | | | In Greek, a sigma character has two lower case forms which depend on their position in the word. Implement logic determining it. * src/casefiddle.c (struct casing_context, case_character_impl): Don’t assume inword is true when flag is CASE_UP and false when flag is CASE_DOWN. For final sigma detection we need this information tracked reliably;. (CAPITAL_SIGMA, SMALL_SIGMA, SMALL_FINAL_SIGMA): New macros defining Unicode code point of different forms of sigma letter. (case_character): Implement support for final sigma casing. (do_casify_multibyte_string, do_casify_multibyte_region): Update after changes to case_character. * test/src/casefiddle-tests.el (casefiddle-tests-casing): Add test cases for final sigma.
* Support casing characters which map into multiple code points (bug#24603)Michal Nazarewicz2017-04-061-36/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement unconditional special casing rules defined in Unicode standard. Among other things, they deal with cases when a single code point is replaced by multiple ones because single character does not exist (e.g. ‘fi’ ligature turning into ‘FL’) or is not commonly used (e.g. ß turning into SS). * admin/unidata/SpecialCasing.txt: New data file pulled from Unicode standard distribution. * admin/unidata/README: Mention SpecialCasing.txt. * admin/unidata/unidata-get.el (unidata-gen-table-special-casing, unidata-gen-table-special-casing--do-load): New functions generating ‘special-uppercase’, ‘special-lowercase’ and ‘special-titlecase’ character Unicode properties built from the SpecialCasing.txt Unicode data file. * src/casefiddle.c (struct casing_str_buf): New structure for representing short strings used to handle one-to-many character mappings. (case_character_imlp): New function which can handle one-to-many character mappings. (case_character, case_single_character): Wrappers for the above functions. The former may map one character to multiple (or no) code points while the latter does what the former used to do (i.e. handles one-to-one mappings only). (do_casify_natnum, do_casify_unibyte_string, do_casify_unibyte_region): Use case_single_character. (do_casify_multibyte_string, do_casify_multibyte_region): Support new features of case_character. * (do_casify_region): Updated to reflact do_casify_multibyte_string changes. (casify_word): Handle situation when one character-length of a word can change affecting where end of the word is. (upcase, capitalize, upcase-initials): Update documentation to mention limitations when working on characters. * test/src/casefiddle-tests.el (casefiddle-tests-char-properties): Add test cases for the newly introduced character properties. (casefiddle-tests-casing): Update test cases which are now passing. * test/lisp/char-fold-tests.el (char-fold--ascii-upcase, char-fold--ascii-downcase): New functions which behave like old ‘upcase’ and ‘downcase’. (char-fold--test-match-exactly): Use the new functions. This is needed because otherwise fi and similar characters are turned into their multi- -character representation. * doc/lispref/strings.texi: Describe issue with casing characters versus strings. * doc/lispref/nonascii.texi: Describe the new character properties.
* Add support for title-casing letters (bug#24603)Michal Nazarewicz2017-04-061-13/+26
| | | | | | | | | | | * src/casefiddle.c (struct casing_context, prepare_casing_context): Add titlecase_char_table member. It’s set to the ‘titlecase’ Unicode property table if capitalisation has been requested. (case_character): Make use of the titlecase_char_table to title-case initial characters when capitalising. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing.
* Add record objects with user-defined types.Lars Brinkhoff2017-04-041-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (allocate_record): New function. (Fmake_record, Frecord, Fcopy_record): New functions. (syms_of_alloc): defsubr them. (purecopy): Work with records. * src/data.c (Ftype_of): Return slot 0 for record objects, or type name if record's type holds class. (Frecordp): New function. (syms_of_data): defsubr it. Define `Qrecordp'. (Faref, Faset): Work with records. * src/fns.c (Flength): Work with records. * src/lisp.h (prec_type): Add PVEC_RECORD. (RECORDP, CHECK_RECORD, CHECK_RECORD_TYPE): New functions. * src/lread.c (read1): Add syntax for records. * src/print.c (PRINT_CIRCLE_CANDIDATE_P): Add RECORDP. (print_object): Add syntax for records. * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-2): New test. * test/src/alloc-tests.el (record-1, record-2, record-3): New tests. * doc/lispref/elisp.texi, doc/lispref/objects.texi, doc/lispref/records.texi: Add documentation for records.
* Some inotify cleanupPaul Eggert2017-03-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This catches some problems with integer overflow and races that I noticed in inotify.c after reviewing the changes installed to fix Bug#26126. * src/fns.c, src/lisp.h (equal_no_quit): Now extern. * src/inotify.c (aspect_to_inotifymask): Check for cycles and for improper lists. (make_lispy_mask, lispy_mask_match_p): Remove. All callers changed to use INTEGER_TO_CONS and CONS_TO_INTEGER. (inotifyevent_to_event, add_watch): Don’t assume watch descriptors and cookies fit in fixnums. (add_watch): Use assoc_no_quit, not Fassoc. Avoid integer overflow in (very!) long-running processes where the Emacs watch ID could overflow. Avoid some duplicate code. (find_descriptor): New function. (remove_descriptor): First arg is now the returned value from find_descriptor, rather than the descriptor. This way, the value can be removed without calling Fdelete, which might quit. Wait until the end (when watch_list is consistent) before signaling any errors. (remove_watch, inotify_callback): Use find_descriptor to avoid the need for Fdelete. (inotify_callback): Use simpler tests for ioctl failure. Free temporary buffer if signaled, and put it on the stack if small. Use ssize_t to index through read results, to avoid a cast. (valid_watch_descriptor): New function, with a tighter check. (Finotify_rm_watch, Finotify_valid_p): Use it. (Finotify_valid_p): Use assoc_no_quit and ass_no_quit instead of Fassoc. Do not assume the first assoc succeeds. * test/src/inotify-tests.el (inotify-valid-p-simple): Add inotify-valid-p tests, some of which dump core without the fixes noted above.
* min and max should not return markersPaul Eggert2017-03-071-2/+6
| | | | | | | | | Problem reported by Glenn Morris in: http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00147.html * src/data.c (minmax_driver): Convert any marker result to an integer, since some callers assume this. * test/src/data-tests.el (data-tests-max, data-tests-min): Test for this.
* min and max now return one of their argumentsPaul Eggert2017-03-061-0/+20
| | | | | | | | | * doc/lispref/numbers.texi (Comparison of Numbers): * etc/NEWS: Document this. * src/data.c (Amax, Amin): Remove constants. All uses removed. (minmax_driver): New function. (Fmax, Fmin): Use it instead of arith_driver. * test/src/data-tests.el (data-tests-max, data-tests-min): New tests.
* ffloor etc. now accept only floatsPaul Eggert2017-03-051-0/+6
| | | | | | | * etc/NEWS: Say why. * src/floatfns.c (Ffceiling, Fffloor, Ffround, Fftruncate): Require arg to be float. * test/src/floatfns-tests.el (fround-fixnum): Check this.
* ; Spelling fixesPaul Eggert2017-03-051-1/+1
|
* Compare and round more carefullyPaul Eggert2017-03-041-0/+26
| | | | | | | | | | | | | | | | * etc/NEWS: Document this. * src/data.c (store_symval_forwarding): * src/sound.c (parse_sound): Do not botch NaN comparison. * src/data.c (cons_to_unsigned, cons_to_signed): Signal an error if a floating-point arg is not integral. * src/data.c (cons_to_unsigned, cons_to_signed): * src/fileio.c (file_offset): Use simpler overflow check. * src/dbusbind.c (xd_extract_signed, xd_extract_unsigned): Avoid rounding error in overflow check. (Fcar_less_than_car): Use arithcompare directly. * test/src/charset-tests.el: New file.
* logb now works correctly on large integersPaul Eggert2017-03-031-0/+3
| | | | | | | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add count-leading-zeros. * etc/NEWS: Document the change. * lib/count-leading-zeros.c, lib/count-leading-zeros.h: * m4/count-leading-zeros.m4: New files, copied from Gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * src/floatfns.c: Include count-leading-zeros.h. (Flogb): Do not convert fixnum to float before taking the log, as the rounding error can cause the answer to be off by 1. * src/lisp.h (EMACS_UINT_WIDTH): New constant. * test/src/floatfns-tests.el (logb-extreme-fixnum): New test.
* Fix rounding errors in <, =, etc.Paul Eggert2017-03-021-0/+6
| | | | | | | | | | * etc/NEWS: Document this. * src/bytecode.c (exec_byte_code): * src/data.c (arithcompare): Do not lose information when comparing floats to integers. * test/src/data-tests.el (data-tests-=, data-tests-<) (data-tests->, data-tests-<=, data-tests->=): Test this.
* Fix rounding error in ‘ceiling’ etc.Paul Eggert2017-03-012-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this fix, (ceiling most-negative-fixnum -1.0) returns most-negative-fixnum instead of correctly signaling range-error, and similarly for floor, round, and truncate. * configure.ac (trunc): Add a check, since Gnulib’s doc says ‘trunc’ is missing from MSVC 9. The Gnulib doc says ‘trunc’ is also missing from some other older operating systems like Solaris 9 which I know we don’t care about any more, so MSVC is the only reason to worry about ‘trunc’ here. * src/editfns.c (styled_format): Formatting a float with %c is now an error. The old code did not work in general, because FIXNUM_OVERFLOW_P had rounding errors. Besides, the "if (FLOATP (...))" was in there only as a result of my misunderstanding old code that I introduced 2011. Although %d etc. is sometimes used on floats that represent huge UIDs or PIDs etc. that do not fit in fixnums, this cannot happen with characters. * src/floatfns.c (rounding_driver): Rework to do the right thing when the intermediate result equals 2.305843009213694e+18, i.e., is exactly 1 greater than MOST_POSITIVE_FIXNUM on a 64-bit host. Simplify so that only one section of code checks for overflow, rather than two. (double_identity): Remove. All uses changed to ... (emacs_trunc): ... this new function. Add replacement for platforms that lack ‘trunc’. * src/lisp.h (FIXNUM_OVERFLOW_P, make_fixnum_or_float): Make it clear that the arg cannot be floating point. * test/src/editfns-tests.el (format-c-float): New test. * test/src/floatfns-tests.el: New file, to test for this bug.
* casing: don’t assume letters are *either* upper- or lower-case (bug#24603)Michal Nazarewicz2017-02-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | A compatibility digraph characters, such as Dž, are neither upper- nor lower-case. At the moment however, those are reported as upper-case¹ despite the fact that they change when upper-cased. Stop checking if a character is upper-case before trying to up-case it so that title-case characters are handled correctly. This fixes one of the issues mentioned in bug#24603. ¹ Because they change when converted to lower-case. Notice an asymmetry in that for a character to be considered lower-case it must not be upper-case (plus the usual condition of changing when upper-cased). * src/buffer.h (upcase1): Delete. (upcase): Change to upcase character unconditionally just like downcase does it. This is what upcase1 was. * src/casefiddle.c (casify_object, casify_region): Use upcase instead of upcase1 and don’t check !uppercasep(x) before calling upcase. * src/keyboard.c (read_key_sequence): Don’t check if uppercase(x), just downcase(x) and see if it changed. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing.
* Generate upcase and downcase tables from Unicode data (bug#24603)Michal Nazarewicz2017-02-151-4/+3
| | | | | | | | | | | | | | | | Use Unicode data to generate case tables instead of mostly repeating them in lisp code. Do that in a way which maps ‘Dz’ (and similar) digraph to ‘dz’ when down- and ‘DZ’ when upcasing. https://debbugs.gnu.org/cgi/bugreport.cgi?msg=89;bug=24603 lists all changes to syntax table and case tables introduced by this commit. * lisp/international/characters.el: Remove case-pairs defined with explicit Lisp code and instead use Unicode character properties. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now working as they should.
* Add tests for casefiddle.c (bug#24603)Michal Nazarewicz2017-02-151-0/+247
| | | | | | | | | | | Fixes cases marked FIXME upcoming in followup commits. * test/src/casefiddle-tests.el (casefiddle-tests-char-properties, casefiddle-tests-case-table, casefiddle-tests-casing-character, casefiddle-tests-casing, casefiddle-tests-casing-byte8, casefiddle-tests-casing-byte8-with-changes): New tests. (casefiddle-tests--test-casing): New helper function for runnig some of the tests.
* Fix typos in tests for lax-plist-get etc.Paul Eggert2017-02-121-9/+9
| | | | | | | Problem reported by Eli Zaretskii (Bug#25606#62). * test/src/fns-tests.el (test-cycle-lax-plist-get) (test-cycle-plist-put, test-cycle-lax-plist-put): Fix tests to match behavior.
* Move cyclic tests to fns-tests.elPaul Eggert2017-02-101-0/+298
| | | | | | | | | | | | | * test/src/fns-tests.el (cyc1, cyc2, dot1, dot2): New functions. (test-cycle-length, test-cycle-safe-length, test-cycle-member) (test-cycle-memq, test-cycle-memql, test-cycle-assq) (test-cycle-assoc, test-cycle-rassq, test-cycle-rassoc) (test-cycle-delq, test-cycle-delete, test-cycle-reverse) (test-cycle-plist-get, test-cycle-lax-plist-get) (test-cycle-plist-member, test-cycle-plist-put) (test-cycle-lax-plist-put, test-cycle-equal, test-cycle-nconc): New tests. * test/manual/cyclic-tests.el: File deleted.
* Fix comment detection on open parensNoam Postavsky2017-01-231-0/+85
| | | | | | | | | | | | | | | Characters having both open paren syntax and comment start syntax were being detected as open parens even when they should have been part a comment starter (Bug#24870). * src/syntax.c (in_2char_comment_start): New function, extracted from `scan_sexps_forward'. (scan_sexps_forward): Add check for a 2-char comment starter before the loop. Inside the loop, do that check after incrementing the 'from' character index. Move the single char comment syntax cases into the switch instead of special casing them before. * test/src/syntax-tests.el (parse-partial-sexp-paren-comments): (parse-partial-sexp-continue-over-comment-marker): New tests.
* Check that variable lists are actually listsPhilipp Stephani2017-01-191-0/+10
| | | | | | | | | | 'let' and 'let*' document that their first argument has to be a list, but don't check for that; instead, they allow (and silently ignore) other types. Introduce an explicit type check. * src/eval.c (Flet, FletX): Check that the variable list is indeed a list. * test/src/eval-tests.el: Add unit tests.
* Rudimentary error handling for non-main threadsEli Zaretskii2017-01-181-4/+13
| | | | | | | | | | | | | | * src/thread.c (last_thread_error): New static variable. (syms_of_threads): Staticpro it. (record_thread_error, Fthread_last_error): New functions. (syms_of_threads): Defsubr Fthread_last_error. * doc/lispref/threads.texi (Basic Thread Functions): Document thread-last-error. * test/src/thread-tests.el (thread-errors, thread-signal-early) (threads-condvar-wait): Test the values returned by thread-last-error.
* Fix last changeEli Zaretskii2017-01-131-9/+9
| | | | | | * test/src/thread-tests.el (threads-condvar-wait): Revert previous change. Make sure no other threads from previous tests are running, to avoid interfering with our thread counts.
* Fix the new condvar testEli Zaretskii2017-01-131-2/+3
| | | | | | * test/src/thread-tests.el (threads-condvar-wait): Enlarge the time we sleep in the main thread to let the other thread process notifications.
* Minor improvements in the new condvar testEli Zaretskii2017-01-131-11/+14
| | | | | | | | * test/src/thread-tests.el (threads-test-condvar-wait): Use with-mutex instead of emulating it inline. (threads-condvar-wait): Improve comments. Check that the new thread is alive before waiting for it to become blocked on the conditional variable.
* Fix a bug in waiting for condition variableEli Zaretskii2017-01-131-0/+41
| | | | | | | | | | | * src/thread.c (lisp_mutex_lock, lisp_mutex_unlock) (lisp_mutex_unlock_for_wait, condition_wait_callback) (condition_notify_callback): Improve commentary. (condition_wait_callback): Call post_acquire_global_lock before attempting to lock the mutex, to make sure the lock's owner is recorded correctly. * test/src/thread-tests.el (threads-condvar-wait): New test.
* Add support for Unicode whitespace in [:blank:]Philipp Stephani2017-01-061-1/+1
| | | | | | | | | | | | | | | | See Bug#25366. * src/character.c (blankp): New function for checking Unicode horizontal whitespace. * src/regex.c (ISBLANK): Use 'blankp' for non-ASCII horizontal whitespace. (BIT_BLANK): New bit for range table. (re_wctype_to_bit, execute_charset): Use it. * test/lisp/subr-tests.el (subr-tests--string-match-p--blank): Add unit test for [:blank:] character class. * test/src/regex-tests.el (test): Adapt unit test. * doc/lispref/searching.texi (Char Classes): Document new Unicode behavior for [:blank:].
* Update copyright year to 2017 in masterPaul Eggert2017-01-0111-11/+11
| | | | | | Run admin/update-copyright in the master branch. This fixes files that were not already fixed in the emacs-25 branch before it was merged here.
* Merge from origin/emacs-25Paul Eggert2017-01-0114-14/+14
| | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
* Treat incomplete integer literals as errorsPhilipp Stephani2016-12-231-0/+8
| | | | | | | | See Bug#25120. * src/lread.c (read_integer): Treat incomplete integer literals as errors. * test/src/lread-tests.el (lread-empty-int-literal): New unit test for incomplete integer literals.
* ; Spelling fixesPaul Eggert2016-12-221-1/+1
|
* * src/data.c (Fmake_variable_frame_local): RemoveStefan Monnier2016-12-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'. * src/data.c (swap_in_symval_forwarding, set_internal) (set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Don't pay attention to ->frame_local any more. (syms_of_data): Remove Qtrapping_frame_local and don't defsubr Smake_variable_frame_local. * etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal of make-variable-frame-local. * lisp/help-fns.el (describe-variable): Don't handle the now impossible frame-local case. * lisp/subr.el (make-variable-frame-local): Remove obsolescence data. * src/frame.c (store_frame_param): * src/eval.c (specbind): Don't pay attention to ->frame_local any more. * src/widget.c (first_frame_p): Remove, unused.
* * test/src/regex-resources/PTESTS: Convert to UTF-8.Paul Eggert2016-12-121-271/+271
|
* Avoid crashing if a new thread is signaled right awayEli Zaretskii2016-12-121-0/+9
| | | | | | | | | | | * src/thread.c (post_acquire_global_lock): Don't raise the pending signal if the thread's handlers were not yet set up, as that will cause Emacs to exit with a fatal error. This can happen if a thread is signaled as soon as make-thread returns, before the new thread had an opportunity to acquire the global lock, set up the handlers, and call the thread function. * test/src/thread-tests.el (thread-signal-early): New test.
* Fix point motion in cloned buffersEli Zaretskii2016-12-121-1/+11
| | | | | | | | | | | | | | | | | | * src/thread.c (post_acquire_global_lock): Call set_buffer_internal_2 instead of tricking set_buffer_internal_1 into resetting the current buffer even if it didn't change. This avoids bug#25165, caused by failing to record the modified values of point and mark, because current_buffer was set to NULL. Also, don't bother re-setting the buffer if there was no thread switch, as that just wastes cycles. * src/buffer.c (set_buffer_internal_2): New function, with most of the body of set_buffer_internal_1, but without the test for B being identical to the current buffer. (set_buffer_internal_1): Call set_buffer_internal_2 if B is not identical to the current buffer. * src/buffer.h (set_buffer_internal_2): Add prototype. * test/src/thread-tests.el (thread-sticky-point): New test.
* Avoid aborts when a thread signals an errorEli Zaretskii2016-12-111-0/+15
| | | | | | | | | | | | * src/thread.h (struct thread_state): Add members m_waiting_for_input and m_input_available_clear_time. (waiting_for_input, input_available_clear_time): New macros. * src/keyboard.c (waiting_for_input, input_available_clear_time): Remove; they are now macros that reference the current thread. (Bug#25171) * src/w32select.c: Don't include keyboard.h. * test/src/thread-tests.el (thread-errors): New test.
* ; Fix copyright years in new filesGlenn Morris2016-12-101-1/+1
|
* Support concurrency in Emacs LispEli Zaretskii2016-12-102-0/+294
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge branch 'test-concurrency' * src/thread.c: * src/thread.h: * src/systhread.c: * src/systhread.h: New files. * src/xgselect.c (xg_select): Avoid using SAFE_NALLOCA and use xnmalloc unconditionally. * src/window.c (struct save_window_data): Rename current_buffer to f_current_buffer. * src/w32proc.c (sys_select): Change the function signature to closer fit 'pselect' on Posix hosts. * src/search.c: * src/regex.h: Convert some globals to macros that reference thread-specific values. * src/process.c (pset_thread, add_non_keyboard_read_fd) (add_process_read_fd, add_non_blocking_write_fd) (recompute_input_desc, compute_input_wait_mask) (compute_non_process_wait_mask, compute_non_keyboard_wait_mask) (compute_write_mask, clear_waiting_thread_info) (update_processes_for_thread_death, Fset_process_thread) (Fprocess_thread): New functions. (enum fd_bits): New enumeration. (fd_callback_data): Add 'thread' and 'waiting_thread', rename 'condition' to 'flags'. (set_process_filter_masks, create_process, create_pty) (Fmake_serial_process, finish_after_tls_connection) (connect_network_socket, deactivate_process) (server_accept_connection, wait_reading_process_output) (Fcontinue_process, Fstop_process, keyboard_bit_set) (add_timer_wait_descriptor, add_keyboard_wait_descriptor) (delete_keyboard_wait_descriptor): Use the new functions instead of manipulating fd flags and masks directly. (syms_of_process): Defsubr the new primitives. * src/print.c (print_object): Print threads, mutexes, and conditional variables. * src/lisp.h (enum pvec_type): New values PVEC_THREAD, PVEC_MUTEX, and PVEC_CONDVAR. (XTHREAD, XMUTEX, XCONDVAR, THREADP, MUTEXP, CONDVARP) (CHECK_THREAD, CHECK_MUTEX, CHECK_CONDVAR): New inline functions. (XSETTHREAD, XSETMUTEX, XSETCONDVAR): New macros. (struct handler): Add back byte_stack. Rename lisp_eval_depth to f_lisp_eval_depth. * src/eval.c (specpdl_kind, specpdl_arg, do_specbind) (rebind_for_thread_switch, do_one_unbind) (unbind_for_thread_switch): New functions. (init_eval): 'handlerlist' is not malloc'ed. (specbind): Call do_specbind. (unbind_to): Call do_one_unbind. (mark_specpdl): Accept 2 arguments. (mark_specpdl): Mark the saved value in a let-binding. * src/emacs.c (main): Call init_threads_once, init_threads, and syms_of_threads. * src/data.c (Ftype_of): Support thread, mutex, and condvar objects. (Fthreadp, Fmutexp, Fcondition_variable_p): New functions. (syms_of_data): DEFSYM and defsubr new symbols and primitives. * src/bytecode.c (struct byte_stack, FETCH, CHECK_RANGE) (BYTE_CODE_QUIT): Add back. (exec_byte_code): Add back byte stack manipulation. * src/alloc.c (cleanup_vector): Handle threads, mutexes, and conditional variables. (mark_stack): Now extern; accept additional argument 'bottom'. (flush_stack_call_func): New function. (garbage_collect_1): Call mark_threads and unmark_threads. Don't mark handlers. * src/.gdbinit (xbytecode): Add back. * test/src/thread-tests.el: New tests. * test/src/data-tests.el (binding-test-manual) (binding-test-setq-default, binding-test-makunbound) (binding-test-defvar-bool, binding-test-defvar-int) (binding-test-set-constant-t, binding-test-set-constant-nil) (binding-test-set-constant-keyword) (binding-test-set-constant-nil): New tests. * doc/lispref/processes.texi (Processes and Threads): New subsection. * doc/lispref/threads.texi: New file * doc/lispref/elisp.texi (Top): Include it. * doc/lispref/objects.texi (Thread Type, Mutex Type) (Condition Variable Type): New subsections. (Type Predicates): Add thread-related predicates. * doc/lispref/objects.texi (Editing Types): * doc/lispref/elisp.texi (Top): Update higher-level menus. * etc/NEWS: Mention concurrency features.
| * Fix the test suiteEli Zaretskii2016-12-062-0/+294
| | | | | | | | | | | | * test/automated/bindings.el: Contents moved to test/src/data-tests.el. * test/automated/threads.el: Moved to test/src/thread-tests.el.
* | Give test-completion's PREDICATE the hashtable keyNoam Postavsky2016-12-061-4/+1
| | | | | | | | | | | | | | | | For hashtable entries with symbol keys, `test-completion' would convert the key to a string before calling PREDICATE, unlike `try-completion' and `all-completions'. * src/minibuf.c (Ftest_completion): Pass original key from hashtable.
* | Give test-completion's PREDICATE full alist entryNoam Postavsky2016-12-061-0/+406
|/ | | | | | | | | | | Since 2016-06-26 "Fix test-completion with completion-regexp-list", when calling test-completion with an alist collection, the predicate was recieving the string value instead of the alist entry (Bug#24966). * src/minibuf.c (Ftest_completion): Don't modify the found element, just test STRING against `completion-regexp-list'. * test/src/minibuf-tests.el: New tests for `try-completion', `all-completions', and `test-completion'.