6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803)
fc4379f1ae Minor cleanup of tramp-tests.el on MS Windows
dea3d6aa18 Fix handling of defcustom :local tag
For discussion, see the following emacs-devel thread:
https://lists.gnu.org/r/emacs-devel/2020-11/msg00734.html
* lisp/custom.el (custom-declare-variable): Delay call to
make-variable-buffer-local until after user option has been
initialized with a value. Otherwise the user option may be
initialized to nil.
* test/lisp/custom-tests.el (custom--test-local-option)
(custom--test-permanent-option): New :local user options.
(custom-test-local-option): New test for defcustom :local keyword.
A choice widget should be able to match either no inline values or
inline values, upon request. (Bug#44579)
* lisp/wid-edit.el (choice): New property, :inline-bubbles-p. A
predicate that returns non-nil if the choice widget can act as an
inline widget. Document it.
(widget-choice-inline-bubbles-p): New function, for the
:inline-bubbles-p property of the choice widget.
(widget-inline-p): New function. Use the :inline-bubbles-p property
of the widget, if any.
(widget-match-inline): Use the above to see if the widget can act like
an inline widget. Document it.
(widget-choice-value-create): Account for the case of a choice widget
that has inline members.
(widget-checklist-add-item, widget-editable-list-value-create)
(widget-group-value-create): Use widget-inline-p rather than just
checking for a non-nil :inline property, allowing these functions to
pass the complete information to widgets like the choice widget to
create their values.
* test/lisp/wid-edit-tests.el (widget-test-choice-match-no-inline)
(widget-test-choice-match-all-inline)
widget-test-choice-match-some-inline): New tests, to check that choice
widgets can match its choices, inline or not.
(widget-test-inline-p): New test, for the new function
widget-inline-p.
(widget-test-repeat-can-handle-choice)
(widget-test-repeat-can-handle-inlinable-choice)
(widget-test-list-can-handle-choice)
(widget-test-list-can-handle-inlinable-choice)
(widget-test-option-can-handle-choice)
(widget-test-option-can-handle-inlinable-choice): New tests. This
grouping widgets need to be able to create a choice widget regardless
if it has inline choices or not.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp--with-warning-test): New macro.
(bytecomp-warn-wrong-args, bytecomp-warn-wrong-args-subr):
Use above new macro.
(bytecomp-warn-variable-lacks-prefix): New test.
* src/keymap.c (describe_vector): Say which command shadows this
binding. (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-one-shadowed-in-range): Adapt
test.
* src/keymap.c (describe_vector): Do not say binding is shadowed if
the other key binding points to the same command. (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-same-command-does-not-shadow): New
test.
* src/keymap.c (describe_vector): Make sure found consecutive keys
are either not shadowed or, if they are, that they are shadowed by
the same command. (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-one-shadowed-in-range): New test.
* test/lisp/cus-edit-tests.el (cus-edit-tests-customize-saved/show-obsolete):
Add a fake saved-value property, to be able check that the obsolete
option is present in the Customize buffer. Expect the test to pass
now.
Set the default value when `set` encounters a PER_BUFFER variable
which has been let-bound globally, to match the behavior seen with
`make-variable-buffer-local`.
* test/src/data-tests.el (binding-test--let-buffer-local):
Add corresponding test.
(data-tests--set-default-per-buffer): Add tentative test for the
performance problem encountered in bug#41029.
All-ASCII strings cannot have substrings with non-ASCII characters in
them; use this fact to avoid searching entirely.
* src/fns.c (Fstring_search): For multibyte non-ASCII needle and
unibyte haystack, don't check if the haystack is all-ASCII; it's a
waste of time. For multibyte non-ASCII needle and multibyte
all-ASCII haystack, fail immediately.
* test/src/fns-tests.el (string-search): Add more test cases.
Also add some tests for braces and parse-partial-sexp amongst Lisp style
comments.
* test/src/syntax-tests.el (\;-in, \;-out): Add syntax for { and }.
(top-level): Add new tests for Lisp style comments.
(\#|-in, \#|-out): New functions.
(top-level): Add new tests for nested Lisp style comments, and mixtures of
nested comments with "ordinary" comments.
* test/src/syntax-resources/syntax-comments.txt (top-level): Add new test
fragments for #|...|#, etc.
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Add
"return" to the keywords which start a regex.
* lisp/progmodes/perl-mode.el (defconst): Add "return" to
'perl--syntax-exp-intro-keywords' (Bug#26850).
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-28650):
New test (bug#26850).
* lisp/emacs-lisp/comp.el (comp-mvar-symbol-p): Improve it.
(comp-cond-rw-func): Fix logic for multiple predecessor on target
block.
* test/src/comp-tests.el (comp-test-cond-rw-1): New test.
* test/src/comp-test-funcs.el (comp-test-cond-rw-1-1-f)
(comp-test-cond-rw-1-2-f): New functions.
* lisp/help.el (describe-map): Fix running `menu-item' :filter
functions. This fixes a mistake in the previous conversion of this
defun from the old C function describe_map. See the discussion in
Bug#39149.
* test/src/keymap-tests.el
(keymap---get-keyelt/runs-menu-item-filter)
(describe-buffer-bindings/menu-item-filter-show-binding)
(describe-buffer-bindings/menu-item-filter-hide-binding):
New tests.
(keymap-tests--test-menu-item-filter): New defun.
* lisp/emacs-lisp/comp.el (comp-constraint-to-type-spec): New
function splitting out code from comp-ret-type-spec + better
handle boolean type specifier.
(comp-ret-type-spec): Rework to leverage
`comp-constraint-to-type-spec'.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a
testcase.
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): New const
in place of `comp-known-ret-types' and `comp-known-ret-ranges'.
(comp-constraint): New struct to separate the constraint side of
an mvar.
(comp-constraint-f): Analogous for functions.
(comp-mvar): Rework and include `comp-constraint'.
(comp-type-spec-to-constraint): New function.
(comp-known-constraints-h): New const.
(comp-func-ret-typeset, comp-func-ret-range): Rework.
(comp-fwprop-insn): Fix.
* test/src/comp-tests.el (destructure-type-spec): New testcase.
* lisp/net/tramp.el (tramp-handle-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* lisp/net/tramp-smb.el (tramp-smb-handle-write-region): Use `current-time'
if needed.
* lisp/net/tramp-gvfs.el (tramp-gvfs-gio-mapping):
(tramp-gvfs-do-copy-or-rename-file): Remove "gvfs-rename", it is
not trustworthy.
* test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p): Check also for
symlinked files in trash.
(tramp-test20-file-modes): Revert last change, it was a thinko.
As we have derived return type specifiers as some test for them. Also
rewrite some propagation related test using return type specifiers too
as it's way more convenient.
* test/src/comp-tests.el (fw-prop-1): Nit rename.
(comp-tests-check-ret-type-spec): New function.
(comp-tests-type-spec-tests): New variable.
(comp-tests-cond-rw-0-var) Remove variable.
(cond-rw-0, cond-rw-1, cond-rw-2, cond-rw-3, cond-rw-4, cond-rw-5)
Remove tests as now covered by `comp-tests-check-ret-type-spec'.
Having this while re-debugging the boostrap would have saved few hours
of debug so let's add it.
* test/src/comp-tests.el (and-3): Add test.
* test/src/comp-test-funcs.el (comp-test-and-3-var): New var.
(comp-test-and-3-f): New function.
This commit add an initial support for a better type propagation and
integer range propagation.
Each mvar can be now characterized by a set of types, a set of values
and an integral range.
* lisp/emacs-lisp/comp.el (comp-known-ret-types): Store into
typeset and remove fixnum.
(comp-known-ret-ranges, comp-type-predicates): New variables.
(comp-ctxt): Remove supertype-memoize slot and add
union-typesets-mem.
(comp-mvar): Remove const-vld, constant, type slots. Add typeset,
valset, range slots.
(comp-mvar-value-vld-p, comp-mvar-value, comp-mvar-fixnum-p)
(comp-mvar-symbol-p, comp-mvar-cons-p)
(comp-mvar-type-hint-match-p, comp-func-ret-typeset)
(comp-func-ret-range): New functions.
(make-comp-mvar, make-comp-ssa-mvar): Update logic.
(comp--typeof-types): New variable.
(comp-supertypes, comp-common-supertype): Logic update.
(comp-subtype-p, comp-union-typesets, comp-range-1+)
(comp-range-1-, comp-range-<, comp-range-union)
(comp-range-intersection): New functions.
(comp-fwprop-prologue, comp-mvar-propagate)
(comp-function-foldable-p, comp-function-call-maybe-fold)
(comp-fwprop-insn, comp-call-optim-func, comp-finalize-relocs):
Logic update.
* src/comp.c (emit_mvar_rval, emit_call_with_type_hint)
(emit_call2_with_type_hint): Logic update.
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Undo the add
of fixnum and bignum as unnecessary.
* test/src/comp-tests.el
(comp-tests-mentioned-p-1, comp-tests-cond-rw-checker-val)
(comp-tests-cond-rw-checker-type, cond-rw-1, cond-rw-2)
(cond-rw-3, cond-rw-4, cond-rw-5): Update for new type interface.
(range-simple-union, range-simple-intersection): New integer range
tests.
(union-types): New union type test.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl--run-test-cases): New macro, factored out from various
indentation / rewriting tests. Contains documentation of the
format used by the cperl-mode-resources files.
(cperl-test-bug-19709): Replace 'next-line' by 'forward-line'.
(cperl-test-indent-exp),
(cperl-test-indent-styles),
(cperl-test-bug-30393): Use the new macro.
(cperl-test-bug-19709): Make fit for Emacs 26.
(cperl-test-indent-styles): Skip for Perl mode (bug#44561).
* test/lisp/emacs-lisp/rx-tests.el (rx-compat): Use with-no-warnings
instead of with-suppressed-warnings which complains when running
the test interactively.
This is a regression from Emacs 26.
Reported by Phillip Stephani.
* lisp/emacs-lisp/rx.el (rx--pcase-transform): Process ? and ?? correctly.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add test case.
(cherry picked from commit 575b0681d9)
This is a regression from Emacs 26.
Reported by Phillip Stephani.
* lisp/emacs-lisp/rx.el (rx--pcase-transform): Process ? and ?? correctly.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add test case.
* lisp/progmodes/cperl-mode.el (cperl-style-alist): Add
cperl-close-paren-offset to the settings for PBP style.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-bug19709):
New test to verify correct indentation of closing parentheses (Bug#19709).
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-19709.pl:
New test case with code from the bug report.
* test/lisp/progmodes/cperl-mode-resources/cperl-indent-styles.pl:
Add a new test clause for cperl-close-paren-offset.
* test/src/keymap-tests.el
(keymap-keymap-set-parent/returns-parent): Remove test for the return
value of set-keymap-parent. It is not clear that returning the value
is a very good idea.
Problem pointed out by Stefan Monnier <monnier@iro.umontreal.ca>.
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
'javac': Column numbers are 1-based by default; remove subtraction and
η-reduce. Translate regexp to rx (mechanised).
* test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data):
Adapt 'javac' test cases to the change.
The variable now only controls whether characters are printed, not
the radix. Control chars are printed in human-readable syntax
only when special escapes such as ?\n are available. Spaces,
formatting and combining chars are excluded (bug#44155).
Done in collaboration with Juri Linkov.
* src/character.c (graphic_base_p):
* src/print.c (named_escape): New functions.
(print_object): Change semantics as described above.
(syms_of_print): Rename integer-output-format. Update doc string.
* doc/lispref/streams.texi (Output Variables):
* etc/NEWS:
* test/src/print-tests.el (print-integers-as-characters):
Rename and update according to new semantics. The test now passes.
This library provides a fundamental reworking of the search
functionality previously found in nnir.el. It uses class-based search
engines to interface with external searching facilities, and a parsed
search query syntax that can search multiple engines.
* lisp/gnus/gnus-search.el: New library containing search
functionality for Gnus.
* doc/misc/gnus.texi: Document.
* lisp/gnus/gnus-group.el (gnus-group-make-search-group,
gnus-group-read-ephemeral-search-group): Remove references to nnir,
change meaning of prefix argument, change values of nnselect-function
and nnselect-args.
* lisp/gnus/nnselect.el: Replace references to nnir
(nnselect-request-article): Use gnus-search functions, and search
criteria.
(nnselect-request-thread, nnselect-search-thread): Use gnus-search
thread search.
(gnus-summary-make-search-group): Switch to use gnus-search function
and arguments.
* test/lisp/gnus/search-tests.el: Tests for new functionality.
* lisp/progmodes/cperl-mode.el (cperl-mode): Add a fix
which is only required for Emacs versions older than 27.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-bug30393):
Add a test to verify correct indentation (bug#30393).
* test/lisp/progmodes/cperl-mode-tests.el (cperl-bug37127):
Skip this test for older Emacsen. The bug has been fixed
in Emacs, but outside of CPerl mode, and therefore will not
be available for older versions via ELPA.
* doc/lispref/files.texi (Contents of Directories):
Fix description of directory-files, directory-empty-p and
directory-files-and-attributes.
* etc/NEWS: Fix entry for directory-files-and-attributes. Fix typos.
* lisp/dired.el (directory-empty-p): Move function from here ...
* lisp/files.el (directory-empty-p): ... to here.
* lisp/net/ange-ftp.el (ange-ftp-directory-files): Call `nreverse' later.
* lisp/net/tramp.el (tramp-handle-directory-files):
* lisp/net/tramp-adb.el
(tramp-adb-handle-directory-files-and-attributes): Do not call
`nreverse'.
* src/dired.c (Fdirectory_files)
(Fdirectory_files_and_attributes): Fix docstrings.
* test/src/dired-tests.el: Removed. Tests moved to
test/lisp/dired-tests.el.
* test/lisp/dired-tests.el (dired-test-bug27899): Tag it :unstable.
(dired-test-directory-files)
(dired-test-directory-files-and-attributes): New tests.
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Only document the values we want to support, not the ones we
actually support.
(define-minor-mode): Partially revert to previous behaviour.
This fixes a regression with regards to the old C version of
substitute-command-keys.
* lisp/help.el (substitute-command-keys): Don't bind standard-output.
See Bug#39149.
* test/lisp/help-tests.el
(help-tests--was-in-buffer): New variable.
(help-substitute-command-keys/menu-filter-in-correct-buffer): New
test.
* lisp/help.el (describe-map-tree): Insert header into the original
buffer, not in standard-output.
* test/src/keymap-tests.el
(describe-buffer-bindings/header-in-current-buffer)
(describe-buffer-bindings/returns-nil): New tests.
Ref: https://debbugs.gnu.org/39149#31
* test/src/comp-tests.el (comp-tests-cond-rw-checked-function):
Declare var.
(comp-tests-cond-rw-checker-val): New function.
(comp-tests-cond-rw-checker-type): Declare var.
(comp-tests-cond-rw-checker-type): New function.
(comp-tests-cond-rw-0-var): Declare var.
(comp-tests-cond-rw-0, comp-tests-cond-rw-1, comp-tests-cond-rw-2)
(comp-tests-cond-rw-3, comp-tests-cond-rw-4)
(comp-tests-cond-rw-5): New testcases.
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Clarify when minor modes are switched on/off when called from lisp
(bug#44341).
(define-minor-mode): Make calls from Lisp switch the mode on/off
as documented.
* test/src/comp-tests.el (comp-tests-map-checker): New function
returning a list holding checker results.
(comp-tests-tco-checker, comp-tests-fw-prop-checker-1)
(comp-tests-pure-checker-1, comp-tests-pure-checker-2): Make use
of `comp-tests-map-checker'.
* doc/lispref/streams.texi (Output Variables): Add integer-output-format.
* src/print.c (print_object): In case of Lisp_Int, print integers
as characters when Vinteger_output_format is Qt, and in hex format
when Vinteger_output_format is 16.
(Vinteger_output_format): New variable.
* test/src/print-tests.el (print-integer-output-format): New test.
Since a supplied test function can do anything, assoc is not
side-effect-free (bug#44018). However, with only two arguments it is
pure and should be optimised accordingly.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'.
(byte-optimize-assoc): Constant-propagate through 2-arg assoc calls.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
Fix bug#44070, which causes the minibuffer display to jump upon minor edit
(redisplay_window): Obey it.
* lisp/simple.el (end-of-buffer): Obey it.
* test/src/xdisp-tests.el (xdisp-tests--in-minibuffer): New macro,
extracted from `xdisp-tests--minibuffer-resizing`.
(xdisp-tests--minibuffer-resizing): Use it.
(xdisp-tests--minibuffer-scroll): New test.
* lisp/emacs-lisp/unsafep.el:
Add comment explaining the policy for which forms can be considered
'safe' in the sense of unsafep. Remove ones that didn't make the cut:
play-sound-file (large attack surface)
catch, throw (alter program flow, inject data)
replace-regexp-in-string (execute arbitary code)
error, signal (deceptive messages)
* test/lisp/emacs-lisp/unsafep-tests.el (unsafep-tests--unsafe):
Add test cases.
* etc/NEWS: Announce the change.
Translating GDB/MI into JSON is an unnecessary and fragile detour
that made it hard to deal with octal escapes in strings correctly.
Parse GDB/MI directly instead.
* lisp/progmodes/gdb-mi.el (gdb-mi-decode-strings): Adjust doc string.
(gdb-mi-decode, gud-gdbmi-marker-filter): Remove gdb-mi-decode.
(gdb-jsonify-buffer): Remove.
(gdb-mi--parse-tuple-or-list, gdb-mi--parse-c-string)
(gdb-mi--parse-value, gdb-mi--parse-result-or-value)
(gdb-mi--parse-results, gdb-mi--fix-key, gdb-mi--extend-fullname)
(gdb-mi--c-string-from-string): New functions.
(gdb-json-read-buffer, gdb-json-string, gdb-json-partial-output):
Rename to gdb-mi--read-buffer, gdb-mi--from-string and
gdb-mi--partial-output respectively. Remove useless FIX-LIST
argument. FIX-KEY is now a symbol, not a string. All callers updated.
(gdb-tooltip-print, gdbmi-bnf-log-stream-output, gdb-internals)
(gdb-console, gdb-done-or-error, gdb-get-source-file-list)
(gdb-get-prompt, gdb-get-source-file):
Use gdb-mi--c-string-from-string instead of 'read'.
* test/lisp/progmodes/gdb-mi-tests.el: New file.
Don't call `syntax-propertize` from within narrowing
* lisp/progmodes/cperl-mode.el (cperl-forward-re): Revert last patch,
since it is now redundant.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-bug37127):
Remove unused var; fix test so it really catches the previous bug;
tweak the code to use mode-agnostic commands so it also works in `perl-mode`.
* lisp/progmodes/cperl-mode.el (cperl-forward-re): Suppress an
error message about "End of string/RE not found" when we are
at the end of a narrowed buffer where the end of a RE is
temporarily unavailable (Bug#37127).
* test/lisp/progmodes/cperl-mode-tests.el (cperl-bug37127):
Add a test to verify that the message is suppressed when
inappropriate, but appears when the RE *is* incomplete.
* lisp/emacs-lisp/text-property-search.el
(text-property-search-forward, text-property-search-backward): Doc fix
to clarify placement of point after search.
* test/lisp/emacs-lisp/text-property-search-tests.el
(text-property-search--pos-test): New defun.
(text-property-search-forward-point-at-beginning)
(text-property-search-backward-point-at-end): New test.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-mode-test-bug-10483): Increase the timeout to 2 seconds
and mark the test as expensive. Also, suppress it for Emacs
versions below 28, where the test times out though the function
works in manual tests. (Bug#44317)
(tcl--word-delimiters): New const.
(tcl--syntax-of-quote): New function.
(tcl-syntax-propertize-function): Use them.
(tcl-mode): Enable `syntax-propertize-multiline`.
* test/manual/indent/tcl.tcl: New file.
* lisp/net/dbus.el (dbus-managed-objects-handler): Handle several
children of PATH. (Bug#44298)
* src/dbusbind.c (xd_signature, xd_append_arg): Check object path.
* test/lisp/net/dbus-tests.el (dbus-test09-get-managed-objects):
Tag it :expensive-test. Remove superfluous check.
; Persistently failing tests can cause problems for automated builds,
; and make it harder to spot new failures.
* test/lisp/xt-mouse-tests.el (xt-mouse-tracking-basic)
(xt-mouse-tracking-utf-8): Currently failing.