Paul Eggert [Sat, 17 Aug 2019 10:27:58 +0000 (03:27 -0700)]
Update from Gnulib
This incorporates:
2019-08-17 intprops: port to Oracle Developer Studio 12.6
2019-08-14 intprops: support uchar, ushort _WRAPV dests
* lib/intprops.h: Copy from Gnulib.
Paul Eggert [Sat, 17 Aug 2019 05:09:04 +0000 (22:09 -0700)]
More-compatible subsecond calendrical timestamps
Instead of appending a subseconds member to the result of
‘decode-time’, this keeps the format unchanged unless you give
a new optional argument to ‘decode-time’. Also, the augmented
format now puts the subsecond info in the SECONDS element, so
the total number of elements is unchanged; this is more
compatible with code that expects the traditional 9 elements,
such as ‘(pcase decoded-time (`(,SEC ,MIN ,HOUR ,DAY ,MON
,YEAR ,DOW ,DST ,ZONE) ...) ...)’.
* doc/lispref/os.texi, doc/misc/emacs-mime.texi, etc/NEWS:
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/simple.el (decoded-time):
Document the new behavior.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
* lisp/calendar/iso8601.el (iso8601-parse)
(iso8601-parse-time, iso8601-parse-duration)
(iso8601--decoded-time):
* lisp/calendar/parse-time.el (parse-time-string):
* lisp/calendar/time-date.el (decoded-time-add)
(decoded-time--alter-second):
* lisp/org/org.el (org-parse-time-string):
* lisp/simple.el (decoded-time):
* src/timefns.c (Fdecode_time, Fencode_time):
* test/lisp/calendar/icalendar-tests.el:
(icalendar--decode-isodatetime):
* test/lisp/calendar/iso8601-tests.el (test-iso8601-date-years)
(test-iso8601-date-dates, test-iso8601-date-obsolete)
(test-iso8601-date-weeks, test-iso8601-date-ordinals)
(test-iso8601-time, test-iso8601-combined)
(test-iso8601-duration, test-iso8601-intervals)
(standard-test-dates, standard-test-time-of-day-fractions)
(standard-test-time-of-day-beginning-of-day)
(standard-test-time-of-day-utc)
(standard-test-time-of-day-zone)
(standard-test-date-and-time-of-day, standard-test-interval):
* test/lisp/calendar/parse-time-tests.el (parse-time-tests):
* test/src/timefns-tests.el (format-time-string-with-zone)
(encode-time-dst-numeric-zone):
Revert recent changes that added a SUBSECS member to
calendrical timestamps, since that component is no longer
present (the info, if any, is now in the SECONDS member).
* lisp/calendar/time-date.el (decoded-time-add)
(decoded-time--alter-second):
Support fractional seconds in the new form. Simplify.
* src/timefns.c (Fdecode_time): Support new arg FORM.
(Fencode_time): Support subsecond resolution.
* test/src/timefns-tests.el (format-time-string-with-zone)
(decode-then-encode-time): Test subsecond calendrical timestamps.
Paul Eggert [Sat, 17 Aug 2019 01:08:23 +0000 (18:08 -0700)]
Subtracting “now” from “now” should yield zero
* src/timefns.c (time_arith): Arrange for (time-subtract nil
nil) to yield 0, to be consistent with (time-equal-p nil nil).
* test/lisp/calendar/time-date-tests.el (test-time-since): New test.
Paul Eggert [Fri, 16 Aug 2019 23:25:02 +0000 (16:25 -0700)]
Fix time-add rounding bug
Without this fix, time arithmetic yielded results that were not
mathematically accurate, even though the exact results were
representable; for example, (time-add 0 1e-13) yielded a timestamp
equal to 0 instead of to 1e-13.
* lisp/timezone.el (timezone-time-from-absolute):
Let time-add do its thing rather than using floating point
internally, which has rounding errors. We now have bignums and so
don’t need floating point to avoid overflow issues.
* src/timefns.c (timeform_sub_ps_p): New function.
(time_arith): If either argument is a float, represent the
result exactly instead of discarding sub-ps info.
* test/lisp/timezone-tests.el (timezone-tests-time-from-absolute):
Don’t assume (HI LO US PS) timestamp format.
* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid):
Don’t assume that time-add discards sub-ns info.
* test/src/timefns-tests.el (time-rounding-tests):
Add regression test to detect time-add rounding bug.
Mention `next-multiframe-window' when talking about `other-window'
* doc/emacs/windows.texi (Other Window): Mention
the `next-multiframe-window' command here (which is otherwise not
documented in the manual) (bug#12431).
Alex Branham [Fri, 16 Aug 2019 21:00:31 +0000 (14:00 -0700)]
Make checkdoc check cl-lib function docstrings
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Remove calls to delete-region to avoid deleting final " (bug#26328).
* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring)
(checkdoc-defun-info): Include cl-defun, cl-defgeneric,
cl-defmethod.
(checkdoc-this-string-valid-engine): Add cl-lib supported
keywords.
(checkdoc-defun-info): Ensure function parameters are a
"flat" list (bug#37034).
Do not recreate full URL for proxied HTTPS requests (Bug#35969)
* lisp/url/url-http.el (url-http-create-request): Do not recreate
full URL for proxied HTTPS requests.
(url-https-proxy-after-change-function): Do not bind
url-http-proxy to nil before calling url-http-create-request.
(Bug#35969)
Reimplement the `fill-flowed' function to respect space stuffing
* lisp/mail/flow-fill.el (fill-flowed): Reimplement the function
to respect space-stuffing (bug#17190).
* test/lisp/mail/flow-fill-tests.el
(fill-flow-tests-fill-flowed-stuffed): New test.
(fill-flow-tests-fill-flowed-decode): Rename the test so that it
actually runs.
Alex Branham [Wed, 26 Jun 2019 18:59:06 +0000 (13:59 -0500)]
Fix eshell-mode-map initialization
* lisp/eshell/esh-mode.el (eshell-mode-map, eshell-command-map): Set
up normal keymaps and prefix commands rather than re-initializing them
in each eshell buffer
* lisp/eshell/em-cmpl.el (eshell-cmpl-mode-map, eshell-cmpl-mode)
(eshell-cmpl-initialize):
* lisp/eshell/em-hist.el (eshell-hist-mode-map, eshell-hist-mode)
(eshell-hist-initialize):
* lisp/eshell/em-pred.el (eshell-pred-mode-map, eshell-pred-mode)
(eshell-pred-initialize):
* lisp/eshell/em-prompt.el (eshell-prompt-mode-map, eshell-prompt-mode)
(eshell-prompt-initialize):
* lisp/eshell/em-rebind.el (eshell-rebind-mode-map, eshell-rebind-mode)
(eshell-rebind-initialize):
* lisp/eshell/esh-arg.el (eshell-arg-mode-map, eshell-arg-mode)
(eshell-arg-initialize):
* lisp/eshell/esh-proc.el (eshell-proc-mode-map, eshell-proc-mode)
(eshell-proc-initialize):
* lisp/eshell/esh-var.el (eshell-var-mode-map, eshell-var-mode)
(eshell-var-initialize): Create a new minor mode with a keymap and
call it in the module initialization function.
Paul Eggert [Thu, 15 Aug 2019 17:51:03 +0000 (10:51 -0700)]
Fix typeof portability issue with bitfields
Problem reported by Glenn Morris in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00300.html
* src/lisp.h (lisp_h_make_fixnum): Use typeof (+(n)) instead
of typeof (n), so that it works with compilers that do
not allow typeof to be applied to a bitfield.
Paul Eggert [Thu, 15 Aug 2019 17:40:11 +0000 (10:40 -0700)]
Fix rounding errors with float timestamps
When converting from float to (TICKS . HZ) form, do the
conversion exactly. When converting from (TICKS . HZ) form to
float, round to even precisely. This way, successfully
converting a float to (TICKS . HZ) and back yields a value
numerically equal to the original.
* src/timefns.c (flt_radix_power_size): New constant.
(flt_radix_power): New static var.
(decode_float_time): Convert the exact numeric value rather
than guessing TIMESPEC_HZ resolution.
(s_ns_to_double): Remove; no longer needed.
(frac_to_double): New function.
(decode_ticks_hz): It is now the caller’s responsibility to
pass a valid TICKS and HZ. All callers changed.
Use frac_to_double to round (TICKS . HZ) precisely.
(decode_time_components): When decoding nil, use
decode_ticks_hz since it rounds precisely.
(syms_of_timefns): Initialize flt_radix_power.
* test/src/timefns-tests.el (float-time-precision): New test.
Paul Eggert [Thu, 15 Aug 2019 09:18:06 +0000 (02:18 -0700)]
Debug out-of-range make_fixnum args
With --enable-checking, make_fixnum (N) now checks that N is
in fixnum range. Suggested by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00548.html
A new function make_ufixnum (N) is for the rare cases where N
is intended to be unsigned and is in the range 0..INTMASK.
* configure.ac (AC_C_TYPEOF): Add.
(HAVE_STATEMENT_EXPRESSIONS): Resurrect this macro.
* src/fns.c (Frandom, hashfn_eq, hashfn_equal, hashfn_user_defined):
* src/profiler.c (hashfn_profiler):
Use make_ufixnum rather than make_fixum, since the argument is
an unsigned integer in the range 0..INTMASK rather than a signed
integer in the range MOST_NEGATIVE_FIXNUM..MOST_POSITIVE_FIXNUM.
Typically this is for hashes.
* src/lisp.h (lisp_h_make_fixnum_wrap) [USE_LSB_TAG]:
Rename from lisp_h_make_fixnum.
(lisp_h_make_fixnum): Redefine in terms of lisp_h_make_fixnum_wrap.
Check for fixnum overflow on compilers like GCC that
have statement expressions and typeof.
(FIXNUM_OVERFLOW_P): Move up.
(make_fixnum): Check for fixnum overflow.
(make_ufixnum): New function, which checks that the arg
fits into 0..INTMASK range.
Paul Eggert [Thu, 15 Aug 2019 01:24:02 +0000 (18:24 -0700)]
Remove INT_ADD_WRAPV bug workarounds
* src/alloc.c (free_cons):
* src/casefiddle.c (do_casify_multibyte_string):
* src/editfns.c (styled_format):
* src/image.c (png_load_body):
Remove recent workarounds for INT_ADD_WRAPV bugs since
the bugs have been fixed (Bug#37006).
Don't alter function name face height in manoj-dark theme
* etc/themes/manoj-dark-theme.el (manoj-dark): Don't alter the
height of function name faces, because this makes many tabulated
modes not longer line up (bug#17042).
Eli Zaretskii [Wed, 14 Aug 2019 14:53:14 +0000 (17:53 +0300)]
Fix fetching URLs with stuff that looks like HTTP headers
* lisp/url/url-http.el (url-http-parse-headers): Narrow the
buffer to the headers at the beginning to make sure
url-handle-content-transfer-encoding uses the correct
headers. (Bug#37023)
Paul Eggert [Tue, 13 Aug 2019 19:20:40 +0000 (12:20 -0700)]
Let consing_until_gc exceed EMACS_INT_MAX
This builds on the previous patch.
* src/alloc.c (consing_until_gc): Now of type intmax_t,
since gc-cons-threshold can be up to INTMAX_MAX. All uses changed.
* src/lisp.h (CONSING_CT_MAX, consing_ct): Remove.
Paul Eggert [Tue, 13 Aug 2019 19:11:35 +0000 (12:11 -0700)]
Let consing_until_gc exceed INTPTR_MAX
Suggested by Eli Zaretskii (Bug#37006#46).
* src/alloc.c (consing_until_gc): Now of type consing_ct.
All uses changed, so gc-cons-threshold no longer saturates
against OBJECT_CT_MAX.
(object_ct): Move typedef here from lisp.h.
* src/lisp.h (consing_ct, CONSING_CT_MAX): New type and macro.
(OBJECT_CT_MAX): Remove. Replace all uses with CONSING_CT_MAX.
Paul Eggert [Tue, 13 Aug 2019 17:03:41 +0000 (10:03 -0700)]
Fix GC threshold typo
Problem reported by Eli Zaretskii (Bug#37006#25).
* src/alloc.c (garbage_collect_1): Fix typo in threshold calc.
Go back to dividing by 10 since the numerator’s a constant now.
Problem introduced in 2019-07-21T02:40:03Z!eggert@cs.ucla.edu.
Eli Zaretskii [Tue, 13 Aug 2019 14:49:51 +0000 (17:49 +0300)]
Fix initialization of user-defined fringe bitmaps in daemon mode
* src/fringe.c (gui_init_fringe): Rename from w32_init_fringe
or x_cr_init_fringe, and make unconditionally compiled; all
callers changed. Do nothing if the frame's
redisplay_interface doesn't implement the define_fringe_bitmap
method. Set up any user-defined fringe bitmaps in addition to
the standard bitmaps.
Suggested by Liam Quinlan <liamkquinlan@gmail.com> in
https://lists.gnu.org/archive/html/emacs-devel/2019-08/msg00259.html.
(w32_reset_fringes) [HAVE_NTGUI]: Do nothing if the frame's
redisplay_interface doesn't implement the
destroy_fringe_bitmap method.
* src/w32fns.c (Fx_create_frame): Call gui_init_fringe when
the first GUI frame is created for this session.
* src/dispextern.h (w32_init_fringe): Rename to
gui_init_fringe and make unconditional.
(x_cr_init_fringe): Remove prototype.
Paul Eggert [Sun, 11 Aug 2019 23:42:38 +0000 (16:42 -0700)]
Prefer signed when testing for signed overflow
* src/alloc.c (free_cons):
* src/casefiddle.c (do_casify_multibyte_string):
* src/editfns.c (styled_format):
* src/image.c (png_load_body):
Use signed arguments to INT_MULTIPLY_WRAPV etc. This doesn’t fix
any bugs, but GCC emits better code when all args are signed.
Also, this removes the need for an if in free_cons (Bug#37006).
Michael Albinus [Sun, 11 Aug 2019 10:06:57 +0000 (12:06 +0200)]
Retrieve start time from remote machine, use compat attrib functions
* lisp/net/tramp-compat.el (tramp-compat-file-attribute-access-time)
(tramp-compat-file-attribute-status-change-time): New defaliases.
* test/lisp/net/tramp-tests.el (tramp--test-start-time): New defvar.
(tramp--test-file-attributes-equal-p)
(tramp-test19-directory-files-and-attributes): Use it.
(tramp-test18-file-attributes)
(tramp--test-file-attributes-equal-p, tramp-test20-file-modes)
(tramp-test22-file-times, tramp--test-check-files):
Use `tramp-compat-file-attribute-*' functions.
Glenn Morris [Sat, 10 Aug 2019 15:44:31 +0000 (08:44 -0700)]
Merge from origin/emacs-26
0860ac0 (origin/emacs-26) Improve documentation of features that use ... fae1ff6 Fix docstrings in pong 82a2894 Improve doc strings of 'append-to-buffer' and friends cb0403d Fix octave-mode ElDoc support 691790b Avoid Groff hanging on MS-Windows when invoked by "M-x man"
Eli Zaretskii [Sat, 10 Aug 2019 09:48:03 +0000 (12:48 +0300)]
Improve documentation of features that use the fringes
* doc/emacs/display.texi (Fringes): Add cross-reference to
where indicate-empty-lines is described.
(Useless Whitespace): Add an @anchor for a more accurate
cross-reference in "Fringes".
Michael Albinus [Sat, 10 Aug 2019 09:34:13 +0000 (11:34 +0200)]
Use a time offset when comparing times of local and remote machines
* test/lisp/net/tramp-tests.el (tramp--test-file-attributes-equal-p):
Use a time offset in order to compensate different times on local
and remote machines.
Mauro Aranda [Wed, 7 Aug 2019 00:48:41 +0000 (21:48 -0300)]
Fix pong collision detection
* lisp/play/pong.el (pong-update-game): If the ball hit the bat where
bats are positioned, draw again the bat cell in the old ball
position. (Bug#20579).
Also, avoid changing the direction of the ball right after hitting the
bats, and improve the collision detection against the borders.
Alex Gramiak [Fri, 31 May 2019 20:30:31 +0000 (14:30 -0600)]
Set up defined_color_hook for the initial frame
* src/terminal.c (init_initial_terminal): Set up the
defined_color_hook. This avoids crashes when running
in batch mode with code that manipulates colors.
(Bug#36019)
Eli Zaretskii [Fri, 9 Aug 2019 13:51:14 +0000 (16:51 +0300)]
Fix highlighting in man pages displayed by "M-x man"
* lisp/man.el (Man-highlight-references0): Handle the case
when a section is divided between 2 or more chunks of text
received from the 'man' program. (Bug#36927)
Noah Friedman [Fri, 9 Aug 2019 06:17:56 +0000 (23:17 -0700)]
Provide better target window consistency across x window property functions.
Use the argument name WINDOW-ID instead of SOURCE for same.
Revise docstrings to clarify semantics of FRAME and WINDOW-ID.
(Fx_change_window_property): Use `target_window' instead of `w'.
This is consistent with other related functions.
Finalize its value before blocking input.
(Fx_window_property):
(Fx_window_property_attributes): Use `window_id' instead of `source'.
(Fx_delete_window_property): New optional arg window_id.
This provides symmetry with Fx_window_property, so that the window
need not be an actual emacs frame. This is useful for modifying
properties of parent windows (specified with --parent-id to emacs) or
generally assisting the window manager.
Mauro Aranda [Tue, 6 Aug 2019 15:45:28 +0000 (12:45 -0300)]
Fix octave-mode ElDoc support
* lisp/progmodes/octave.el (octave-eldoc-function-signatures): Fix the
regexp used, so no match happens when there is no defined function FN.
Also, tweak the regexp to support GNU Octave 4.2.x and newer. (Bug#36459)
Eli Zaretskii [Thu, 8 Aug 2019 13:17:51 +0000 (16:17 +0300)]
Avoid Groff hanging on MS-Windows when invoked by "M-x man"
* lisp/man.el (Man-build-man-command): On MS-Windows, redirect
stdin of 'man' to the null device, to make sure Groff exits
immediately after formatting the man page.
* lisp/progmodes/fortran.el (fortran-indent-to-column):
Suppress relint complaints about duplicated character in skip-set;
it's intentional and harmless.
When asking XTerm for the selection via OSC 52, use ST as string
terminator in the request to get ST as terminator in the reply,
because BEL is messy to receive in many ways.
* lisp/term/xterm.el (gui-backend-get-selection):
Use ST as string terminator in request and reply.
Use a time-out when reading the reply.