Paul Eggert [Mon, 2 Sep 2019 19:37:52 +0000 (12:37 -0700)]
Update from Gnulib
This incorporates:
2019-08-25 intprops.h, verify.h: port better to clang
2019-08-21 New strip-trailing-space option for srclist-update
* .gitattributes: Remove doc/misc/texinfo.tex special case,
which is no longer needed now that Gnulib trims blank-at-eol.
* build-aux/install-sh, doc/misc/texinfo.tex, lib/intprops.h:
* lib/regex_internal.c, lib/verify.h: Copy from Gnulib.
Paul Eggert [Sun, 1 Sep 2019 01:17:20 +0000 (18:17 -0700)]
Make user-emacs-directory a variable
This is in response to Eli’s review here:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00712.html
* lisp/subr.el (user-emacs-directory): defvar, not defconst
Paul Eggert [Sat, 31 Aug 2019 21:47:04 +0000 (14:47 -0700)]
Calculate user-emacs-directory on startup
Problem reported by Glenn Morris (Bug#583#56).
* lisp/startup.el (startup--xdg-config-default): New constant.
(startup--xdg-config-home-emacs): New var.
(startup--xdg-or-homedot): New function.
(normal-top-level): Use it to set user-emacs-directory early on.
(command-line): Also use it to determine the startup init directory.
* lisp/subr.el (user-emacs-directory): Just initialize to nil.
Paul Eggert [Sat, 31 Aug 2019 17:35:08 +0000 (10:35 -0700)]
Check instead of relying on NOTREACHED
NOTREACHED was designed for traditional lint decades ago,
and _Noreturn now normally subsumes its function.
In the one case in Emacs where NORETURN might help and _Noreturn does
not, check for NOTREACHED instead of assuming it.
* lib-src/etags.c (main):
* src/xterm.c (x_connection_closed):
Remove NOTREACHED after a call to a _Noreturn function, as NOTREACHED
is no longer needed there. Also, one of the NOTREACHEDs was
misplaced, which defeated traditional lint checking anyway.
* lib-src/pop.c (pop_getline): Redo so as to not need NOTREACHED.
* src/emacs.c (main): Use eassume (false) rather than NOTREACHED,
so that running with ENABLE_CHECKING catches any internal error
causing the toplevel Frecursive_edit to return.
Paul Eggert [Fri, 30 Aug 2019 07:24:07 +0000 (00:24 -0700)]
emacsclient: adjust to new config file location
* lib-src/emacsclient.c (open_config): New arg XDG, to respect
XDG_CONFIG_HOME, consistently with Emacs proper. Caller changed.
Use XDG convention if available, falling back on the old names
if not.
Paul Eggert [Fri, 30 Aug 2019 05:29:52 +0000 (22:29 -0700)]
Prefer ~/.config/emacs to ~/.emacs.d if neither exists
That way, when Emacs starts in a fresh home directory,
it prefers the new (XDG) convention rather than the old one.
* lisp/files.el (locate-user-emacs-file): Make the parent
directories of user-emacs-directory if needed. This is useful
if user-emacs-directory is "~/.config/emacs" and "~/.config"
does not yet exist.
* lisp/startup.el (command-line):
* lisp/subr.el (user-emacs-directory):
Prefer XDG_CONFIG_HOME to ~/.emacs.d if neither exists.
Paul Eggert [Wed, 28 Aug 2019 18:34:48 +0000 (11:34 -0700)]
Don't worry about pre-1.0.0 alsa-lib include
Problem reported by Ergus in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00563.html
* configure.ac (ALSA_SUBDIR_INCLUDE): Do not define.
* src/sound.c: Assume ALSA_SUBDIR_INCLUDE.
Paul Eggert [Tue, 27 Aug 2019 21:21:45 +0000 (14:21 -0700)]
Use XDG conventions more consistently
Fit in better with the XDG conventions.
Something like this was suggested in 2008 (Bug#583)
and the XDG conventions seem to have settled down by now.
* doc/emacs/custom.texi (Init File, Init Syntax, Find Init):
* doc/lispref/files.texi (Standard File Names):
* doc/lispref/os.texi (Init File):
* doc/misc/url.texi (Customization):
* etc/NEWS:
Adjust accordingly.
* lisp/startup.el (startup--load-user-init-file):
If init-file-name is nil, do not load from it; instead
just use the alt-file.
(find-init-path): Remove; no longer used.
(command-line): Don't check twice for XDG.
Look at XDG_CONFIG_HOME instead of assuming it's ~/.config.
Prefer XDG configuration if it exists; the user can disable
this by setting XDG_CONFIG_HOME to some other place.
* lisp/subr.el (user-emacs-directory):
Prefer XDG configuration if it exists.
Juri Linkov [Tue, 27 Aug 2019 20:48:57 +0000 (23:48 +0300)]
Browser-like Info-history button menu (bug#37184)
* doc/misc/info.texi (Help-Int): Using tool-bar to navigate history.
* lisp/info.el (Info-history-menu): New function.
(Info-history-back-menu, Info-history-forward-menu): New commands.
(Info-mode-map): Bind Info-history-back-menu and
Info-history-forward-menu to tool-bar on C-key.
Eli Zaretskii [Tue, 27 Aug 2019 15:47:24 +0000 (18:47 +0300)]
Fix crashes on MS-Windows when using GnuTLS connections
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free by an explicit call to GetProcAddress.
(gnutls_free) [WINDOWSNT]: Define as a macro that dereferences
a function pointer. (Bug#31946)
(Fgnutls_format_certificate): Use make_string_from_bytes
instead of going through an intermediate malloc'ed buffer.
Alex Branham [Thu, 15 Aug 2019 16:02:38 +0000 (11:02 -0500)]
Fix filename completion in shell mode buffers
* lisp/shell.el (shell-dynamic-complete-functions): Move
pcomplete-completions-at-point down the list so that filename
completion has a chance to complete before pcompletion.
Mauro Aranda [Tue, 27 Aug 2019 06:41:44 +0000 (08:41 +0200)]
Make link widgets obey mouse-1-click-follows-link
* lisp/wid-edit.el (widget-link-keymap): New variable, a keymap to use
inside a link widget.
('link widget): Restore the :follow-link property and add
widget-link-keymap as the :keymap property (bug#15682).
Mauro Aranda [Tue, 27 Aug 2019 06:40:32 +0000 (08:40 +0200)]
Adapt recentf.el to the change in the Widget Library
* lisp/recentf.el (recentf-open-files-item): Stop overriding
:follow-link property of the link widgets, since now it should
work as expected (bug#15682).
Paul Eggert [Tue, 27 Aug 2019 01:57:56 +0000 (18:57 -0700)]
Fix Tramp rounding of file sizes and inode numbers
* lisp/net/tramp-sh.el (tramp-perl-file-attributes)
(tramp-perl-directory-files-and-attributes)
(tramp-do-file-attributes-with-stat)
(tramp-do-directory-files-and-attributes-with-stat):
Format file sizes and inode numbers without trailing ".0",
to avoid rounding errors when absolute values exceed 2**53
(Bug#36940#94). This fixes the problem for Emacs 27 and later,
and doesn't hurt in earlier Emacs.
Eli Zaretskii [Mon, 26 Aug 2019 16:06:13 +0000 (19:06 +0300)]
Fix crashes in networking with GnuTLS on MS-Windows
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free.
(Fgnutls_format_certificate): Use gnutls_free instead of
xfree. This prevents crashes on MS-Windows, since the memory
being released was allocated inside GnuTLS. (Bug#31946)
Allow finding gpg2 binaries when gpg2 has an "unknown" version string
* lisp/epg-config.el (epg-find-configuration): Allow finding a
usable configuration even if the version string looks like "gpg
(GnuPG) 2.2.15-unknown" (bug#35629).
Teemu Likonen [Mon, 26 Aug 2019 05:52:54 +0000 (07:52 +0200)]
Only use --sender for gpg when gpg supports it
* lisp/epg-config.el (epg-required-version-p): New function (bug#37025).
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/epg.el (epg-start-sign):
(epg-start-encrypt): Use it to only use --sender when the gpg
binary supports it.
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.