summaryrefslogtreecommitdiff
path: root/test/lisp/subr-tests.el
Commit message (Collapse)AuthorAgeFilesLines
* char-uppercase-p: New predicateTino Calancha2022-05-111-0/+7
| | | | | | | | | | | Return non-nil if its argument is an uppercase character. Suggested in Bug#54804. * lisp/subr.el (char-uppercase-p): New defun. * etc/NEWS (Lisp Changes in Emacs 29.1): Announce it * doc/lispref/display.texi (Size of Displayed Text): Document it. * test/lisp/subr-tests.el (test-char-uppercase-p): Add a test.
* Fix compilation warnings in newer subr testsLars Ingebrigtsen2022-05-071-11/+12
| | | | | * test/lisp/subr-tests.el (test-local-set-state): Fix compilation warnings.
* Add char-folding of double quotes in isearch-fold-quotes-mode (bug#24510)Juri Linkov2022-05-061-0/+3
| | | | | | | | * lisp/isearch.el (isearch-fold-quotes-mode): Add char-folding of double quotation marks. * test/lisp/subr-tests.el (test-local-set-state): Test values after setting state.
* Move buffer-local-set-state to subr because it's used at runtimeLars Ingebrigtsen2022-05-061-0/+12
| | | | | | * lisp/subr.el (buffer-local-set-state) (buffer-local-set-state--get, buffer-local-restore-state): Moved from easy-mmode.el because they have to be available run-time.
* Make some recently added tests actually runLars Ingebrigtsen2022-05-031-2/+3
|
* Fix key-parse problem with C-x ( ... sequencesLars Ingebrigtsen2022-05-031-0/+4
| | | | | | | | * lisp/keymap.el (key-parse): Move the read-kbd-macro compat code from here... * lisp/subr.el (kbd): ... to here. (And fix the logic, too.) This allows `key-parse' to have a less puzzling result while maintaining backwards compatibility (bug#38775).
* Fix the OMIT-NULLS + "" case in string-linesLars Ingebrigtsen2022-05-021-0/+1
| | | | | * lisp/subr.el (string-lines): Respect OMIT-NULLS when given an empty string.
* Fix string-lines return for ""Lars Ingebrigtsen2022-05-011-0/+2
| | | | | * lisp/subr.el (string-lines): Return the correct result on "" (bug#55213).
* Change string-lines semantics slightlyLars Ingebrigtsen2022-05-011-1/+1
| | | | | * lisp/subr.el (string-lines): Change the semantics slightly -- don't return an empty string for a trailing newline.
* Add a KEEP-NEWLINES argument to string-linesLars Ingebrigtsen2022-04-301-0/+22
| | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/subr.el (string-lines): Add a KEEP-NEWLINES argument.
* Add new function 'readablep'Lars Ingebrigtsen2022-01-221-0/+4
| | | | | * doc/lispref/streams.texi (Input Functions): Document it. * lisp/subr.el (readablep): New function (bug#52566).
* Add new function function-alias-pLars Ingebrigtsen2022-01-131-0/+17
| | | | | * doc/lispref/functions.texi (Defining Functions): Document it. * lisp/subr.el (function-alias-p): New function (bug#53178).
* Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
* | Silence byte-compiler in some testsStefan Kangas2021-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/dired-tests.el: * test/lisp/emacs-lisp/cl-macs-tests.el: * test/lisp/emacs-lisp/derived-tests.el: * test/lisp/emacs-lisp/eieio-tests/eieio-tests.el: * test/lisp/emacs-lisp/generator-tests.el: * test/lisp/emacs-lisp/lisp-tests.el: * test/lisp/emacs-lisp/seq-tests.el (test-seq-let) (test-seq-setq): * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-if-let*-false) (subr-x-test-if-let*-and-laziness-is-preserved) (subr-x-test-when-let*-false) (subr-x-test-when-let*-and-laziness-is-preserved): * test/lisp/emacs-lisp/timer-tests.el (timer-tests-debug-timer-check): * test/lisp/format-spec-tests.el (format-spec-do-flags-truncate) (format-spec-do-flags-pad): * test/lisp/ls-lisp-tests.el (ls-lisp-test-bug27762): * test/lisp/obsolete/cl-tests.el (labels-function-quoting): * test/lisp/progmodes/elisp-mode-tests.el: * test/lisp/replace-tests.el (replace-regexp-bug45973): * test/lisp/ses-tests.el: * test/lisp/subr-tests.el: * test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode): * test/src/data-tests.el (data-tests--set-default-per-buffer): * test/src/search-tests.el (test-replace-match-modification-hooks): Silence byte-compiler.
* | Make 'eval' use lexical scoping in most testsStefan Kangas2021-11-201-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/electric-tests.el (electric-pair-define-test-form) (define-electric-pair-test): * test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--uncompiled-functions): * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-test--symbol-macrolet): * test/lisp/emacs-lisp/let-alist-tests.el (let-alist-list-to-sexp): * test/lisp/emacs-lisp/lisp-tests.el (elisp-tests-with-temp-buffer, core-elisp-tests-3-backquote): * test/lisp/emacs-lisp/testcover-resources/testcases.el (testcover-testcase-nth-case): * test/lisp/ffap-tests.el (ffap-ido-mode): * test/lisp/files-tests.el (file-test--do-local-variables-test): * test/lisp/net/tramp-tests.el (tramp--test-utf8): * test/lisp/progmodes/elisp-mode-tests.el (find-defs-defgeneric-eval, find-defs-defun-eval) (find-defs-defvar-eval, find-defs-face-eval) (find-defs-feature-eval): Give 'eval' non-nil LEXICAL argument. * test/lisp/subr-tests.el (subr-tests--dolist--wrong-number-of-args): * test/src/eval-tests.el (eval-tests--if-dot-string) (eval-tests--mutating-cond) (eval-tests-19790-backquote-comma-dot-substitution): Test 'eval' using LEXICAL as both nil and non-nil. (eval-tests--let-with-circular-defs): Give explicit nil to 'eval'.
* | Add new 'keymap-*' functionsLars Ingebrigtsen2021-11-161-107/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/keymap.el: New file with all the new keymap-* functions. * lisp/loadup.el ("keymap"): Load. * lisp/subr.el (kbd): Refactor out all the code to key-parse. (define-key-after, keyboard-translate, global-set-key) (local-set-key, global-unset-key, local-unset-key) (local-key-binding, global-key-binding) (substitute-key-definition): Note in doc strings that these are legacy functions. (define-keymap--define): Use keymap-set. * lisp/emacs-lisp/byte-opt.el: Remove the optimizations for defvar-keymap and define-keymap since the macros now only understand the kbd syntax. * lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap) (byte-compile-define-keymap--define): Warn about invalid key definitions in all keymap-* functions. * lisp/emacs-lisp/shortdoc.el (keymaps): Add shortdocs form keymap* functions. * src/keymap.c (possibly_translate_key_sequence): Adjust callers to key-valid-p and key-parse. (syms_of_keymap): Adjust defs.
* | Do kbd-valid-p prefix comparisons case-sensitivelyLars Ingebrigtsen2021-10-181-0/+1
| | | | | | | | * lisp/subr.el (kbd-valid-p): Compare case-sensitively.
* | Allow <mouse-1> in kbd-valid-pLars Ingebrigtsen2021-10-171-0/+3
| | | | | | | | * lisp/subr.el (kbd-valid-p): Allow (kbd-valid-p "<mouse-1>").
* | Add new function 'kbd-valid-p'Lars Ingebrigtsen2021-10-161-0/+114
| | | | | | | | | | | | | | * doc/lispref/keymaps.texi (Key Sequences): New function 'kbd-valid-p'. * lisp/subr.el (kbd-valid-p): Document it.
* | New tests for kbd and edmacro-parse-keysStefan Kangas2021-10-131-4/+107
| | | | | | | | | | * test/lisp/edmacro-tests.el: New file. * test/lisp/subr-tests.el (subr-test-kbd): Expand test.
* | Merge from origin/emacs-28Glenn Morris2021-10-041-8/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3b8dda6c90 Add safety check in x_menu_show e1fb731393 Tweak x_connection_closed when I/O error 595e506c82 * lisp/erc/erc.el (erc-user-mode): Set "+i" by default. d00f3d4c05 Port unused decls to C2x 317eb2d5b5 Improve structure of TODO c0793cd9de Don't use some obsolete names in documentation 87153cc915 Tweak x_hide_tip for consistency 7e871dcd27 Remove encode_terminal_code UNINITs 2a00634880 Port pdumper.c maybe_unused to C2x 6d9b3c0eaa Port systhreads.h to C2x fd274d7d24 Pacify -Wanalyzer-null-argument in lisp_malloc cc3fc94f09 Pacify gcc 11.2.1 -Wanalyzer-null-argument d3a832a61a Simplify hack-read-symbol-shorthands again (bug#50946) 4831426158 Fix recipe for 'native-lisp' directory 0bb42ef803 ; * lisp/time-stamp.el (time-stamp-format): Doc string. 732c70a0d9 Simplify socket symlink-attack checking fc32a3bd95 ; * doc/lispref/files.texi (Reading from Files): Fix wording. 3cc77aa976 Clarify (elisp) insert-file-contents with BEG or END not o... 5deeb0947d * src/Makefile.in: Simplify conditionals. 121a5abeae Move context-menu selection items Defun/List/Symbol to pro... 0c341e6e84 * lisp/tab-bar.el (tab-bar-detach-tab): Handle frame selec... 931a7276c0 * lisp/tab-line.el (tab-line-format): Add face-modified to... 3863919a00 Fix unmounting in Tramp 7a6d34cd1f * etc/themes/light-blue-theme.el: Add "Maintainer: emacs-d... c1b1e1f545 Define HAVE_NATIVE_COMP in src/Makefile.in 137fa2d716 Rename elisp-shorthands to read-symbol-shorthands e6fbc45b7b Font-lock shorthands in elisp-mode for quick visual recogn... 17e6f3bee5 ; Fix last change in tramp-sshfs.el 3dae1e33d1 Suppress superfluous error messages in Tramp b228ec9fab Fix reading the tail of a file in shorthands.el 7fb2789509 Fix substitution of pretty quotes in code in easy-mmode b47d7ce1b8 Fix agent directory deletion b1a8a66fb0 ; * etc/TODO: Fix previous commit; delete the right thing. 6c01a21365 Clarify the purpose of internal--format-docstring-line 55dadbc57e * lisp/net/dictionary.el (context-menu-dictionary): Move m... bb209cd5ab Update to Org 9.5-30-g10dc9d 4341e79a5f Remove bogus ":safe t" custom properties b6f6b593c6 Fix 'apropos-compact-layout' 62d6cecfcd Remove bogus ":safe nil" custom properties f9111d8784 The safe-local-variable property is a function (bug#50944) 3dc094abee ; Some minor tweaks to TODO a5b4356d37 Revert "; * etc/TODO: Move elpa.gnu.org items to the end." 7bc0cee115 Revert "* etc/TODO: Rearrange to start with "Simple tasks"." 3489471417 Fix selection of fonts for Arabic on Posix platforms 13e5943386 ; Fix a typo in a doc string bd60fca2fa Fix ox-koma-letter compilation warnings 340e527bed Preload paren.el a9052248da Improve documentation of 'shift-select-mode' d505971894 ; Standardize some license headers 9307889d68 Simplify shorthand injection (bug#50946) 5c77cc9584 ; * admin/release-branch.txt: Tweak previous. # Conflicts: # etc/NEWS # test/lisp/subr-tests.el
| * Clarify the purpose of internal--format-docstring-lineStefan Kangas2021-10-031-8/+7
| | | | | | | | | | | | | | | | | | * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): * lisp/subr.el (internal--format-docstring-line): Make it more clear that this function is not intended for the first line of a docstring. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Add comment explaining why we use 'internal--format-docstring-line'. Problem pointed out by Stefan Monnier <monnier@iro.umontreal.ca>.
* | Expand internal--format-docstring-line testStefan Kangas2021-10-021-1/+2
|/ | | | | * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): Check for error on newline.
* Fix automatic filling of docstring in cl-defstructStefan Kangas2021-09-271-0/+12
| | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix bug where a paragraph was filled as if it were a single line, which led to garbled output in the docstring. (Bug#50839) * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): New test.
* Don't quote nil and t in doc strings and commentsLars Ingebrigtsen2021-09-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/src/minibuf-tests.el (test-try-completion-ignore-case): * test/lisp/url/url-auth-tests.el (url-auth-test-digest-auth-retrieve-cache): * test/lisp/subr-tests.el (subr-tests-add-hook-depth): * test/lisp/so-long-tests/so-long-tests.el (so-long-tests-invisible-buffer-function): * test/lisp/emacs-lisp/tabulated-list-test.el (tabulated-list-sort): * src/xfaces.c: * src/process.c (Finterrupt_process): (syms_of_process): * src/minibuf.c (Fread_from_minibuffer): (Fcompleting_read): (syms_of_minibuf): * src/dispnew.c (syms_of_display): * src/data.c: * lisp/so-long.el (so-long--hack-local-variables): * lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions): (elisp--xref-find-definitions): * lisp/org/ox-html.el (org-html-htmlize-output-type): * lisp/org/org-agenda.el (org-agenda-do-in-region): * lisp/net/tramp.el: * lisp/minibuffer.el (set-minibuffer-message): * lisp/isearch.el (isearch-wrap-pause): (isearch-repeat-on-direction-change): * lisp/emacs-lisp/timer.el (timer): * lisp/emacs-lisp/package.el (package-read-archive-contents): * lisp/emacs-lisp/faceup.el (faceup-next-property-change): * lisp/emacs-lisp/comp.el (comp-func): * lisp/emacs-lisp/comp-cstr.el (comp-cstr-empty-p): * lisp/emacs-lisp/cl-macs.el (cl-do): (cl-do*): (cl--self-tco): * lisp/emacs-lisp/bytecomp.el (byte-compile-unresolved-functions): (byte-compile-cond-jump-table): Don't quote t and nil.
* Add new function `ensure-list'Lars Ingebrigtsen2021-09-211-0/+5
| | | | | | | | * doc/lispref/lists.texi (Building Lists): Document it. * lisp/subr.el (ensure-list): New function. * lisp/emacs-lisp/shortdoc.el (list): Mention it.
* Move cl-lib tests for caaXr to subr-tests.elStefan Kangas2021-09-031-0/+19
| | | | | | | * test/lisp/emacs-lisp/cl-lib-tests.el (cl-test-caaar) (cl-test-caadr): Move tests using a cl-lib alias from here... * test/lisp/subr-tests.el (subr-test-caaar, subr-test-caadr): ...to here. The functions under test are in subr.el.
* Add new macro `with-existing-directory'Lars Ingebrigtsen2021-09-011-0/+8
| | | | | * doc/lispref/files.texi (Testing Accessibility): Document it. * lisp/subr.el (with-existing-directory): New macro (bug#32004).
* Add new functions to replace strings/regexp in a regionLars Ingebrigtsen2021-08-161-0/+46
| | | | | | | | * doc/lispref/searching.texi (Search and Replace): Document them. * lisp/subr.el (replace-string-in-region) (replace-regexp-in-region): New functions. * lisp/emacs-lisp/shortdoc.el (regexp, buffer): Mention them.
* ; * test/lisp/subr-tests.el (subr-tests-add-hook-depth): Fix a typo.Philipp Stephani2021-07-051-1/+1
|
* Add new convenience function `buffer-local-boundp'Lars Ingebrigtsen2021-05-311-0/+10
| | | | | | | * doc/lispref/variables.texi (Creating Buffer-Local): Document it. * lisp/subr.el (buffer-local-boundp): New function. * src/data.c (Flocal_variable_p): Mention it.
* Fix failing subr testLars Ingebrigtsen2021-04-271-1/+1
| | | | | * test/lisp/subr-tests.el (subr-tests-bug22027): Fix mocked signature of `read-string' (bug#48022).
* Merge remote-tracking branch 'savannah/master' into native-compAndrea Corallo2021-03-121-1/+6
|\
| * Fix string-replace error dataBasil L. Contovounesios2021-03-071-1/+6
| | | | | | | | | | | | | | | | * lisp/subr.el (string-replace): Signal an error with data that is a list, and whose contents are consistent with other uses of wrong-length-argument. * test/lisp/subr-tests.el (string-replace): Test for this. (subr-test-define-prefix-command): Pacify byte-compiler warnings.
* | Merge remote-tracking branch 'savannah/master' into native-compAndrea Corallo2021-01-161-0/+20
|\|
| * Lift {global,local}-key-binding to LispStefan Kangas2021-01-131-0/+11
| | | | | | | | | | | | | | | | * lisp/subr.el (local-key-binding, global-key-binding): New defuns. * src/keymap.c (Flocal_key_binding, Fglobal_key_binding): Remove DEFUNs. (syms_of_keymap): Remove defsubrs for above DEFUNs. * test/lisp/subr-tests.el (subr-test-local-key-binding) (subr-test-global-key-binding): New tests.
| * * lisp/subr.el (letrec): Optimize some non-recursive bindingsStefan Monnier2021-01-081-0/+9
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): Look inside bytecode objects as well. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): * test/lisp/subr-tests.el (subr--tests-letrec): New tests.
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2021-01-081-0/+29
|\|
| * Merge recently added kbd testsStefan Kangas2021-01-081-10/+8
| | | | | | | | | | | | * test/lisp/subr-tests.el (subr--kbd): Merge test... (subr-test-kbd): ...with this one. Fix thinko in my previous commit. Thanks to Mattias EngdegÄrd <mattiase@acm.org>.
| * Lift define-prefix-command to LispStefan Kangas2021-01-081-0/+11
| | | | | | | | | | | | | | | | * lisp/subr.el (define-prefix-command): New defun. * src/keymap.c (Fdefine_prefix_command): Remove DEFUN. (syms_of_keymap): Remove defsubr for Fdefine_prefix_command. * test/lisp/subr-tests.el (subr-test-define-prefix-command): New test.
| * * test/lisp/subr-tests.el (subr-test-kbd): New test.Stefan Kangas2021-01-081-0/+12
| |
| * Pretty-print keys without <> around modifiers (bug#45536)Mattias EngdegÄrd2021-01-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Be consistent when pretty-printing keys: put modifiers outside <>, thus the more logical C-M-<return> instead of <C-M-return>. * src/keymap.c (Fsingle_key_description): Skip modifier prefix before adding <>. * doc/lispref/help.texi (Describing Characters): Update example. * doc/lispref/debugging.texi (Backtraces): * doc/lispref/minibuf.texi (Text from Minibuffer): Use @kbd instead of @key. * etc/NEWS: Announce the change. * test/src/keymap-tests.el (keymap--key-description): * test/lisp/subr-tests.el (subr--kbd): New tests.
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2021-01-021-1/+21
|\|
| * Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
| * Revert recent add-to-ordered-list changesLars Ingebrigtsen2021-01-011-20/+0
| | | | | | | | | | | | | | * doc/lispref/lists.texi (List Variables): Revert. * lisp/subr.el (add-to-ordered-list): Revert recent changes because the semantics are too muddled.
| * Allow add-to-ordered-list to use a test predicateLars Ingebrigtsen2020-12-311-2/+26
| | | | | | | | | | | | | | * doc/lispref/lists.texi (List Variables): Update manual. * lisp/subr.el (add-to-ordered-list): Allow using a test predicate, and make slightly more efficient (bug#45539).
| * Add test for add-to-ordered-listLars Ingebrigtsen2020-12-311-0/+16
| |
* | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-12-201-0/+12
|\|
| * Convert apropos-internal from C to Lisp (Bug#44529)Stefan Kangas2020-12-191-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This runs insignificantly faster in C, and is already fast enough on reasonably modern hardware. We might as well lift it to Lisp. This benchmark can be used to verify: (benchmark-run 10 (apropos-command "test")) => (0.12032415399999999 2 0.014772391999999995) ; C => (0.13513192100000002 2 0.017216643000000004) ; Lisp * lisp/subr.el (apropos-internal): New defun, converted from C. * src/keymap.c (Fapropos_internal): Remove defun. (apropos_accum): Remove function. (apropos_predicate, apropos_accumulate): Remove variables. (syms_of_keymap): Remove defsubr for Fapropos_internal, and definitions of the above variables. * test/src/keymap-tests.el (keymap-apropos-internal) (keymap-apropos-internal/predicate): Move tests from here... * test/lisp/subr-tests.el (apropos-apropos-internal) (apropos-apropos-internal/predicate): ...to here.