João Távora [Wed, 31 Jul 2019 21:07:41 +0000 (22:07 +0100)]
Rework jit-lock-antiblink-grace after Stefan's comments
* lisp/jit-lock.el (jit-lock--antiblink-l-b-p): Rename from
jit-lock--antiblink-l-l-b.
(jit-lock--antiblink-grace-timer): Add period to docstring.
(jit-lock--antiblink-post-command): Rework after Stefan's
comments.
João Távora [Fri, 12 Jul 2019 18:27:53 +0000 (19:27 +0100)]
New jit-lock-antiblink-grace feature
* lisp/jit-lock.el (jit-lock-antiblink-grace): New user-visible variable.
(jit-lock--antiblink-grace-timer, jit-lock--antiblink-l-l-b)
(jit-lock--antiblink-i-s-o-c): New helpers.
(jit-lock-mode): Tweak post-command-hook and
jit-lock-context-timer.
(jit-lock--antiblink-post-command): New helper.
* lisp/mail/rfc2047.el (rfc2047-fold-region): Don't break lines
right after the Header: field, but wait until the next
whitespace. (This only makes a difference for words that are very
long (i.e., longer than, say, 60 characters, depending on the
header name length.)
Paul Eggert [Fri, 12 Jul 2019 06:06:22 +0000 (23:06 -0700)]
Tweak builtin symbol order for speed
* lib-src/make-docfile.c (compare_globals):
Make symbols 1 through 4 be t, unbound, error, lambda.
This is in addition to symbol 0 being nil.
This change improved ‘make compile-always’ performance by 0.6%
on my platform.
Paul Eggert [Fri, 12 Jul 2019 00:01:20 +0000 (17:01 -0700)]
Avoid duplicate comparison in describe_map_compare
* src/fns.c (string_version_cmp): New function.
This has most of the old Fstring_version_lessp,
with an assertion to make things a bit clearer.
* src/fns.c (Fstring_version_lessp):
* src/keymap.c (describe_map_compare): Use it (Bug#33237).
Juri Linkov [Thu, 11 Jul 2019 21:35:21 +0000 (00:35 +0300)]
Better match-data handling in perform-replace
* lisp/replace.el (perform-replace): Don't wrap replace-highlight
in save-match-data. Use `(nth 0 real-match-data)' instead of
`(match-beginning 0)' after replace-highlight. (Bug#36328)
* lisp/format-spec.el (format-spec): Allow passing through format
strings that have no specs (to be able to act as a filter). Also
add an example.
* test/lisp/format-spec-tests.el (test-format-spec): Add tests for
the new functionality.
* src/fileio.c (Fexpand_file_name): Clarify that "~" in NAME is
expanded, and not just "~/". Also clarify that ~USER is not
expanded if USER doesn't exist (bug#36490).
Tweak the order keystrokes are sorted in keymap listings
* src/keymap.c (describe_map_compare): Change the sorting order of
keystrokes, so that we get the order <f1> <f2> <f11> instead of
<f1> <f11> <f2> (bug#33237).
* lisp/progmodes/elisp-mode.el (eval-sexp-add-defvars): When
collecting defvars in the current buffer, ignore the ones that are
in comments or strings (bug#34233).
Eli Zaretskii [Thu, 11 Jul 2019 13:28:41 +0000 (16:28 +0300)]
Resurrect SVG support on MS-Windows
* src/image.c (syms_of_image) <Qgio> [HAVE_NTGUI]: New DEFSYM.
(init_svg_functions) [LIBRSVG_CHECK_VERSION >= 2.32.0]: Load
g_file_new_for_path and g_memory_input_stream_new_from_data
from libgio, not from libglib. (Bug#35548)
* lisp/term/w32-win.el (dynamic-library-alist): Add the libgio
DLL.
Eli Zaretskii [Thu, 11 Jul 2019 13:03:33 +0000 (16:03 +0300)]
Avoid assertion violations when resize-mini-windows is nil
* src/xdisp.c (resize_mini_window): Always reset the
mini-window's start point to the beginning of the buffer, even
if resizing is not needed. This avoids assertion violations
when resize-mini-windows is nil. (Bug#36595)
Paul Eggert [Wed, 10 Jul 2019 19:37:55 +0000 (12:37 -0700)]
Avoid functions deprecated in librsvg 2.45.1
* src/image.c (init_svg_functions) [WINDOWSNT]:
Load the pre-2.32 or 2.32 functions,
depending on LIBRSVG_CHECK_VERSION.
(svg_load_image): In librsvg 2.32 or later, use
g_memory_input_stream_new_from_data, g_file_new_for_path and
rsvg_handle_new_from_stream_sync rather than the
deprecated-in-2.45 rsvg_handle_write and rsvg_handle_close.
From a patch by YAMAMOTO Mitsuharu (Bug#35548#11).
* lisp/calc/calc-alg.el (calcFunc-sec, calcFunc-csc, calcFunc-cot):
Check that `math-known-sin' and `math-known-tan' succeeded before
using their value in arithmetic.
* test/lisp/calc/calc-tests.el (calc-test-trig): Add regression tests.
Stefan Kangas [Sun, 7 Jul 2019 14:27:26 +0000 (16:27 +0200)]
Small cleanups in asm-mode.el (Bug#36540)
* lisp/progmodes/asm-mode.el: Remove "tools" from "Keywords" header.
Doc fixes.
(asm-comment-char, asm-comment): Doc fixes.
(asm-newline): Redefine as an obsolete function alias for
'newline-and-indent' instead of using a defalias.
* lisp/comint.el (comint--prompt-recursion-depth): New variable
(bug#33252).
(comint-watch-for-password-prompt): Use it to avoid bugging out
and making Emacs unusable when a shell script is prompting for
passwords in an infloop.
* lisp/gnus/message.el (message--fold-long-headers): Header lines
should be no longer than 79 characters before folding
(bug#33313). Previous comment about 998 octets is about maximum
allowed header field length.
Paul Eggert [Wed, 10 Jul 2019 06:18:13 +0000 (23:18 -0700)]
Simplify math-get-calendar-tzinfo
* lisp/calc/calc-forms.el (calendar-current-time-zone-cache):
Remove defvar.
(math-get-calendar-tzinfo): Simplify and do not reach
into caldst’s cache.
Stefan Monnier [Tue, 9 Jul 2019 21:04:07 +0000 (17:04 -0400)]
* src/fileio.c: Fix bug#36431
(decide_coding_unwind): Re-introduce. Move text back to the gap.
Return the new `inserted` via the unwind_data.
(Finsert_file_contents): Use it.
Make sure `inserted` is always 0 when we jump straight to `notfound`.
Don't insert the text in the buffer until we know it's properly decoded
for the byteness of the buffer.
* test/src/fileio-tests.el (fileio-tests--insert-file-interrupt):
Allow insert-file-contents to return an empty buffer in case of
non-local exit in set-auto-coding-function.
Paul Eggert [Tue, 9 Jul 2019 20:55:16 +0000 (13:55 -0700)]
Defend fingerprint against even-smarter LTO
* src/pdumper.c (Fdump_emacs_portable, pdumper_load):
Don’t cast volatile to non-volatile pointer, as that does not in
general suffice to prevent a compiler from optimizing away memcmp
and/or memcpy calls. Instead, copy the fingerprint by hand.
Paul Eggert [Tue, 9 Jul 2019 20:10:27 +0000 (13:10 -0700)]
Do not alter match data in Fcapitalize etc.
Without this patch, (capitalize "x") can alter the match data,
which is not what users expect. Problem found by running
morse-tests-unnato-region in a stripped-down Emacs.
Perhaps ‘load’ should also save and restore the match data?
That would be a simpler fix, though arguably incompatible.
* src/lread.c (save_match_data_load): New function.
* src/chartab.c (uniprop_table):
* src/doc.c (reread_doc_file):
* src/eval.c (Fautoload_do_load):
* src/fns.c (Frequire): Use it.
Paul Eggert [Tue, 9 Jul 2019 20:02:51 +0000 (13:02 -0700)]
Port image-type-from-file-header-test to non-SVG Emacs
Problem reported privately by Michael Albinus.
* test/lisp/image-tests.el (image-type-from-file-header-test):
Don’t assume svg is a supported image type.
* lisp/json.el (json-pretty-print-max-secs): Make obsolete.
(json-pretty-print): Pretty-print all JSON objects in the region
instead of just the first one (and then deleting all other
objects) (bug#34160).
* lisp/json.el (json-pretty-print-max-secs): Make obsolete.
(json-pretty-print): Pretty-print all JSON objects in the region
instead of just the first one (and then deleting all other
objects) (bug#34160).
Clarify json-read and json-encode parameters and return values
* lisp/json.el (json-read): Try to clarify what's returned (bug#34242).
(json-encode): Refer to `json-read' about what the input is and
say what error is signalled.
Fix alternative-email-as-from with empty To headers in Message
* lisp/gnus/message.el (message-use-alternative-email-as-from):
Don't add a "," at the start of the address if the To header
doesn't exist (bug#34293).
* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): Don't
bug out on malformed Emacs Lisp (bug#34760).
(checkdoc-file-comments-engine): Don't bug out on empty buffers.
* lisp/delim-col.el (delimit-columns-region): Make the doc string
say a bit more about what it does (bug#35651).
(delimit-columns-rectangle): Refer to the first function.
Don't set url-mime-charset-string from set-language-environment
* lisp/url/url-vars.el (url-set-mime-charset-string): Make
obsolete and don't add to set-language-environment-hook
(bug#36268). If you loaded url-vars before calling
set-language-environment, you would suddenly get an unusable long
url-mime-charset-string.
* lisp/net/sieve.el (sieve-edit-script, sieve-upload): Do not pass
arbitrary string as first argument to 'message' (bug#25764).
(sieve-help): Split long string across multiple lines.
(sieve-refresh-scriptlist): Use ngettext. Fix grammar.
Ken Brown [Mon, 8 Jul 2019 22:37:33 +0000 (18:37 -0400)]
Ensure that expand-file-name returns an absolute file name
* src/fileio.c (Fexpand_file_name): Don't directly use the current
buffer's default-directory if it is relative. Instead replace it
by its expansion relative to invocation-directory. (Bug#36502)
* test/src/fileio-tests.el
(fileio-tests--relative-default-directory): New test.
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-use-jump-table): Set
to nil. We can turn this back on again when Bug#36447 is solved and
we handle dumped hash tables correctly.
Remove mention of :group in define-minor-mode info
* doc/lispref/modes.texi (Defining Minor Modes): The :group stuff
in the example and documentation isn't correct since this is not a
global mode and `hunger-mode' therefore isn't customizable
(bug#36501).