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.
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.
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'.
Stefan Kangas [Sat, 19 Dec 2020 18:54:46 +0000 (19:54 +0100)]
Convert apropos-internal from C to Lisp (Bug#44529)
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:
Roland Winkler [Sat, 19 Dec 2020 04:26:40 +0000 (22:26 -0600)]
bibtex-mode: Permit user-defined schemes for sorting entries.
* lisp/textmodes/bibtex.el (bibtex-maintain-sorted-entries):
New allowed value (INDEX-FUN PREDICATE).
(bibtex-entry-index, bibtex-lessp): Use it.
(bibtex-init-sort): Rename from bibtex-init-sort-entry-class-alist.
Glenn Morris [Fri, 18 Dec 2020 16:55:06 +0000 (08:55 -0800)]
Merge from origin/emacs-27
48b9c47805 Minor fixes in authors.el and in tarball-making instructions d7a4ceaa1e ; Add a new item to TODO 64fe805b19 Improve documentation of 'query-replace' 7cacf5da47 Update to Org 9.4.3
João Távora [Fri, 18 Dec 2020 15:38:27 +0000 (15:38 +0000)]
Document that flymake-diag-region saves match data
The typical use of this function (which is parsing compiler diagnostic
messages), lends itself too easily to one the problems in bug#29193.
Make it a friendlier API.
* doc/misc/flymake.texi (Flymake utility functions): Document that
flymake-diag-region saves match data.
* lisp/progmodes/flymake.el (flymake-diag-region): Document that
this saves match data.
Stefan Monnier [Fri, 18 Dec 2020 15:02:15 +0000 (10:02 -0500)]
* lisp/emacs-lisp/package.el: Byte compile the quickstart file
Earlier tests had found problems when byte-compiling the file,
but later investigations indicated the problem was not
directly related. The performance difference is appreciable.
(package-quickstart-refresh): Byte compile the file.
(package-activate-all): Load byte-compiled version if available.
(package--quickstart-maybe-refresh): Delete the byte-compiled file as well.
* lisp/help-fns.el (help-fns--first-release): Use string-end instead
of line-end when matching a file name.
* lisp/org/ob-core.el (org-babel--string-to-number): Put hyphen last
in alternative.
* lisp/org/org-agenda.el (org-agenda-filter): Escape '+' correctly.
Zajcev Evgeny [Thu, 17 Dec 2020 08:27:20 +0000 (11:27 +0300)]
Make "Invalid modifier in string" ordinary invalid-read-syntax error
* src/lread.ec (read1): Raise "Invalid modifier in string" error as
`invalid-read-syntax'. This fixes raise of unhandled error in
`elisp--local-variables'
Pankaj Jangid [Wed, 16 Dec 2020 22:34:20 +0000 (23:34 +0100)]
Fix resetting of gnus-pick-line-number
* lisp/gnus/gnus-sum.el (gnus-summary-read-group-1): Move setting
gnus-pick-line-number from here (bug#45269)...
(gnus-summary-prepare): To here. This ensures that the number is
reset when regenerating the buffer, for instance when limiting it.
Juri Linkov [Wed, 16 Dec 2020 21:27:11 +0000 (23:27 +0200)]
Don't show minibuffer keybindings for suggestions in read-extended-command
* lisp/simple.el (read-extended-command): Use 'affixation-function'
instead of 'annotation-function'. (Bug#45035)
(read-extended-command--affixation): New function created from
'read-extended-command--annotation'.
Juri Linkov [Wed, 16 Dec 2020 21:19:46 +0000 (23:19 +0200)]
Give affixation-function higher priority over annotation-function (bug#45234)
* doc/lispref/minibuf.texi (Completion Variables)
(Programmed Completion): Describe precedence rules
of affixation-function and annotation-function.
* lisp/minibuffer.el (completion-metadata)
(completion-extra-properties): Describe precedence rules
of affixation-function and annotation-function.
(minibuffer-completion-help): First try to apply
affixation-function, if there is no such function,
try annotation-function.
Eli Zaretskii [Tue, 15 Dec 2020 17:34:16 +0000 (19:34 +0200)]
Fix C-n/C-p when a line starts with an image
* src/xdisp.c (move_it_to): Handle the case where the second call
to move_it_in_display_line_to under MOVE_TO_Y takes us farther
from TO_CHARPOS than the first call. This fixes values returned
by pos-visible-in-window-p and posn-at-point when the screen line
starts with invisible text followed by an image. (Bug#9092)
Eli Zaretskii [Tue, 15 Dec 2020 17:19:43 +0000 (19:19 +0200)]
Fix setting breakpoints in "M-x gdb" when a source file is missing
* lisp/progmodes/gdb-mi.el (gdb-get-location): Fix control flow
logic when "fullname" is not found. Unquote and unescape the full
file name by calling gdb-mi--c-string-from-string. FLAG is a
string, not a character. (Bug#15051)
Alan Mackenzie [Tue, 15 Dec 2020 12:09:47 +0000 (12:09 +0000)]
CC Mode: Optimize for scrolling large buffers containing few braces
This fixes bug #25706. It particularly pertains to .h files which contain
only macro definitions. Many of these files are to be found, for example, in
the driver sections of the Linux kernel.
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1, c-on-identifier)
(c-syntactic-skip-backward, c-find-decl-prefix-search, c-find-decl-spots)
(c-forward-name, c-back-over-list-of-member-inits)
(c-back-over-member-initializers, c-looking-at-inexpr-block)
(c-guess-basic-syntax): Give search limits to, or amend existing ones to
c-backward-syntactic-ws, c-forward-syntactic-ws, c-backward-token-2,
c-beginning-of-statement-1.
(c-determine-limit-no-macro): New function.
(c-determine-limit-get-base): Remove unlimted invocation of
c-backward-syntactic-ws.
(c-determine-limit): Exclude movement between two different macros. Use new
function c-determine-limit-no-macro.
(c-back-over-list-of-member-inits): New parameter `limit'.
* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
(c-font-lock-declarations, c-font-lock-c++-using): Give search limits to, or
amend existing ones to c-backward-syntactic-ws, c-beginning-of-decl-1.
* lisp/progmodes/cc-mode.el (c-unfind-coalesced-tokens, c-before-changer)
(c-fl-decl-end): Give search limits to, or amend existing ones to
c-backward-syntactic-ws, c-forward-syntactic-ws, skip-chars-backward,
skip-chars-forward.