Andrea Corallo [Fri, 25 Dec 2020 09:57:02 +0000 (10:57 +0100)]
Enable integer range narrowing under compare and branch
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-cmp-range)
(comp-cstr->, comp-cstr->=, comp-cstr-<, comp-cstr-<=): New
functions.
* lisp/emacs-lisp/comp.el (comp-equality-fun-p)
(comp-range-cmp-fun-p): New functions.
(comp-collect-rhs): Use `comp-assign-op-p' in place of
`comp-set-op-p'.
(comp-negate-range-cmp-fun, comp-reverse-cmp-fun): New functions.
(comp-emit-assume): Rework to be able to emit also comparision
assumption.
(comp-add-cond-cstrs-simple): Update for new `comp-emit-assume'.
(comp-add-cond-cstrs-simple): Update to emit range assumption.
(comp-fwprop-insn): Execute range assumptions.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add tests.
Andrea Corallo [Wed, 23 Dec 2020 13:03:54 +0000 (14:03 +0100)]
* Fix non range cstr union operation
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-homogeneous): Add
range parameter and handle the non range case.
(comp-cstr-union-1-no-mem, comp-cstr-intersection-no-mem): Update
`comp-cstr-union-homogeneous' call sites.
Philipp Stephani [Wed, 23 Dec 2020 14:55:23 +0000 (15:55 +0100)]
Allocate environment block before forking.
While 'child_setup' carefully avoids calls to async-signal-unsafe
functions like 'malloc', it seems simpler and less brittle to use
normal allocation outside the critical section between 'fork' and
'exec'.
* src/callproc.c (make_environment_block): New function to create the
environment block for subprocesses. Code largely extracted from
'child_setup' and adapted to use 'xmalloc' instead of 'alloca'.
(child_setup): Remove environment block allocation in favor of
passing the environment block as command-line argument.
(call_process): Adapt to new calling convention.
* src/process.c (create_process): Adapt to new calling convention.
Juri Linkov [Wed, 23 Dec 2020 09:30:04 +0000 (11:30 +0200)]
Show image as text when trying to search/replace in image buffer (bug#25905)
* lisp/image-mode.el (image-mode-isearch-filter): New function.
(image-mode--setup-mode): Use it to add it as :before-while to
isearch-filter-predicate.
Eric Abrahamsen [Sun, 20 Dec 2020 19:26:37 +0000 (11:26 -0800)]
Ensure that Gnus servers are open(able) before searching them
* lisp/gnus/gnus-search.el (gnus-search-run-search): Imap servers need
to be opened (made into the "current server") before we manipulate the
nnimap-buffer.
(gnus-search-run-search): Sneakily fix regexp.
(gnus-search-indexed-parse-output): We need to pass the server name in
here, otherwise nnmaildir won't know how to make this the "current
server".
Alan Mackenzie [Tue, 22 Dec 2020 12:06:21 +0000 (12:06 +0000)]
Re-order the items in `profiler-report' output.
Putting the usage figures first on the line will eliminate the truncation of
function names.
lisp/profiler.el (profiler-version): Change to "28.1".
(profiler-format): Enhance, so that a width of zero means print the string
without padding or truncation.
(profiler-report-cpu-line-format, profiler-report-memory-line-format): Amend
for the new layout. The number of places for the cpu samples has been reduced
from 19 to 12 (enough for ~30 years at 1,000 samples per second).
(profiler-report-line-format, profiler-report-describe-entry): Amend for the
new order of arguments to profiler-format.
etc/NEWS (Specialized Modes): Add an entry documenting this change.
doc/lispref/debugging.texi (Profiling): Describe the new ordering of the items
in place of the old ordering.
Daniel Martín [Tue, 22 Dec 2020 06:36:41 +0000 (07:36 +0100)]
Fix wdired-get-filename when ls -F marks symlinks
* lisp/wdired.el (wdired-get-filename): In some systems like BSD or
macOS, "ls -F" marks symlinks with a trailing "@". Add logic
accounting for this so that wdired-get-filename returns the correct
filename. This change also fixes test "wdired-test-bug34915" on macOS
and BSD systems (bug#34915).
Andrea Corallo [Sat, 19 Dec 2020 10:56:15 +0000 (11:56 +0100)]
Fix `comp-add-call-cstr' and add a test
* lisp/emacs-lisp/comp.el (comp-add-call-cstr): Fix it.
* test/src/comp-tests.el (assume-in-loop-1): New test.
* test/src/comp-test-funcs.el (comp-test-assume-in-loop-1-f): New
function.
Andrea Corallo [Fri, 18 Dec 2020 17:37:16 +0000 (18:37 +0100)]
Fix value type inference for doubly negate constraints
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Do not propagate in
case of double negation.
* test/src/comp-test-funcs.el (comp-test-assume-double-neg-f):
New function.
* test/src/comp-tests.el (assume-double-neg): New test.
Andrea Corallo [Thu, 17 Dec 2020 16:31:22 +0000 (17:31 +0100)]
* Guarantee fwprop convergence and termination
* lisp/emacs-lisp/comp.el (comp-emit-call-cstr): Have new-mvar as
LHS *and* RHS when constraining in and to ensure monotonicity and
fwprop convergence.
(comp-fwprop): Raise a warning for debug reasons in case fwprop
does not converge within 100 iterations.
Andrea Corallo [Tue, 15 Dec 2020 22:53:29 +0000 (23:53 +0100)]
Enhance type inference constraining function arguments
* lisp/emacs-lisp/comp.el: Add some commentary.
(comp-cond-cstrs-target-mvar): Rename and update docstring.
(comp-add-cond-cstrs): Update to use
`comp-cond-cstrs-target-mvar'.
(comp-emit-call-cstr, comp-lambda-list-gen, comp-add-call-cstr):
New functions.
(comp-add-cstrs): Call `comp-add-call-cstr'.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Update two
type specifier tests.
Andrea Corallo [Mon, 21 Dec 2020 17:39:34 +0000 (18:39 +0100)]
* Enumerate and split type specifier tests in comp-tests.el to ease debug
* test/src/comp-tests.el (comp-tests-type-spec-tests): Enumerate.
(comp-tests-define-type-spec-test): New function.
(comp-tests-define-type-spec-tests): New macro to expand tests.
Eli Zaretskii [Mon, 21 Dec 2020 17:27:02 +0000 (19:27 +0200)]
Fix frame creation on X when tool bar is disabled
* src/xterm.c (handle_one_xevent): Restrict the fix for bug#44002
to situations when we are asked by the WM to create a window with
bogus 1x1 dimensions. (Bug#44794)
Andrea Corallo [Sun, 13 Dec 2020 17:02:19 +0000 (18:02 +0100)]
* Add mvar pretty print support when dumping LIMPLE
* lisp/emacs-lisp/comp.el (comp-prettyformat-mvar)
(comp-prettyformat-insn): New function.
(comp-log-func): Update to use `comp-prettyformat-insn'.
(comp-finalize-phis): Change LIMPLE phi format to ease
`comp-prettyformat-insn' destructuring.
Make python-mode fontify more assignment statements
* lisp/progmodes/python.el (python-font-lock-assignment-matcher): New
function to match assignment statements.
(python-rx): Add `assignment-target' and `grouped-assignment-target'.
(python-font-lock-keywords-maximum-decoration): Add new matchers
(bug#45341).
Dmitry Gutov [Mon, 21 Dec 2020 01:38:37 +0000 (03:38 +0200)]
Generic-ify xref-location-column
* lisp/progmodes/xref.el (xref-location-column):
Create a generic from xref-file-location-column, to use in the
common rendering code (bug#36967).
(xref--insert-xrefs): Update accordingly.
Juri Linkov [Mon, 21 Dec 2020 01:22:23 +0000 (03:22 +0200)]
De-duplicate lines in Xref buffers
* lisp/progmodes/xref.el (xref--insert-xrefs):
Render matches coming from the same line together (bug#36967).
(xref--item-at-point): Account for the above.
Andrea Corallo [Sun, 20 Dec 2020 19:53:22 +0000 (20:53 +0100)]
Have native compiler always preserve multibyte strings (bug#45342)
* lisp/emacs-lisp/comp.el (comp-final): Escape multibyte string
when offloading compilation to child process.
* test/src/comp-test-funcs.el (comp-test-45342-f): New function
* test/src/comp-tests.el (bug-45342): New test
Give get-buffer-create an optional argument to inhibit buffer hooks
in internal or temporary buffers for efficiency (bug#34765).
* etc/NEWS: Announce new parameter of get-buffer-create and
generate-new-buffer, and that with-temp-buffer and with-temp-file
now inhibit buffer hooks.
* doc/lispref/buffers.texi (Buffer Names): Fix typo.
(Creating Buffers): Document new parameter of get-buffer-create and
generate-new-buffer.
(Buffer List, Killing Buffers): Document when buffer hooks are
inhibited.
(Current Buffer):
* doc/lispref/files.texi (Writing to Files): Document that
with-temp-buffer and with-temp-file inhibit buffer hooks.
* doc/lispref/internals.texi (Buffer Internals): Document
inhibit_buffer_hooks flag. Remove stale comment.
* doc/misc/gnus-faq.texi (FAQ 5-8):
* lisp/simple.el (shell-command-on-region): Fix indentation.
* lisp/subr.el (generate-new-buffer): Forward new optional argument
to inhibit buffer hooks to get-buffer-create.
(with-temp-file, with-temp-buffer, with-output-to-string):
* lisp/json.el (json-encode-string): Inhibit buffer hooks in buffer
used.
* src/buffer.c (run_buffer_list_update_hook): New helper function.
(Fget_buffer_create): Use it. Add optional argument to set
inhibit_buffer_hooks flag instead of comparing the buffer name to
Vcode_conversion_workbuf_name. All callers changed.
(Fmake_indirect_buffer, Frename_buffer, Fbury_buffer_internal)
(record_buffer): Use run_buffer_list_update_hook.
(Fkill_buffer): Document when buffer hooks are inhibited. Use
run_buffer_list_update_hook.
(init_buffer_once): Inhibit buffer hooks in Vprin1_to_string_buffer.
(Vkill_buffer_query_functions, Vbuffer_list_update_hook): Document
when hooks are inhibited.
* src/buffer.h (struct buffer): Update inhibit_buffer_hooks
commentary.
* src/coding.h (Vcode_conversion_workbuf_name):
* src/coding.c (Vcode_conversion_workbuf_name): Make static again
since it is no longer needed in src/buffer.c.
(code_conversion_restore, code_conversion_save, syms_of_coding):
Prefer boolean over integer constants.
* src/fileio.c (Finsert_file_contents): Inhibit buffer hooks in
" *code-converting-work*" buffer.
* src/window.c (Fselect_window): Fix grammar. Mention
window-selection-change-functions alongside buffer-list-update-hook.
* test/src/buffer-tests.el: Fix requires.
(buffer-tests-inhibit-buffer-hooks): New test.
Juri Linkov [Sat, 19 Dec 2020 20:19:18 +0000 (22:19 +0200)]
* lisp/image-mode.el: Use one timer and lock for slow remote calls (bug#45256)
* lisp/image-mode.el (image-auto-resize-timer): New variable.
(image--window-state-change): Cancel previous timer and
remember new timer in image-auto-resize-timer.
(image--window-state-change): New variable.
(image-fit-to-window): When image-fit-to-window-lock is nil,
call image-toggle-display-image ignoring 'remote-file-error'.