summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2020Paul Eggert2020-01-0149-49/+49
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Allow characters and single-char strings in rx charsetsMattias Engdegård2019-12-131-6/+14
| | | | | | | | | | | | | | | | The `not' and `intersection' forms, and `or' inside these forms, now accept characters and single-character strings as arguments. Previously, they had to be wrapped in `any' forms. This does not add expressive power but is a convenience and is easily understood. * doc/lispref/searching.texi (Rx Constructs): Amend the documentation. * etc/NEWS: Announce the change. * lisp/emacs-lisp/rx.el (rx--charset-p, rx--translate-not) (rx--charset-intervals, rx): Accept characters and 1-char strings in more places. * test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-charset-or) (rx-def-in-charset-or, rx-intersection): Test the change.
* Use `or' instead of `union' for charset union in rxMattias Engdegård2019-12-121-19/+25
| | | | | | | | | | | | | | Design change suggested by Stefan Monnier. * doc/lispref/searching.texi (Rx Constructs): * etc/NEWS: Document. * lisp/emacs-lisp/rx.el (rx--translate-or): Detect charset arguments. (rx--charset-p): New. (rx--translate-not, rx--charset-intervals, rx--translate-union): Change from `union' to `or'. (rx--translate-form, rx--builtin-forms, rx): Remove `union'. * test/lisp/emacs-lisp/rx-tests.el (rx-union, rx-def-in-union) (rx-intersection): Rename tests and change `union' to `or' and `|'.
* ; Spelling fixesPaul Eggert2019-12-102-3/+3
|
* Add `union' and `intersection' to rx (bug#37849)Mattias Engdegård2019-12-101-0/+57
| | | | | | | | | | | | | | | | | | | | | | These character set operations, together with `not' for set complement, improve the compositionality of rx, and reduce duplication in complicated cases. Named character classes are not permitted in set operations. * lisp/emacs-lisp/rx.el (rx--translate-any): Split into multiple functions. (rx--foldl, rx--parse-any, rx--generate-alt, rx--intervals-to-alt) (rx--complement-intervals, rx--intersect-intervals) (rx--union-intervals, rx--charset-intervals, rx--charset-union) (rx--charset-all, rx--charset-intersection, rx--translate-union) (rx--translate-intersection): New. (rx--translate-not, rx--translate-form, rx--builtin-forms, rx): Add `union' and `intersection'. * test/lisp/emacs-lisp/rx-tests.el (rx-union ,rx-def-in-union) (rx-intersection, rx-def-in-intersection): New tests. * doc/lispref/searching.texi (Rx Constructs): * etc/NEWS: Document `union' and `intersection'.
* Spelling fixesPaul Eggert2019-12-091-1/+1
|
* Avoid duplicated character classes in rxMattias Engdegård2019-12-031-1/+3
| | | | | | | | For example, (any digit digit) should produce "[[:digit:]]", not "[[:digit:][:digit:]]". * lisp/emacs-lisp/rx.el (rx--translate-any): Deduplicate character classes. * test/lisp/emacs-lisp/rx-tests.el (rx-any): Add test case.
* Improve errors & warnings due to fancy quoted vars (Bug#32939)Noam Postavsky2019-11-281-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | Add some hints to the message for byte compiler free & unused variable warnings, and 'void-variable' errors where the variable has confusable quote characters in it. * lisp/help.el (uni-confusables), uni-confusables-regexp): New constants. (help-command-error-confusable-suggestions): New function, added to `command-error-function'. (help-uni-confusable-suggestions): New function. * lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref): * lisp/emacs-lisp/cconv.el (cconv--analyze-use): Use it. * lisp/emacs-lisp/lisp-mode.el (lisp--match-confusable-symbol-character): New function. (lisp-fdefs): Use it to fontify confusable characters with font-lock-warning-face when they occur in symbol names. * doc/lispref/modes.texi (Faces for Font Lock): * doc/lispref/objects.texi (Basic Char Syntax): Recommend backslash escaping of confusable characters, and mention new fontification. * etc/NEWS: Announce the new fontification behavior. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fontify-confusables): New test.
* Refix conditional step clauses in cl-loopdickmao2019-11-221-4/+64
| | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl--loop-bindings, cl--loop-symbol-macs, cl-loop): Add cl--loop-conditions, remove cl--loop-guard-cond. (cl--push-clause-loop-body): Apply clause to both cl--loop-conditions and cl--loop-body (cl--parse-loop-clause): Use cl--push-clause-loop-body. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-assignment): Use docstring. (cl-macs-loop-for-as-arith): Removed expected failure. (cl-macs-loop-conditional-step-clauses): Add some tests (bug#29799).
* Expand rx definitions inside (not ...)Mattias Engdegård2019-10-271-1/+16
| | | | | | | | | * lisp/emacs-lisp/rx.el (rx--translate-not): * test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-def-in-not): * doc/lispref/searching.texi (Rx Constructs, Extending Rx): Allow user-defined rx constructs to be expanded inside (not ...) forms, for better composability (bug#37849).
* Don't try to add nil packages on refreshStefan Kangas2019-10-212-0/+18
| | | | | | | | | * lisp/emacs-lisp/package.el (package-read-archive-contents): Don't try to add nil entries. Warn instead. (Bug#28502) * test/lisp/emacs-lisp/package-tests.el (package-test-update-archives/ignore-nil-entry): New test. * test/lisp/emacs-lisp/package-resources/with-nil-entry/archive-contents: New file.
* Use [^z-a] for matching any character (anychar/anything) in rxMattias Engdegård2019-10-181-3/+3
| | | | | | | | | | * lisp/emacs-lisp/rx.el (rx--translate-symbol): * test/lisp/emacs-lisp/rx-tests.el (rx-any, rx-atoms): Use [^z-a] instead of ".\\|\n" for anychar. The new expression is faster (about 2×) and does not allocate regexp stack space. For example, (0+ anychar) now matches strings of any size (bug#37659).
* Add `unmatchable' as alias for (or) in rx (bug#37659)Mattias Engdegård2019-10-181-0/+2
| | | | | | | | | * lisp/emacs-lisp/rx.el (rx--translate-symbol, rx--builtin-symbols, rx): * test/lisp/emacs-lisp/rx-tests.el (rx-atoms): * doc/lispref/searching.texi (Rx Constructs): * etc/NEWS: Add `unmatchable', more descriptive than (or), and corresponding to the variable `regexp-unmatchable'.
* Add `anychar' as alias to `anything' in rx (bug#37659)Mattias Engdegård2019-10-181-2/+2
| | | | | | | | | * lisp/emacs-lisp/rx.el (rx--translate-symbol, rx--builtin-symbols, rx): * test/lisp/emacs-lisp/rx-tests.el (rx-atoms): * doc/lispref/searching.texi (Rx Constructs): * etc/NEWS: Add `anychar', an alias for `anything'. Since `anychar' is more descriptive (and slightly shorter), treat it as the preferred name.
* Correctly explain test failures with mixed uni/multibyte stringsMattias Engdegård2019-10-131-0/+23
| | | | | | | | | * lisp/emacs-lisp/ert.el (ert--explain-equal-rec): * test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-equal): When explaining a difference between a unibyte and a multibyte string, first convert both to multibyte. Otherwise, we might end up comparing unibyte char C to multibyte char C, 127<C<256, and not detect the difference (bug#30219).
* * lisp/emacs-lisp/map.el (map-into) <hash-table>: Allow keyword argsAndrea Corallo2019-10-111-1/+4
| | | | | | | | (map--into-hash): New function, extracted from `map-into <hash-table>`. Speed it up a bit by using gethash instead of map-elt when we know we're accessing a hash table. * test/lisp/emacs-lisp/map-tests.el (test-map-into): Add corresponding test.
* Remove two checkdoc tests checked in by mistakeLars Ingebrigtsen2019-10-111-16/+0
| | | | | * test/lisp/emacs-lisp/checkdoc-tests.el: Remove &aux and &context checks mistakenly checked in (as these aren't implemented) (bug#37697).
* checkdoc CL testsDamien Cassou2019-10-101-0/+106
| | | | | * test/lisp/emacs-lisp/checkdoc-tests.el: Add cl-lib-related tests (bug#37063).
* Filter packages by name in list-packages. (Bug#36981)Federico Tedin2019-10-081-0/+22
| | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/package.el (package-menu-filter-by-name): New function to filter packages by name. (package-menu-clear-filter): New function to clear applied filters. (package-menu-filter-by-keyword): Rename function from package-menu-filter. (package-menu--generate): Don't change 'q' binding anymore. (package-menu-mode-map): Bind '/ n' to package-menu-filter-by-name, '/ k' to package-menu-filter-by-keyword and '/ /' to package-menu-clear-filter. (package-menu-mode-menu): Update menu entries for the three functions. * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name) (package-test-list-clear-filter): New tests. * doc/emacs/package.texi: Document usage of package-menu-filter-by-name, package-menu-clear-filter and update reference to package-menu-filter-by-keyword. * etc/NEWS: Announce changes.
* * lisp/emacs-lisp/package.el (package--get-deps): Fix thinkoStefan Monnier2019-10-081-17/+8
| | | | | * test/lisp/emacs-lisp/package-tests.el (package-test-get-deps): Adjust test to new calling convention.
* More doc fixes in package.el (Bug#37544)Stefan Kangas2019-10-041-1/+6
| | | | | | | | | | | * lisp/emacs-lisp/package.el (package-menu-hide-low-priority) (package-pinned-packages, package-load-descriptor) package-archive-version, package-archive-contents) package--read-archive-file, package-read-archive-contents) (package-unsigned-archives, package-read-all-archive-contents) (package--download-and-read-archives, package-install): * lisp/subr.el (package--description-file): * test/lisp/emacs-lisp/package-tests.el: Doc fixes.
* Add `rx-submatch-n' for compatibility (bug#37517)Mattias Engdegård2019-09-291-0/+3
| | | | | | | | It was an internal symbol in the old `rx' implementation, used in old versions of the `flycheck' package. * lisp/emacs-lisp/rx.el (rx-submatch-n): Alias of `rx-to-string'. * test/lisp/emacs-lisp/rx-tests.el (rx-compat): Test it.
* Add rx extension mechanismMattias Engdegård2019-09-251-0/+98
| | | | | | | | | | | | | | | | | | Add a built-in set of extension macros: `rx-define', `rx-let' and `rx-let-eval'. * lisp/emacs-lisp/rx.el (rx-constituents, rx-to-string): Doc updates. (rx--builtin-symbols, rx--builtin-names, rx--local-definitions) (rx--lookup-def, rx--substitute, rx--expand-template) (rx--make-binding, rx--make-named-binding, rx--extend-local-defs) (rx-let-eval, rx-let, rx-define): New. (rx--translate-symbol, rx--translate-form): Use extensions if any. (rx): Use local definitions. * test/lisp/emacs-lisp/rx-tests.el (rx-let, rx-define) (rx-to-string-define, rx-let-define, rx-let-eval): New. * etc/NEWS (Changes in Specialized Modes and Packages): * doc/lispref/searching.texi (Rx Notation, Rx Functions, Extending Rx): Add node about rx extensions.
* New rx implementationMattias Engdegård2019-09-251-89/+247
| | | | | | | | | | | | * lisp/emacs-lisp/rx.el: * test/lisp/emacs-lisp/rx-tests.el: * doc/lispref/searching.texi (Rx Constructs): Rewrite rx for correctness, clarity, and performance. The new implementation retains full compatibility and has more comprehensive tests. * lisp/emacs-lisp/re-builder.el (reb-rx-font-lock-keywords): Adapt to changes in internal variables in rx.el.
* Update some URLsPaul Eggert2019-09-231-1/+1
| | | | | | | | | | | | | | | | | This mostly changes http: to https: in URLs. It also updates some URLs that have moved, removes some URLs that no longer work, recommends against using procmail (procmail.org no longer works), and removes some mentions of the no-longer-existing Gmane, LPF and VTW. It doesn't update all URLs, just the ones I had time for. * GNUmakefile (help): * admin/admin.el (manual-doctype-string): * admin/charsets/Makefile.in (${charsetdir}/ALTERNATIVNYJ.map): * admin/charsets/mapconv: * lisp/net/soap-client.el (soap-create-envelope): * lisp/org/org.el (org-doi-server-url): * lisp/textmodes/bibtex.el (bibtex-generate-url-list): Prefer https: to http: un URLs.
* Add backquote testsTino Calancha2019-09-161-0/+47
| | | | * test/lisp/emacs-lisp/backquote-tests.el: New file (bug#37432).
* Create common tests for print.c and cl-print.elGemini Lasswell2019-09-131-112/+3
| | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/cl-print-tests.el (cl-print--test, cl-print-tests-1, cl-print-tests-2) (cl-print-tests-3, cl-print-tests-4, cl-print-tests-5) (cl-print-tests-strings, cl-print-circle, cl-print-circle-2): Remove. * test/src/print-tests.el (print-tests--prin1-to-string): New alias. (print-tests--deftest): New macro. (print-hex-backslash, print-read-roundtrip, print-bignum): Define with print-tests--deftest and use print-tests--prin1-to-string. (print-tests--prints-with-charset-p): Use print-tests--prin1-to-string. (print-tests--print-charset-text-property-nil) (print-tests--print-charset-text-property-t) (print-tests--print-charset-text-property-default): Define with print-tests--deftest. (print-tests-print-gensym) (print-tests-continuous-numbering, print-tests-1, print-tests-2) (print-tests-3, print-tests-4, print-tests-5) (print-tests-strings, print-circle, print-circle-2): New tests. (print--test, print-tests-struct): New cl-defstructs.
* Improve print output options commands in backtrace-mode (bug#36566)Gemini Lasswell2019-09-131-0/+49
| | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/backtrace.el (backtrace-view): Mention :print-gensym in docstring. (backtrace-mode-map): Add keyboard binding for backtrace-toggle-print-gensym. Add menu entries for backtrace-toggle-print-circle and backtrace-toggle-print-gensym. (backtrace--with-output-variables): Bind print-gensym with value of :print-gensym found in view plist. (backtrace-toggle-print-circle): Remove description of implementation details from docstring. (backtrace-toggle-print-gensym): New command. (backtrace--toggle-feature): Add echo area message describing result of command. * test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--print-circle): New test. * doc/lispref/debugging.texi (Backtraces): Document keyboard binding for backtrace-toggle-print-gensym.
* Merge from origin/emacs-26Glenn Morris2019-08-201-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0b810eb Fix a typo in char-width-table 3f00db7 Minor update in admin/notes/unicode bcd0115 Fix lisp indent infloop on unfinished strings (Bug#37045) 5f992d1 Improve commentary in composite.el 3a04be2 ; Improve commentary in xdisp.c 15de1d1 Fix markup in dired-x.texi bda7fc7 ; Fix typo in a doc string of speedbar.el 6f57ef9 * src/callproc.c (Fcall_process): Doc fix. # Conflicts: # doc/misc/dired-x.texi # lisp/international/characters.el # src/callproc.c
| * Fix lisp indent infloop on unfinished strings (Bug#37045)Noam Postavsky2019-08-171-1/+5
| | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-indent-calc-next): Stop trying to skip over strings if we've hit the end of buffer. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-indent-unfinished-string): New test.
* | Tests need to be moved when source files areGlenn Morris2019-08-071-35/+0
| | | | | | | | * test/lisp/obsolete/cl-tests.el: Move from test/lisp/emacs-lisp.
* | New function time-convertPaul Eggert2019-08-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the awkward reuse of encode-time to both convert calendrical timestamps to Lisp timestamps, and to convert Lisp timestamps to other forms. Now, encode-time does just the former and the new function does just the latter. The new function builds on a suggestion by Lars Ingebrigtsen in: https://lists.gnu.org/r/emacs-devel/2019-07/msg00801.html and refined by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2019-07/msg00803.html * doc/lispref/os.texi (Time of Day, Time Conversion): * doc/misc/emacs-mime.texi (time-date): * etc/NEWS: Update documentation. * lisp/calendar/cal-dst.el (calendar-next-time-zone-transition): * lisp/calendar/time-date.el (seconds-to-time, days-to-time): * lisp/calendar/timeclock.el (timeclock-seconds-to-time): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-add-item): * lisp/emacs-lisp/cl-extra.el (cl--random-time): * lisp/emacs-lisp/timer.el (timer--time-setter) (timer-next-integral-multiple-of-time): * lisp/find-lisp.el (find-lisp-format-time): * lisp/gnus/gnus-diary.el (gnus-user-format-function-d): * lisp/gnus/gnus-group.el (gnus-group-set-timestamp): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda): * lisp/gnus/nnrss.el (nnrss-normalize-date): * lisp/gnus/nnspool.el (nnspool-request-newgroups): * lisp/net/ntlm.el (ntlm-compute-timestamp): * lisp/net/pop3.el (pop3-uidl-dele): * lisp/obsolete/vc-arch.el (vc-arch-add-tagline): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-clock-in) (org-clock-out, org-clock-sum): * lisp/org/org-id.el (org-id-uuid, org-id-time-to-b36): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/proced.el (proced-format-time): * lisp/progmodes/cc-cmds.el (c-progress-init) (c-progress-update): * lisp/progmodes/cperl-mode.el (cperl-time-fontification): * lisp/progmodes/flymake.el (flymake--schedule-timer-maybe): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): * lisp/tar-mode.el (tar-octal-time): * lisp/time.el (emacs-uptime): * lisp/url/url-auth.el (url-digest-auth-make-cnonce): * lisp/url/url-util.el (url-lazy-message): * lisp/vc/vc-cvs.el (vc-cvs-parse-entry): * lisp/vc/vc-hg.el (vc-hg-state-fast): * lisp/xt-mouse.el (xterm-mouse-event): * test/lisp/emacs-lisp/timer-tests.el: (timer-next-integral-multiple-of-time-2): Use time-convert, not encode-time. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): Don’t use now-removed FORM argument for encode-time. It wasn’t crucial anyway. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add time-convert. * lisp/emacs-lisp/elint.el (elint-unknown-builtin-args): Update encode-time signature to match current arg set. * lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time): Use timer-convert with t rather than doing it by hand. * src/timefns.c (time_hz_ticks, time_form_stamp, lisp_time_form_stamp): Remove; no longer needed. (decode_lisp_time): Rturn the form instead of having a *PFORM arg. All uses changed. (time_arith): Just return TICKS if HZ is 1. (Fencode_time): Remove argument FORM. All callers changed. Do not attempt to encode time values; just encode decoded (calendrical) times. Unless CURRENT_TIME_LIST, just return VALUE since HZ is 1. (Ftime_convert): New function, which does the time value conversion that bleeding-edge encode-time formerly did. Return TIME if it is easy to see that it is already of the correct form. (Fcurrent_time): Mention in doc that the form is planned to change. * test/src/timefns-tests.el (decode-then-encode-time): Don’t use (encode-time nil).
* | Make let-alist work with vectorsLars Ingebrigtsen2019-07-281-0/+5
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/let-alist.el (let-alist--deep-dot-search): Descend into vectors, too, looking for dotted variables (bug#23244). Test case: (let-alist '((a . 1) (b . 2)) `[,(+ .a) ,(+ .a .b .b)])
* | `unknown' test case now worksLars Ingebrigtsen2019-07-281-1/+0
| |
* | Conditionalize result of a bytecomp testGlenn Morris2019-07-091-0/+1
| | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--switch-duplicates): Apparently the result depends on byte-compile-cond-use-jump-table.
* | Add tests for text-property-search to check prop-match-valueStefan Kangas2019-07-061-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/text-property-search-tests.el (with-match-test): New macro. (text-property-search-forward-prop-match-match-face-nil-nil) (text-property-search-forward-prop-match-match-face-bold-t) (text-property-search-forward-prop-match-match-face-bold-nil) (text-property-search-backward-prop-match-match-face-nil-nil) (text-property-search-backward-prop-match-match-face-italic-t) (text-property-search-backward-prop-match-match-face-italic-nil): Add test cases to also verify the value of prop-match-value (bug#36486).
* | Optimise more inputs to `regexp-opt' (bug#36444)Mattias Engdegård2019-07-041-1/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a more precise test to determine whether the input to `regexp-opt' is safe to optimise when KEEP-ORDER is non-nil, permitting more inputs to be optimised than before. For example, ("good" "goal" "go") is now accepted. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): More precise test for whether the list is safe w.r.t. KEEP-ORDER. (regexp-opt--contains-prefix): Remove. * test/lisp/emacs-lisp/regexp-opt-tests.el: Use lexical-binding. (regexp-opt-test--permutation, regexp-opt-test--factorial) (regexp-opt-test--permutations, regexp-opt-test--match-all) (regexp-opt-test--check-perm, regexp-opt-test--explain-perm) (regexp-opt-keep-order): Test KEEP-ORDER.
* | Allow empty argument to `regexp-opt-charset'Mattias Engdegård2019-06-291-5/+24
| | | | | | | | | | | | * test/lisp/emacs-lisp/regexp-opt-tests.el (regexp-opt-charset): Handle nil argument, and use regexp-quote for singletons. * lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Expand tests.
* | Fix (rx-to-string (and (literal STR) (regexp STR)) regressionNoam Postavsky2019-06-261-0/+4
| | | | | | | | | | | | * lisp/emacs-lisp/rx.el (rx-regexp, rx-literal): Check the cadr of the form for stringness, not the form itself. * test/lisp/emacs-lisp/rx-tests.el (rx-to-string-lisp-forms): New test.
* | Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)Noam Postavsky2019-06-251-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/rx.el (rx-regexp): Allow non-string forms. (rx-constituents): Add literal constituent, which is like a plain STRING form, but allows arbitrary lisp expressions. (rx-literal): New function. (rx-compile-to-lisp): New variable. (rx--subforms): New helper function for handling subforms, including non-constant case. (rx-group-if, rx-and, rx-or, rx-=, rx->=, rx-repeat, rx-submatch) (rx-submatch-n, rx-kleene, rx-atomic-p): Use it to handle non-constant subforms. (rx): Document new form, wrap non-constant forms with concat call. * test/lisp/emacs-lisp/rx-tests.el (rx-tests--match): New macro. (rx-nonstring-expr, rx-nonstring-expr-non-greedy): New tests. * etc/NEWS: Announce changes.
* | Compile any subsequence of `cond' clauses to switch (bug#36139)Mattias Engdegård2019-06-191-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A single `cond' form can how be compiled to any number of switch ops, optionally interspersed with non-switch conditions. Previously, switch ops would only be used for whole `cond' forms containing no other tests. * lisp/emacs-lisp/bytecomp.el (byte-compile--cond-vars): Rename from `byte-compile-cond-vars'. (byte-compile--default-val): Remove. (byte-compile--cond-switch-prefix): Replace `byte-compile-cond-jump-table-info'; now also returns trailing non-switch clauses. (byte-compile-cond-jump-table): New arguments; no longer compiles the default case. (byte-compile-cond): Look for and compile switches at any place in the list of clauses. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test expression.
* | Compile cond with heterogeneous tests into switch (bug#36139)Mattias Engdegård2019-06-191-1/+24
| | | | | | | | | | | | | | | | | | | | Allow any mixture of `eq', `eql' and `equal', `memq', `memql' and `member' in a switch-like `cond' to be compiled into a single switch. * lisp/emacs-lisp/bytecomp.el (byte-compile--common-test): New. (byte-compile-cond-jump-table-info): Use most specific common test. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test cases for multi-value clause cond forms.
* | Tighter pcase or-pattern member function selection (bug#36139)Mattias Engdegård2019-06-191-2/+4
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/pcase.el (pcase--u1): Use the most specific of `memq', `memql' and `member' in or-patterns with constant cases. This improves performance and may help the byte-code compiler generate a switch. * test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member): Add mixed-type or-pattern test cases.
* | Disable filling of warnings in a bytecomp testGlenn Morris2019-06-161-1/+2
| | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): Disable filling rather than working around it.
* | Also test unpackingLars Ingebrigtsen2019-06-151-0/+26
| |
* | Refactor for reuseLars Ingebrigtsen2019-06-151-28/+31
| |
* | New file to test bindat functionsLars Ingebrigtsen2019-06-151-0/+70
| |
* | Allow for line breaks in a bytecomp testGlenn Morris2019-06-121-0/+1
| | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): Warnings from the byte compiler may be filled.
* | Give more information in a bytecomp test failureGlenn Morris2019-06-121-2/+2
| | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): More informative failure messages.
* | Add the new macro with-suppressed-warningsLars Ingebrigtsen2019-06-121-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): New macro. * doc/lispref/compile.texi (Compiler Errors): Document with-suppressed-warnings and deemphasise with-no-warnings slightly. * lisp/emacs-lisp/bytecomp.el (byte-compile--suppressed-warnings): New internal variable. (byte-compile-warning-enabled-p): Heed byte-compile--suppressed-warnings, bound via with-suppressed-warnings. (byte-compile-initial-macro-environment): Provide a macro expansion of with-suppressed-warnings. (byte-compile-file-form-with-suppressed-warnings): New byte hunk handler for the suppressed symbol machinery. (byte-compile-suppressed-warnings): Ditto for the byteop. (byte-compile-file-form-defmumble): Ditto. (byte-compile-form, byte-compile-normal-call) (byte-compile-normal-call, byte-compile-variable-ref) (byte-compile-set-default, byte-compile-variable-set) (byte-compile-function-form, byte-compile-set-default) (byte-compile-warn-obsolete, byte-compile--declare-var): Pass the symbol being warned in to byte-compile-warning-enabled-p. * test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): New function. (bytecomp-test--with-suppressed-warnings): Tests.