Paul Eggert [Sun, 25 Aug 2019 17:01:46 +0000 (10:01 -0700)]
Fix misdisplay of PNG paletted images
Problem reported by Roland Winkler (Bug#37153).
Derived from a patch suggested by YAMAMOTO Mitsuharu (Bug#37153#62).
* src/image.c (png_get_valid) [WINDOWSNT]:
Do not dynamically link this function.
(png_get_tRNS) [WINDOWSNT && PNG_tRNS_SUPPORTED]:
Dynamically link this function instead.
(png_load_body): Do not assume that every paletted image supplies
only transparency data. Fix typo in use of transparent_p.
Alan Mackenzie [Sun, 25 Aug 2019 10:21:37 +0000 (10:21 +0000)]
Introduce new value t for compilation-context-lines to eliminate scrolling
In particular, to prevent scrolling in a window lacking a left fringe.
Instead, a visible arrow "=>" is inserted before column zero. This fixes
bug #36832.
* lisp/progmodes/compile.el (compilation-context-lines): Add the new value t.
(compilation-set-window): Amend to handle compilation-context-lines being t.
(overlay-arrow-overlay): New variable holding an overlay with before-string
property "=>".
(compilation-set-overlay-arrow): New function which manipulates
overlay-arrow-overlay.
(compilation-goto-locus, compilation-find-file): In addition to calling
compilation-set-window, also call compilation-set-overlay-arrow.
* doc/emacs/building.texi (Compilation Mode): Document the new value t which
compilation-context-lines can take.
Eli Zaretskii [Sun, 25 Aug 2019 08:08:11 +0000 (11:08 +0300)]
Fix a recent change in coding.c
This partially reverts the changes in "extern function cleanup".
* src/coding.c (encode_string_utf_8, decode_string_utf_8): Now
extern again. They should NOT be static, as they are intended
to be used by the likes of json.c, where we need
highly-optimized code for processing UTF-8 strings. E.g.,
decode_string_utf_8 beats make_string_from_utf8 by a factor of
2 to 5 in a large number of scenarios.
Paul Eggert [Sat, 24 Aug 2019 22:46:31 +0000 (15:46 -0700)]
Speed up % and mod with fixnum denom
* src/data.c (integer_remainder): New function. When the
numerator is a bignum and the denominator is small, this function
uses mpz_tdiv_ui, which should be faster than mpz_tdiv_r.
(Frem, Fmod): Use it.
Paul Eggert [Sat, 24 Aug 2019 19:45:36 +0000 (12:45 -0700)]
Tweak integer mod performance
* src/data.c (integer_mod): Use mpz_tdiv_r not mpz_mod, as that’s
more similar to the fixnum case, is a bit more efficient, and
otherwise the later ‘sgn_r < 0’ code is useless anyway.
Paul Eggert [Sat, 24 Aug 2019 19:43:50 +0000 (12:43 -0700)]
Make (mod 1.0 0) consistent with (/ 1.0 0)
* src/data.c (Fmod): Do not signal an error for (mod 1.0 0), for
the same reason (/ 1.0 0) does not signal an error.
* test/src/data-tests.el (data-tests-mod-0): New test.
Paul Eggert [Sat, 24 Aug 2019 18:42:28 +0000 (11:42 -0700)]
extern function cleanup
Most of these functions can be static. A few are unused.
* src/coding.c (encode_string_utf_8, decode_string_utf_8):
Define only if ENABLE_UTF_8_CONVERTER_TEST, as they're
not needed otherwise.
* src/coding.c (encode_string_utf_8, decode_string_utf_8):
* src/data.c (integer_mod):
* src/fns.c (base64_encode_region_1, base64_encode_string_1):
* src/ftfont.c (ftfont_get_fc_charset):
Now static.
* src/sysdep.c (verrprintf): Remove; unused.
Noam Postavsky [Fri, 23 Aug 2019 00:48:19 +0000 (20:48 -0400)]
Fix non-deterministic process test
* test/src/process-tests.el (set-process-filter-t): Don't assume
subprocess output will come in a single chunk, keep waiting for more
data until next "prompt" is read from subprocess.
Robert Pluim [Sat, 24 Aug 2019 12:54:02 +0000 (14:54 +0200)]
Fix DNS tests
* test/src/process-tests.el: (lookup-family-specification,
lookup-unicode-domains, unibyte-domain-name, lookup-google,
non-existent-lookup-failure): Skip on Hydra, which doesn't have DNS.
Fix buggy test condition. (Bug#37165)
Michael Albinus [Sat, 24 Aug 2019 08:10:05 +0000 (10:10 +0200)]
Fix some problems of Bug#36940
* test/lisp/net/tramp-tests.el (tramp-test22-file-times): Do not
compare time value lists by `equal'. (Bug#36940).
(tramp-test30-make-process): Adapt "kill" message to match on macOS.
Paul Eggert [Fri, 23 Aug 2019 18:50:40 +0000 (11:50 -0700)]
Tweak gnutls-peer-status reporting
* src/gnutls.c (Fgnutls_peer_status): Report :compression and
:encrypt-then-mac only if the underlying GnuTLS library has
the corresponding features. This give the Elisp caller a bit
more information about the peer status.
* lisp/net/nsm.el (nsm-protocol-check--compression):
Don’t worry about compression in newer GnuTLS versions
that do not support compression.
Paul Eggert [Fri, 23 Aug 2019 18:17:38 +0000 (11:17 -0700)]
Clarify compiler-pacifier in frame.c
* src/frame.c (Fx_parse_geometry): Pacify the compiler in a
different way, so that the human reader can more easily see
that the initializations are unnecessary.
Noam Postavsky [Fri, 23 Aug 2019 11:59:32 +0000 (07:59 -0400)]
; Fix references to log-edit-generate-changelog-from-diff
* doc/emacs/maintaining.texi (Log Buffer):
* etc/NEWS: Replace log-edit-generate-changelog (an old name which was
changed during editing) to log-edit-generate-changelog-from-diff.
Noam Postavsky [Fri, 23 Aug 2019 11:55:09 +0000 (07:55 -0400)]
Print macro modified macro keys as characters not integers
* lisp/macros.el (macros--insert-vector-macro): Pass all elements to
'prin1-char', not just those that satisfy characterp (because characters
which have modifier bits set wouldn't qualify otherwise).
'prin1-char' will return nil if it can't handle the argument (e.g.,
for symbols representing function keys).
Rename renamed nsm.el variables and functions back
* doc/emacs/misc.texi (Network Security): Start working on
updating the NSM bits, but it's unclear how much of the new stuff
to document.
* lisp/net/nsm.el: Rename all nsm-tls-check-* functions to
nsm-protocol-check--* to bring them back into line with the
documentation.
(network-security-protocol-checks): Renamed back again from
`nsm-tls-checks', as this variable is documented and can't just go
away.
* lisp/net/nsm.el (network-security-level, nsm-tls-checks): Make
`low' a "check nothing" setting again, and move all the `low'
checks back to `medium'. This makes the test suite work again.
Paul Eggert [Fri, 23 Aug 2019 08:11:12 +0000 (01:11 -0700)]
Get the Gnutls code compiling on Fedora 30
The recent changes caused the build to fail on Fedora 30 when built
with --enable-gcc-warnings, among other things with diagnostics that
gnutls_compression_get and gnutls_compression_get_name are deprecated
(this started with GnuTLS 3.6). Fix this by refusing to call these
obsolescent and now-dummy functions in GnuTLS 3.6 and later. However,
this is just a temporary workaround to get the build working; a real
fix is needed, as network-stream-tests fail.
* src/gnutls.c (HAVE_GNUTLS_COMPRESSION_GET): New macro.
(gnutls_compression_get, gnutls_compression_get_name):
Define only if HAVE_GNUTLS_COMPRESSION_GET.
(init_gnutls_functions): Load the two functions only if
HAVE_GNUTLS_COMPRESSION_GET.
(emacs_gnutls_certificate_export_pem): Use alloca instead of xmalloc.
(Fgnutls_peer_status): Just return "NULL" if the functions
are deprecated.
(Fgnutls_format_certificate): Fix pointer signedness glitches.
* src/process.c: Fix spacing.
Put error output from M-! at the end of the error buffer
* lisp/simple.el (shell-command-on-region): Put the error output
at the end of the buffer instead of wherever point is (bug#7513).
This avoids interleaving error output.
Damien Cassou [Fri, 23 Aug 2019 04:30:46 +0000 (06:30 +0200)]
Add imenu support to xref
* lisp/progmodes/xref.el (xref--imenu-prev-index-position)
(xref--imenu-extract-index-name): Add functions to get imenu support.
(xref--xref-buffer-mode): Set imenu variables to the new functions.
* etc/NEWS: Add corresponding entry (bug#36974).
Tweak the warning display to be less like a TLS decoding page
* lisp/net/nsm.el (nsm-parse-subject, nsm-certificate-part):
Restore functions for parsing subjects.
(nsm-format-certificate): Use them to display more user-friendly
data. Also change the display to have fewer lines again so that
the data of interest isn't pushed off the screen.
* lisp/shell.el (shell-mode): This mode can't usefully be called
interactively (and is somewhat destructive, as it disables
`undo'), and it's usually confused with `shell-script-mode'
(bug#19812). So signal an error if it's used interactively.
Make ibuffer-mark-by-file-name-regexp work on the displayed file name
* lisp/ibuf-ext.el (ibuffer-mark-by-file-name-regexp): Perform the
matching on the abbreviated (i.e., displayed) file name, and not
the complete name (bug#18859). This seems like the more expected
action.
Have `M-x battery' list all batteries under GNU/Linux
* lisp/battery.el (battery-upower-device): Remove (bug#25559).
(battery--find-linux-sysfs-batteries): New function.
(battery-status-function, battery-linux-sysfs): Use it to list all
batteries, no matter what they're called.
Signal `invalid-read-syntax' for "trailing garbage"
* src/minibuf.c (string_to_object): Signal `invalid-read-syntax'
instead of the generic `error' for "trailing garbage following
expression" (bug#24649).
Paul Eggert [Thu, 22 Aug 2019 05:29:35 +0000 (22:29 -0700)]
Remove no-longer-needed workaround for GC bug
* src/keymap.c (describe_vector): Remove old workaround for GC bug.
This workaround, introduced in 1993-02-19T05:43:54Z!rms@gnu.org,
has not been needed for some time. Problem reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
Paul Eggert [Thu, 22 Aug 2019 05:19:03 +0000 (22:19 -0700)]
Don’t debug fset by default
This GC bug seems to have been fixed, so the check is no longer
needed in production code. From a suggestion by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
* src/alloc.c (SUSPICIOUS_OBJECT_CHECKING) [!ENABLE_CHECKING]:
Do not define.
(find_suspicious_object_in_range, detect_suspicious_free):
Expand to proper dummy expressions if !SUSPICIOUS_OBJECT_CHECKING.
* src/data.c (Ffset): Convert test to an eassert.
Paul Eggert [Thu, 22 Aug 2019 01:54:08 +0000 (18:54 -0700)]
Fix clrhash bug when hash table needs rehashing
Problem reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
* src/fns.c (maybe_resize_hash_table): Prefer ASET to gc_aset
where either will do. Simplify appending of Qunbound values.
Put index_size calculation closer to where it’s needed.
(hash_clear): If hash_rehash_needed_p (h), don’t clear the
nonexistent hash vector. Use memclear to speed up clearing.
* src/lisp.h (HASH_TABLE_SIZE): Check that the size is positive,
and tell that to the compiler.
Paul Eggert [Thu, 22 Aug 2019 00:18:33 +0000 (17:18 -0700)]
Don’t hard-loop on cycles in ‘read’ etc.
Problem for ‘read’ reported by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00316.html
* src/fns.c (Frequire): Protect against circular current-load-list.
* src/lread.c (Fget_load_suffixes):
Protect against circular load-suffixes or load-file-rep-suffixes.
(Fload): Protect against circular loads-in-progress.
(openp): Protect against circular PATH and SUFFIXES.
(build_load_history): Protect against circular load-history or
current-load-list.
(readevalloop_eager_expand_eval): Protect against circular SUBFORMS.
(read1): Protect against circular data.
* test/src/lread-tests.el (lread-circular-hash): New test.
* lisp/progmodes/hideif.el (hide-ifdef-mode-prefix-key): Make into
a defcustom since it seems like this is something that should be
user-customisable (bug#8922).
Use `quit-window-hook' in Info instead of having its own command
* doc/misc/info.texi (Help-Q): Info now uses `quit-window'.
* lisp/info.el (info-standalone): Adjust doc string.
(Info-exit): Made into obsolete alias.
(Info-mode-map): Bind "q" to `quit-window'.
(Info-mode-menu): Adjust.
(info-tool-bar-map): Ditto.
(Info-mode): Adjust doc string.
(Info-mode): If Info is standalone, kill Emacs on "q".
Call `quit-window-hook' in the `quit-window' command only
* lisp/window.el (quit-restore-window): Don't run quit-window-hook
here...
(quit-window): ... but here instead. Callers that call the former
programmatically can decide themselves whether to call the hook.
(quit-window-hook): Fix doc string.
Paul Eggert [Wed, 21 Aug 2019 07:06:00 +0000 (00:06 -0700)]
Be more careful about pointers to bignum vals
This uses ‘const’ to be better at catching bugs that
mistakenly attempt to modify a bignum value.
Lisp bignums are supposed to be immutable.
* src/alloc.c (make_pure_bignum):
* src/fns.c (sxhash_bignum):
Accept Lisp_Object instead of struct Lisp_Bignum *, as that’s
simpler now. Caller changed.
* src/bignum.h (bignum_val, xbignum_val): New inline functions.
Prefer them to &i->value and XBIGNUM (i)->value, since they
apply ‘const’ to the result.
* src/timefns.c (lisp_to_timespec): Use mpz_t const *
to point to a bignum value.
Paul Eggert [Wed, 21 Aug 2019 00:34:03 +0000 (17:34 -0700)]
Avoid some excess precision in time arithmetic
* doc/misc/emacs-mime.texi (time-date):
Adjust example to match new behavior.
* etc/NEWS: Mention this.
* lisp/calendar/time-date.el (decoded-time-add)
(decoded-time--alter-second):
Don’t lose underestimate precision of seconds component.
* src/bignum.c (mpz): Grow by 1.
* src/timefns.c (trillion_factor): New function.
(timeform_sub_ps_p): Remove.
(time_arith): Avoid unnecessarily-large hz, by reducing the hz
to a value no worse than the worse hz of the two arguments.
The result is always exact unless an error is signaled.
* test/src/timefns-tests.el (timefns-tests--decode-time):
New function.
(format-time-string-with-zone): Test (decode-time LOOK ZONE t)
resolution as well as its numeric value.
Noam Postavsky [Sun, 4 Aug 2019 00:19:31 +0000 (20:19 -0400)]
Respect global-eldoc-mode in minibuffers (Bug#36886)
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Accept
a BODY parameter.
* doc/lispref/modes.texi (Defining Minor Modes): Document new
parameter.
* etc/NEWS: Announce it.
* lisp/simple.el (read--expression): Move eldoc-mode setup to...
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): ... here,
new function.
(global-eldoc-mode): Add or remove it to
eval-expression-minibuffer-setup-hook when enabling or disabling
global-eldoc-mode. This enables eldoc in the minibuffer (solving
Bug#27202), only when global-eldoc-mode is enabled.
Paul Eggert [Tue, 20 Aug 2019 21:02:30 +0000 (14:02 -0700)]
Support larger TIMEs in (time-convert TIME t)
Also, improve the doc to match current behavior.
* doc/lispref/os.texi (Time Conversion): Document that
time-convert signals an error for infinite or NaN args,
and that (time-convert TIME t) is exact otherwise.
Mention float-time as an alternative to time-convert.
(Time Calculations): Document that time-add and time-subtract
are exact and do not decrease HZ below the minimum of their args.
* src/timefns.c (decode_float_time): Don’t signal an error for
floating-point arguments whose base-FLT_RADIX exponent is not less
than DBL_MANT_DIG. Instead, convert them to (TICKS . 1) values.
Use two (instead of three) integer exponent comparisons in the
typical case.
* test/src/timefns-tests.el (time-arith-tests):
Add more floating-point tests, including some tests
that the old code fails.
Michael Albinus [Tue, 20 Aug 2019 19:32:34 +0000 (21:32 +0200)]
Another attempt to fix bug#32645
* test/lisp/autorevert-tests.el ()
(auto-revert-test02-auto-revert-deleted-file):
* test/lisp/filenotify-tests.el (file-notify-test04-autorevert):
Check `file-notify-valid-p', not that the descriptor is nil.
Glenn Morris [Tue, 20 Aug 2019 16:01:55 +0000 (09:01 -0700)]
Merge from origin/emacs-26
0b810eb Fix a typo in char-width-table 3f00db7 Minor update in admin/notes/unicode bcd0115 Fix lisp indent infloop on unfinished strings (Bug#37045) 5f992d1 Improve commentary in composite.el 3a04be2 ; Improve commentary in xdisp.c 15de1d1 Fix markup in dired-x.texi bda7fc7 ; Fix typo in a doc string of speedbar.el 6f57ef9 * src/callproc.c (Fcall_process): Doc fix.
Mauro Aranda [Sat, 10 Aug 2019 13:48:24 +0000 (10:48 -0300)]
Don't display wrong ElDoc information when inside ELisp strings or comments
* lisp/progmodes/elisp-mode.el (elisp--fnsym-in-current-sexp): Since
forward-sexp assumes point is not in a string or comment, avoid
calling it and then checking if point is inside a string, since that
sometimes will fail with awkward results. (Bug#35567)
Output `auto-coding-alist' in `describe-current-coding-system'
* lisp/international/mule-diag.el
(describe-current-coding-system): Also output the contents of
`auto-coding-alist', which take precedence over
`file-coding-system-alist' (bug#9575).
* doc/lispref/windows.texi (Quitting Windows): Mention in.
* lisp/window.el (quit-restore-window): Run the new
`quit-window-hook' before doing anything else (bug#9867).
(quit-window): Note that the hook will be run in the doc string.
* lisp/window.el (quit-window-hook): New variable.
Paul Eggert [Tue, 20 Aug 2019 01:04:56 +0000 (18:04 -0700)]
Fix org-table 65536-second bug
* lisp/org/org-table.el (org-table-message-once-per-second):
Fix bug when clock difference goes past a 65536-second boundary.
Don’t assume particular format for current-time result.