1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-16 09:50:25 +00:00
Commit Graph

3722 Commits

Author SHA1 Message Date
Lars Ingebrigtsen
baf331e40c Rename replace-in-string to string-replace
* doc/lispref/searching.texi (Search and Replace): Update.
* lisp/bindings.el (mode-line-position): Update callers.

* lisp/subr.el (string-replace): Rename from replace-in-string
since that clashes with XEmacs' replace-in-string which is
equivalent to the Emacs replace-regexp-in-string (bug#43598).
2020-09-27 00:24:50 +02:00
Stefan Kangas
e00936bf9f Silence some byte-compiler warnings
* test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode):
* test/lisp/custom-tests.el (cus-test-opts):
* test/lisp/help-fns-tests.el (foo-test-map)
(help-fns-test--describe-keymap-foo):
* test/src/fns-tests.el (w32-collate-ignore-punctuation)
(fns-tests-func-arity): Silence byte-compiler warnings.
2020-09-26 12:03:07 +02:00
Stefan Kangas
2dff3ea073 Repurpose libxml test for obsolete argument
* test/src/xml-tests.el (libxml-tests): Move half this test for the
recently obsoleted fourth argument to libxml-parse-xml-region...
* test/lisp/xml-tests.el (xml-tests--remove-comments): ...to a new
test here for xml-remove-comments.

* test/src/xml-tests.el (libxml-tests--data-comments-discarded):
Move test data from here...
* test/lisp/xml-tests.el (xml-tests--data-with-comments): ...to here.
2020-09-26 11:48:09 +02:00
Glenn Morris
d58e3b3997 Fix out-of-tree make check
* test/lisp/custom-tests.el (custom-test-admin-cus-test): New const.
(check-for-wrong-custom-types): Use it.
2020-09-25 11:01:14 -07:00
Mattias Engdegård
497a1ed8bb string-search robustness and documentation improvement (bug#43598)
* src/fns.c (Fstring_search): Check START-POS argument range.
Simplify logic.  Improve doc string.
* test/src/fns-tests.el (string-search): Add test cases.
* doc/lispref/strings.texi (Text Comparison): Elaborate.
* lisp/emacs-lisp/byte-opt.el (pure-fns): Mark string-search as pure.
2020-09-25 17:08:00 +02:00
Lars Ingebrigtsen
664927b525 Add an expensive test for defcustom types
* admin/cus-test.el (cus-test-opts): Return the tests.

* test/lisp/custom-tests.el (check-for-wrong-custom-types): Test
custom types (bug#30990).
2020-09-25 14:46:36 +02:00
Mattias Engdegård
8a253a96a0 Fix replace-in-string infloop with empty pattern string (bug#43598)
* lisp/subr.el (replace-in-string): Raise an error if FROMSTRING is
empty.
* test/lisp/subr-tests.el (replace-in-string): Add test case.
2020-09-25 13:15:42 +02:00
Lars Ingebrigtsen
09adf92644 Fix previous replace-in-string rewrite
* lisp/subr.el (replace-in-string): Fix logic errors in previous
patch.
2020-09-25 02:07:05 +02:00
Lars Ingebrigtsen
7f9ad5980c Fix replace-in-string multibyteness problems with string-search
* lisp/subr.el (replace-in-string): Simplify by using the new
string-search function (bug#43598).
2020-09-25 01:53:16 +02:00
Lars Ingebrigtsen
e51a98b0c2 Add a new function 'string-search'
* doc/lispref/strings.texi (Text Comparison): Document it.
* src/fns.c (Fstring_search): New function.
2020-09-25 01:53:16 +02:00
Glenn Morris
976b8464fb Update a failing lisp test
* test/lisp/emacs-lisp/lisp-tests.el (up-list-no-cross-string):
Update for recent "Don't signal scan-error" change.
2020-09-24 12:46:19 -07:00
Glenn Morris
9bf9f699b1 Add skip condition for some dbus tests
* test/lisp/net/dbus-tests.el (dbus-test01-type-conversion)
(dbus-test01-basic-types): Add skip for hydra.nixos.org failures.
; Standardize license notice
2020-09-24 11:47:11 -07:00
Stefan Kangas
ad285e0eb8 Remove TODO to convert files to unit tests
* test/lisp/textmodes/css-mode-tests.el:
* test/lisp/progmodes/ruby-mode-tests.el: Remove TODO to convert test
files into unit tests.  The files are still useful for debugging.
Ref: https://lists.gnu.org/r/emacs-devel/2020-09/msg01906.html
2020-09-23 20:53:06 +02:00
Stefan Kangas
37a2a427e4 Convert some completion.el tests to ERT
* test/lisp/completion-tests.el: New file.
* lisp/completion.el: Move commented out tests to completion-tests.el.
2020-09-23 20:03:19 +02:00
Stefan Kangas
610b771d4a Convert allout unit tests to ERT
* test/lisp/allout-tests.el: New file.
* lisp/allout.el (allout-run-unit-tests-on-load)
(allout-run-unit-tests): Remove.
(allout-tests-obliterate-variable)
(allout-tests-globally-unbound, allout-tests-globally-true)
(allout-tests-locally-true, allout-test-resumptions): Move to
allout-tests.el

* test/lisp/allout-widgets-tests.el: New file.
* lisp/allout-widgets.el (allout-widgets-run-unit-tests-on-load)
(allout-widgets-run-unit-tests): Remove.
(allout-test-range-overlaps): Move to allout-widgets-tests.el.
2020-09-23 20:03:19 +02:00
Michael Albinus
441e875019 * test/lisp/net/dbus-tests.el (dbus-test01-basic-types): Adapt test. 2020-09-23 19:57:03 +02:00
Mauro Aranda
b252e09ae4 Allow the newline character in the character widget (Bug#15925)
* lisp/wid-edit.el (widget-specify-field): Extend check for adding the
boundary overlay.  Plus, a minor comment indentation fix.
(character widget): Tweak the valid-regexp to allow the newline
character.

* test/lisp/wid-edit-tests.el (widget-test-character-widget-value)
(widget-test-editable-field-widget-value): New tests (bug#15925).
2020-09-23 15:45:36 +02:00
Stefan Monnier
83a4e4c2a9 test/src/xdisp-tests.el: New file 2020-09-22 23:55:45 -04:00
martin rudalics
10696d0ac5 Make delete-pair only delete pairs that are part of insert-pair-alist
* lisp/emacs-lisp/lisp.el (delete-pair): Only delete pairs that
are part of `insert-pair-alist' (bug#4136).
2020-09-22 16:44:15 +02:00
Mattias Engdegård
3376b08c2e ; * test/lisp/progmodes/ps-mode-tests.el: Add missing backslash 2020-09-22 12:32:12 +02:00
Stefan Kangas
2788557000 Support shellcheck in compilation-mode
* lisp/progmodes/compile.el
(compilation-error-regexp-alist-alist): Add shellcheck regexp.
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data):
(compile-test-error-regexps): Add test for shellcheck.
* etc/compilation.txt: Add shellcheck example.
* etc/NEWS: Announce the change.

foo
2020-09-22 02:44:47 +02:00
Stefan Kangas
9a3a2a00da Remove some unnecessary compat code
* test/lisp/emacs-lisp/ert-x-tests.el (ert-test-describe-test):
* test/lisp/wdired-tests.el (wdired-test-unfinished-edit-01):
Remove unnecessary compat code; these tests should never need to run
on older versions of Emacs.
2020-09-22 01:00:06 +02:00
Stefan Kangas
9fff5491c3 Convert a manual test for nxml-mode to unit test
* test/manual/indent/nxml.xml: Delete file.
* test/lisp/nxml/nxml-mode-tests.el
(nxml-mode-test-comment-bug-17264): New test based on deleted file.
2020-09-21 18:47:55 +02:00
Stefan Kangas
b63c3535b0 Convert manual indent test for ruby-mode into unit test
* test/manual/indent/ruby.rb: Move from here...
* test/lisp/progmodes/ruby-mode-resources/ruby.rb: ...to here.

* test/lisp/progmodes/ruby-mode-tests.el
(ruby-mode-tests-data-dir): New variable.
(ruby--indent/converted-from-manual-test): New test.
2020-09-21 18:47:55 +02:00
Stefan Kangas
1d98bed6c3 Convert manual indent test for scheme-mode into unit test
* test/manual/indent/scheme.scm: Delete file.
* test/lisp/progmodes/scheme-tests.el: New file with unit test for
scheme-mode based on deleted file.
2020-09-21 18:47:55 +02:00
Stefan Kangas
01f7fdb2a0 Convert manual indent test for ps-mode into unit test
* test/manual/indent/ps-mode.ps: Delete file.
* test/lisp/progmodes/ps-mode-tests.el (ps-mode-test-indent):
New unit test based on deleted file.
2020-09-21 18:47:55 +02:00
Stefan Kangas
d5d642eb71 Convert manual indent test for opascal-mode into unit test
* test/manual/indent/opascal.pas: Delete file.
* test/lisp/progmodes/opascal-tests.el: New file with unit test for
oposcal-mode based on deleted file.
2020-09-21 16:46:21 +02:00
Stefan Kangas
31cb935cd7 Convert manual indent test for lisp-mode into unit test
* test/manual/indent/lisp.lisp: Delete file.
* test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-indent-defun):
New unit test based on deleted file.
2020-09-21 16:46:21 +02:00
Stefan Kangas
f3e2d3418a Convert manual indent test for elisp-mode into unit test
* test/manual/indent/elisp.el: Delete file.
* test/lisp/progmodes/elisp-mode-tests.el (elisp-indent-basic):
New unit test based on deleted file.
2020-09-21 16:46:21 +02:00
Stefan Kangas
12ca463833 ; * test/lisp/textmodes/css-mode-tests.el: Add TODO. 2020-09-21 16:46:21 +02:00
Stefan Kangas
ebad35e4d9 ; Fix more trivial typos 2020-09-21 15:51:07 +02:00
Stefan Kangas
462dbc1cb2 ; Fix typos 2020-09-21 14:26:42 +02:00
Michael Albinus
63f9d9af81 Add D-Bus tests
* doc/misc/dbus.texi (Type Conversion): Precise basic type values.

* lisp/net/dbus.el (dbus-register-property): Send signal directly.

* src/dbusbind.c (xd_signature): Accept non-nil objects for
DBUS_TYPE_BOOLEAN.

* test/lisp/net/dbus-tests.el (dbus-test01-basic-types)
(dbus-test01-compound-types): New tests.
2020-09-21 13:41:30 +02:00
Glenn Morris
3675993d76 Merge from origin/emacs-27
df04f3e755 Fix a rare segfault in syntax.c
fd1fe1e1ec Add doc to syntax-propertize-function saying it must do a ...
fcd599bbea Minor copyedits of doc of 'with-silent-modifications'
759399cdb1 Improve documentation of 'max-mini-window-height'
3223302aa2 Use modern constant names for the NS pasteboard
985703d380 Fix doc string of 'toggle-menu-bar-mode-from-frame'
184a4977c7 Make vc-bzr tests work with brz 3.1 (bug#43314)

# Conflicts:
#	lisp/emacs-lisp/syntax.el
#	src/syntax.c
2020-09-20 17:18:16 -07:00
Michael Albinus
f8624fb834 Make D-Bus properties type safe
* doc/misc/dbus.texi (Properties and Annotations):
Precise dbus-get-property and dbus-set-property.
(Type Conversion): Explain :byte and :boolean type conversion.
(Errors and Events): dbus-ignore-errors returns nil when there is
a D-Bus error.  Remove dbus-show-dbus-errors.

* etc/NEWS: Some D-Bus relevant changes.

* lisp/net/dbus.el (dbus-show-dbus-errors): Remove.
(dbus-ignore-errors): Replay implamentation without that variable.
(dbus-check-arguments): New defun.
(dbus-list-activatable-names, dbus-list-names)
(dbus-list-queued-owners, dbus-get-name-owner, dbus-introspect)
(dbus-get-all-properties, dbus-get-all-managed-objects): Don't debug.
(dbus-get-property, dbus-set-property): Propagate errors.
(dbus-register-property): Check for valid VALUE.
(dbus-property-handler): Simplify.

* src/dbusbind.c (Fdbus_message_internal): Adapt docstring.
Handle DBUS_MESSAGE_TYPE_INVALID.

* test/lisp/net/dbus-tests.el (dbus-show-dbus-errors): Don't declare.
(dbus-test06-register-property)
(dbus-test06-register-property-emits-signal): Adapt tests.
2020-09-20 16:44:17 +02:00
Kévin Le Gouguec
f8d8d28bc6 Tweak dired warning about "wildcard" characters
* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter.  Make sure to
return the first isolated match.
(dired--need-confirm-positions, dired--mark-positions)
(dired--highlight-no-subst-chars, dired--no-subst-explain)
(dired--no-subst-ask, dired--no-subst-confirm): New functions.
(dired-do-shell-command): Use them (bug#28969, bug#35564).

* test/lisp/dired-aux-tests.el (dired-test-bug27496): Adapt to
new prompt.
(dired-test--check-highlighting): New test helper.
(dired-test-highlight-metachar): New tests.
2020-09-20 14:16:19 +02:00
dickmao
321bba0c99 Terminate `comint-password-function' tests
* test/lisp/comint-tests.el (comint-test-no-password-function)
(comint-test-password-function-with-value)
(comint-test-password-function-with-nil): refactor
(comint-tests/test-password-function): actually test
`comint-send-invisible' and inhibit inadvertent interactive query
(bug#38825).
2020-09-20 12:43:37 +02:00
Lars Ingebrigtsen
3ec7005315 Tweak a hash table print test 2020-09-20 12:26:29 +02:00
Pip Cet
988f45a75b Fix printing of hash tables with removed elements
* src/print.c (print_vectorlike): Keep track of the actual number
of elements printed rather than attempting to use hash bucket
indices (bug#38892).
2020-09-20 12:24:16 +02:00
Mauro Aranda
1278a9a907 New command: revert-buffer-with-fine-grain
* doc/emacs/files.texi (Reverting): Document the new command and the
new variable.

* etc/NEWS: Mention the new command and the new variable.

* lisp/files.el (revert-buffer-with-fine-grain): New command.  Revert
a buffer trying to be non-destructive, by using replace-buffer-contents.
(revert-buffer-insert-file-contents-delicately): New function, alternative
to revert-buffer-insert-file-contents-function--default-function.
(revert-buffer-with-fine-grain-max-seconds): New variable.  Passed as
argument MAX-SECS of replace-buffer-contents.

* test/lisp/files-tests.el (files-tests-lao files-tests-tzu): Helper
variables, taken from diffutils manual, to test reverting a buffer.
(files-tests-revert-buffer)
(files-tests-revert-buffer-with-fine-grain): New tests (bug#18).
2020-09-20 01:04:39 +02:00
Daniel Martín
c9f845a53c Put files in mhtml-mode when they have <!DOCTYPE, case-insensitive
* lisp/files.el (magic-fallback-mode-alist): Match "DOCTYPE" in a
case-insensitive way before putting files in mhtml-mode. See
https://html.spec.whatwg.org/multipage/syntax.html#the-doctype for the
standard reference.
* test/lisp/files-tests.el (files-test-magic-mode-alist-doctype): Add
a test (bug#43511).
2020-09-19 19:15:48 +02:00
Michael Albinus
b23beef3f2 Fix error in D-Bus test
* test/lisp/net/dbus-tests.el (dbus-test04-register-method):
Do not check for error message text.
(dbus--test-signal-handler): Fix docstring.
(dbus--test-timeout-handler): New defun.
(dbus-test05-register-signal)
(dbus-test06-register-property-emits-signal): Use it.
2020-09-18 11:17:42 +02:00
Harald Jörg
f7e68759d0 cperl-mode: Add new value "PBP" for 'cperl-set-style'
* lisp/progmodes/cperl-mode.el (cperl-style-alist)
(cperl-set-style): Add indentation style recommended by Damian Conway's
book "Perl Best Practices".

* test/lisp/progmodes/cperl-mode-tests.el
(cperl-mode-test-indent-styles): Add a test to verify indentation
and unraveling of conditionals (bug#43457).
2020-09-17 17:35:11 +02:00
Michael Albinus
6d6ef7b1d0 Work on D-Bus properties etc
* lisp/net/dbus.el (seq, subr-x): Require.
(dbus-error-disconnected, dbus-error-service-unknown): New defconst.
(dbus-set-property, dbus-register-property): Use `keywordp'.  Fix
proper value sending a signal.

* test/lisp/net/dbus-tests.el (dbus-test04-register-method):
Extend test.
(dbus--test-signal-received): New defvar.
(dbus--test-signal-handler): New defun.
(dbus-test05-register-signal)
(dbus-test06-register-property-emits-signal): New tests.
(dbus-test06-register-property)
(dbus-test06-register-property-several-paths): Rename tests.
2020-09-17 17:13:55 +02:00
Tino Calancha
23a3333b3e Give Lisp control on the lossage size
Add a command 'lossage-size' to set the maximum
number or recorded keystrokes (Bug#38796).

* src/keyboard.c (lossage_limit):
Static variable with the current lossage size limit.
(MIN_NUM_RECENT_KEYS): Renamed from NUM_RECENT_KEYS.
Set it as 100 and use it as the minimum value for lossage_limit.
Keep the same default for the vector size as before (300).
(lossage-size): New command.
(update_recent_keys): Helper function.
(command_loop_1)
(record_char)
(recent-keys)
(syms_of_keyboard): Use lossage_limit as the vector size.

* lisp/help.el (view-lossage): Mention the new command in the docstring.
* etc/NEWS (Changes in Emacs 28.1): Announce this change.
* doc/emacs/help.texi (Misc Help): Update manual.
* test/src/keyboard-tests.el (keyboard-lossage-size): Add test.
2020-09-17 16:32:18 +02:00
Lars Ingebrigtsen
0a7152e095 Fix up previous replace-in-string commit
* lisp/subr.el (replace-in-string): Fix thinko in implementation.
2020-09-15 17:36:36 +02:00
Lars Ingebrigtsen
caf64ae08b Add new, simple `replace-in-string' function
* lisp/subr.el (replace-in-string): New, side-effect-free function.

* doc/lispref/searching.texi (Search and Replace): Document it.
2020-09-15 17:15:59 +02:00
Stefan Monnier
e408f2fab2 * test/lisp/emacs-lisp/find-func-tests.el: New file (for bug#43393)
* lisp/emacs-lisp/ert-x.el (ert-simulate-keys): New macro.

* test/lisp/international/mule-tests.el
(mule-cmds--test-universal-coding-system-argument): Use it and enable
the test also in batch mode.
2020-09-14 16:04:22 -04:00
Mattias Engdegård
0e00f199cd Calc: fix binomial coefficients for negative arguments (bug#16999)
For some values outside integers 0≤k≤n, (n choose k) gave wrong
results, entered infinite recursion or used unreasonably amounts of
stack space.  This change fixes that and extends the function to all
integer arguments using the definitions from M. J. Kronenburg
(https://arxiv.org/abs/1105.3689).

* lisp/calc/calc-comb.el (calcFunc-choose):
Fix sign error to prevent infinite recursion and extend function to
handle all integer arguments.
(math-choose-iter, math-choose-float-iter): Rewrite in iterative form;
no TCO in elisp yet.
* test/lisp/calc/calc-tests.el (calc-tests--fac, calc-tests--choose)
(calc-tests--check-choose, calc-tests--explain-choose)
(calc-tests--calc-to-number): New helper functions.
(calc-choose): New test.
2020-09-14 11:19:22 +02:00
Philipp Stephani
da0e75e741 Add facility to make module functions interactive (Bug#23486).
* src/module-env-28.h: Add field for 'make_interactive' function.

* src/emacs-module.c (Lisp_Module_Function): Add new field holding the
interactive form.
(allocate_module_function): Adapt to structure layout change.
(module_make_interactive, module_function_interactive_form): New
functions.
(initialize_environment): Use them.

* src/eval.c (Fcommandp):
* src/data.c (Finteractive_form): Also handle interactive module
functions.

* test/data/emacs-module/mod-test.c (Fmod_test_identity): New test
function.
(emacs_module_init): Create two interactive module test functions.

* test/src/emacs-module-tests.el (module/interactive/return-t)
(module/interactive/return-t-int, module/interactive/identity):
New unit tests.

* doc/lispref/internals.texi (Module Functions): Document new
function.  Rework paragraph about wrapping module functions, as the
example no longer applies.

* etc/NEWS: Document new facility.
2020-09-13 20:26:47 +02:00