1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-18 10:16:51 +00:00
Commit Graph

134002 Commits

Author SHA1 Message Date
Paul Eggert
77fc272598 Fix glitches introduced by nthcdr changes
* src/fns.c (Fnthcdr): Fix recently-introduced bug when
nthcdr is supposed to yield a non-nil non-cons.
Reported by Glenn Morris and by Pip Cet here:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00699.html
https://lists.gnu.org/r/emacs-devel/2018-08/msg00708.html
Speed up nthcdr for small N, as suggested by Pip Cet here:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00707.html
* test/src/fns-tests.el (test-nthcdr-simple): New test.
2018-08-21 02:05:31 -07:00
Paul Eggert
eb83344fc7 Speed up (nthcdr N L) when L is circular
Also, fix bug when N is a positive bignum, a problem reported
by Eli Zaretskii and Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00690.html
* src/fns.c (Fnthcdr): If a cycle is found, reduce the count
modulo the cycle length before continuing.  This reduces the
worst-case cost of (nthcdr N L) from N to min(N, C) where C is
the number of distinct cdrs of L.  Reducing modulo the cycle
length also allows us to do arithmetic with machine words
instead of with GMP.
* test/src/fns-tests.el (test-nthcdr-circular): New test.
2018-08-20 16:01:31 -07:00
Andy Moreton
36de7bd7b0 Define get_proc_addr in Cygwin-w32 build
* src/w32common.h (get_proc_addr, DEF_DLL_FN, LOAD_DLL_FN): Move
definitions here from src/w32.h.
* src/decompress.c [WINDOWSNT]:
* src/gnutls.c [WINDOWSNT]:
* src/image.c [WINDOWSNT]:
* src/json.c [WINDOWSNT]:
* src/lcms.c [WINDOWSNT]:
* src/w32font.c [WINDOWSNT]:
* src/w32uniscribe.c:
* src/xml.c [WINDOWSNT]: Include w32common.h.
2018-08-20 17:04:24 -04:00
Paul Eggert
21397837ea nthcdr now works with bignums
Problem reported by Karl Fogel in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00671.html
* src/fns.c (Fnthcdr): Support bignum counts.
2018-08-20 10:24:42 -07:00
Paul Eggert
ecd7a94077 Fix expt signedness bug --without-wide-int
Problem reported by Federico in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00619.html
* src/floatfns.c (Fexpt): Use TYPE_RANGED_FIXNUMP, not
RANGED_FIXNUMP, to fix bug with unsigned comparison on
platforms built --without-wide-int.
2018-08-19 10:06:12 -07:00
Stefan Monnier
5c3dba24ef * lisp/progmodes/cc-mode.el: Add version header 2018-08-19 08:47:02 -04:00
Paul Eggert
47b7a5bd49 Add bignum support to expt
Problem and initial solution reported by Andy Moreton in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00503.html
* doc/lispref/numbers.texi (Math Functions): expt integer
overflow no longer causes truncation; it now signals an error
since bignum overflow is a big deal.
* src/floatfns.c (Fexpt): Support bignum arguments.
* test/src/floatfns-tests.el (bignum-expt): New test.
2018-08-19 01:22:25 -07:00
Paul Eggert
06b5bcd639 Fix bug with ‘mod’ and float+bignum
Problem reported by Andy Moreton in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00442.html
* src/floatfns.c (fmod_float): Work even if an arg is a bignum.
* test/src/floatfns-tests.el (bignum-mod): New test.
2018-08-18 23:29:16 -07:00
Paul Eggert
351859238d Update from Gnulib
This incorporates:
2018-08-18 Avoid -Wcast-function-type warnings from casts
* build-aux/config.sub, lib/gettimeofday.c: Copy from Gnulib.
2018-08-18 23:14:31 -07:00
Paul Eggert
7ea369e5f2 Tweak integer division
* src/data.c (arith_driver): Reorder to remove unnecessary
FIXNUMP.  Tighten test for whether to convert the divisor from
fixnum to mpz_t.  Simplify.
2018-08-18 23:07:00 -07:00
Paul Eggert
a1b79567a8 Simplify float_arith_driver
* src/data.c (float_arith_driver): Simplify, as we needn’t
worry about that 30-year-old compiler bug any more.
2018-08-18 20:47:40 -07:00
Paul Eggert
b1840206ff Minor fixups for intmax_t→mpz_t conversion
* src/alloc.c (mpz_set_intmax_slow): Tighten assertion.
Work even in the unlikely case where libgmp uses nails.
* src/data.c (FIXNUMS_FIT_IN_LONG): New constant.
(arith_driver): Use it to tighten compile-time checks.
* src/lisp.h (mpz_set_intmax): Do not assume that converting
an out-of-range value to ‘long’ is harmless, as it might raise
a signal.  Use simpler expression; compiler can optimize.
2018-08-18 20:41:09 -07:00
Paul Eggert
6eade1efde Improve --with-wide-int mpz_t→fixnum conversion
These tuneups and minor simplifications should affect only
platforms with EMACS_INT wider than ‘long’.
* src/alloc.c (make_number): If the number fits in long but
not in fixnum, do not attempt to convert to fixnum again.
Tighten the compile-time check for whether the second attempt
is worth trying, from sizeof (long) < sizeof (EMACS_INT) to
LONG_WIDTH < FIXNUM_BITS.  Do not bother computing the sign of
the value to tighten the bounds for whether to try the second
attempt, as it’s not worth the effort.  Do not call mpz_size,
which is unnecessary since the number of bits is already known
and the loop can iterate over a shift count instead.  Avoid
unnecessary casts.  Use + instead of | where either will do,
as + is typically better for optimization.

Improve mpz_t to fixnum when --with-wide-int
* src/alloc.c (make_number): Avoid undefined behavior
when shifting an EMACS_UINT by more than EMACS_UINT_WIDTH bits.
Check for integer overflow when shifting.
2018-08-18 19:41:33 -07:00
Paul Eggert
1d2df2fd03 Improve bignum comparison (Bug#32463#50)
* src/data.c (isnan): Remove, as we can assume C99.
(bignumcompare): Remove, folding its functionality
into arithcompare.
(arithcompare): Compare bignums directly here.
Fix bugs when comparing NaNs to bignums.
When comparing a bignum to a fixnum, just look at the
bignum’s sign, as that’s all that is needed.
Decrease scope of locals when this is easy.
* test/src/data-tests.el (data-tests-bignum): Test bignum vs NaN.
2018-08-18 16:13:34 -07:00
Paul Eggert
97d273033b Document that ‘random’ is limited to fixnums
Problem reported by Pip Cet (Bug#32463#20).
* doc/lispref/numbers.texi (Random Numbers):
* src/fns.c (Frandom): Adjust doc.
2018-08-18 15:42:00 -07:00
Paul Eggert
673b1785db Restore traditional lsh behavior on fixnums
* doc/lispref/numbers.texi (Bitwise Operations): Document that
the traditional (lsh A B) behavior is for fixnums, and that it
is an error if A and B are both negative and A is a bignum.
See Bug#32463.
* lisp/subr.el (lsh): New function, moved here from src/data.c.
* src/data.c (ash_lsh_impl): Remove, moving body into Fash
since it’s the only caller now.
(Fash): Check for out-of-range counts.  If COUNT is zero,
return first argument instead of going through libgmp.  Omit
lsh code since lsh is now done in Lisp.  Add code for shifting
fixnums right, to avoid a round trip through libgmp.
(Flsh): Remove; moved to lisp/subr.el.
* test/lisp/international/ccl-tests.el (shift):
Test for traditional lsh behavior, instead of assuming
lsh is like ash when bignums are present.
* test/src/data-tests.el (data-tests-logand)
(data-tests-logior, data-tests-logxor, data-tests-ash-lsh):
New tests.
2018-08-18 15:22:35 -07:00
Eli Zaretskii
877cd22f55 Avoid compilation warning in w32fns.c
* src/w32fns.c (Fw32_read_registry): Avoid compiler warning
regarding possible use of 'rootkey' without initializing it
first.  Reported by Andy Moreton <andrewjmoreton@gmail.com>.
2018-08-18 09:24:38 +03:00
Paul Eggert
3300287236 Improve ‘abs’ performance
* src/floatfns.c (Fabs): Improve performance by not copying
the argument if it would eql the result.  As a minor detail,
don't assume fixnums are two’s complement.
2018-08-17 12:38:30 -07:00
Eli Zaretskii
9189afc1a8 Improve documentation of bignums
* etc/NEWS: Enhance the announcement of bignums.

* doc/lispref/numbers.texi (Integer Basics): Add a missing
period.  Reported by Basil L. Contovounesios <contovob@tcd.ie>.
2018-08-17 17:56:53 +03:00
Andy Moreton
cc5325b0be Pacify -Wcast-function-type warnings in GCC 8.1
* src/image.c: Move attributes into DEF_DLL_FN call.
* src/dynlib.c (dynlib_addr): Use get_proc_addr.
* src/w32.h: (get_proc_addr): New function.
(LOAD_DLL_FN): Use it.
(DEF_DLL_FN): Allow function attributes after argument
list.  Add function pointer type used by LOAD_DLL_FN.
* src/w32.c (open_process_token, get_token_information)
(lookup_account_sid, get_sid_sub_authority)
(get_sid_sub_authority_count, get_security_info)
(get_file_security, set_file_security)
(set_named_security_info)
(get_security_descriptor_owner, get_security_descriptor_group)
(get_security_descriptor_dacl, is_valid_sid, equal_sid)
(get_length_sid, copy_sid, get_native_system_info)
(get_system_times, create_symbolic_link)
(is_valid_security_descriptor, convert_sd_to_sddl)
(convert_sddl_to_sd, get_adapters_info, reg_open_key_ex_w)
(reg_query_value_ex_w, expand_environment_strings_w)
(init_environment, create_toolhelp32_snapshot)
(process32_first, process32_next, open_thread_token)
(impersonate_self, revert_to_self, get_process_memory_info)
(get_process_working_set_size, global_memory_status)
(global_memory_status_ex, init_winsock)
(maybe_load_unicows_dll, globals_of_w32): Use get_proc_addr.
* src/w32fns.c (setup_w32_kbdhook, Ffile_system_info)
(get_dll_version, w32_reset_stack_overflow_guard)
(w32_backtrace, globals_of_w32fns): Use get_proc_addr.
* src/w32font.c (get_outline_metrics_w, get_text_metrics_w)
(get_glyph_outline_w, get_char_width_32_w): Use get_proc_addr.
* src/w32heap.c (init_heap): Use get_proc_addr.
* src/w32menu.c (globals_of_w32menu): Use get_proc_addr.
* src/w32proc.c (init_timers, sys_kill, w32_compare_strings):
Use get_proc_addr.
* src/w32uniscribe.c (syms_of_w32uniscribe): Use get_proc_addr.
2018-08-17 17:29:10 +03:00
Allen Li
58e5f10f88 Don't include text properties when making autoloads
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads):
Ignore text properties when finding autoload defs.  Otherwise,
autoload generation is less deterministic, as the exact format of the
generated autoloads depends on whether the files are visited in
Emacs.  (Bug#32395)
2018-08-17 17:05:20 +03:00
Paul Eggert
64eb9b71da Fix problems with logxor etc. and fixnums
These operations incorrectly treated negative fixnums as
bignums greater than most-positive-fixnum.
* src/alloc.c (mpz_set_intmax_slow): Avoid undefined
behavior if signed unary negation overflows, while
we’re in the neighborhood.
(mpz_set_uintmax_slow): Remove.  All uses removed.
* src/data.c (arith_driver): Treat fixnums as signed, not
unsigned, even for logical operations.
* src/lisp.h (mpz_set_uintmax): Remove.  All uses removed.
* test/src/data-tests.el (data-tests-logand)
(data-tests-logior, data-tests-logxor): New tests.
2018-08-17 00:26:19 -07:00
Paul Eggert
3b9017b5ba Reject outlandishly-wide bignums
Do not allow bignums that are so wide that their log base 2
might not fit into a fixnum, as this will cause problems elsewhere.
We already have a similar limitation for bool-vectors.
* src/emacs.c (check_bignum_size, xmalloc_for_gmp): New function.
(xrealloc_for_gmp): Check for too-large bignum.
(main): Use xmalloc_for_gmp.
2018-08-16 20:45:08 -07:00
Paul Eggert
bb7e033891 Speed up logcount on bignums
* src/data.c (Flogcount): Speed up by using the mpz equivalent
of ~X instead of -X-1.
2018-08-16 19:54:30 -07:00
Michael Albinus
44ad4a15a0 Fix Bug#32454
* lisp/files.el (find-alternate-file): Handle the wildcards case.
(Bug#32454)
2018-08-16 17:26:37 +02:00
Ken Brown
5f39f203ee Pacify GCC with -Wunused-but-set-variable
* src/unexcw.c (read_exe_header):
(fixup_executable):
(unexec): Specify the "unused" attribute for variables that
are used only in assertions.
2018-08-16 09:06:46 -04:00
Thomas Fitzsimmons
decd983981 EUDC: Add more BBDB >= 3 support
* lisp/net/eudcb-bbdb.el Declare BBDB >= 3 functions.
(eudc-bbdb-field): Add translation from company to
organization.
(eudc-bbdb-extract-phones, eudc-bbdb-extract-addresses)
(eudc-bbdb-format-record-as-result): Call BBDB >= 3 functions.
2018-08-15 21:43:03 -04:00
Thomas Fitzsimmons
af991f15e6 EUDC: Remove XEmacs support
* lisp/net/eudc.el (eudc-mode, eudc-install-menu): Remove
XEmacs support.
* lisp/net/eudc-hotlist.el (eudc-hotlist-mode)
(eudc-hotlist-emacs-menu): Likewise.
* lisp/net/eudc-bob.el (eudc-bob-toggle-inline-display)
(eudc-bob-popup-menu, eudc-bob-generic-keymap)
(eudc-bob-sound-keymap, eudc-bob-url-keymap)
(eudc-bob-mail-keymap): Likewise.
* etc/NEWS (EUDC): Mention removal of XEmacs support.
2018-08-15 21:43:00 -04:00
Thomas Fitzsimmons
36d17ef44a EUDC: Shorten eudc-tools-menu autoload
* lisp/net/eudc.el: Remove XEmacs support from eudc-tools-menu
autoload.
2018-08-15 21:42:55 -04:00
Thomas Fitzsimmons
6b178acfd1 EUDC: Add commentary to eudc-bob.el
* lisp/net/eudc-bob.el: Add commentary.
2018-08-15 21:42:49 -04:00
Eli Zaretskii
bcdb2d9733 Improve documentation of last change
* lisp/hi-lock.el (hi-lock-set-pattern, hi-lock-face-buffer):
Improve the doc strings.  (Bug#32365)

* etc/NEWS:
* doc/emacs/display.texi (Highlight Interactively): Clarify
wording.
2018-08-15 05:37:45 +03:00
Grégory Mounié
cc5a23d40b Interactive Highlighting: prefix argument to select subexp
* doc/emacs/display.texi (Highlight Interactively):
* etc/NEWS: Document the change.
* lisp/hi-lock.el (hi-lock-face-buffer, hi-lock-set-pattern): Use
the prefix argument to highlight only the corresponding sub-expression
of the regexp (Bug#32365).

Copyright-paperwork-exempt: yes
2018-08-14 19:38:21 -04:00
Paul Eggert
1164d49ba6 Rename --without-mini-gmp to --with-libgmp
* configure.ac (HAVE_GMP): Rename ‘configure’ option from
--without-mini-gmp to --with-libgmp.  All uses changed.
* doc/lispref/numbers.texi (Predicates on Numbers): Large
integers are always available.  Clarify how eq works on them.
2018-08-14 16:06:59 -07:00
Stephen Berman
6d24402d63 Fix last todo-edit-mode change
* lisp/calendar/todo-mode.el (todo-edit-mode): For editing an item
instead of the whole file, the current todo-file must be set from
todo-global-current-todo-file.

* test/lisp/calendar/todo-mode-tests.el (todo-test-current-file-in-edit-mode):
New test.
2018-08-15 00:14:41 +02:00
Stephen Berman
5620d591ee ; * lisp/calendar/todo-mode.el: Remove leftover commented out lines. 2018-08-14 21:50:15 +02:00
Stephen Berman
a2ec595e5d Fix exiting from editing todo archive file (bug#32437)
* lisp/calendar/todo-mode.el (todo-edit-file): Make the warning
also suitable for Todo Archive mode, and add more space to it.
(todo-edit-quit): On quitting editing an archive file, return to
the Todo Archive mode buffer editing was invoked in.
(todo-check-format): Display a warning instead of a message when
the categories sexp isn't as expected.
(todo-mode-external-set): Remove.
(todo-edit-mode): Set buffer local values of
todo-current-todo-file and todo-categories from the todo or
archive file being edited.
(todo-categories-mode): Set buffer local values of
todo-current-todo-file and todo-categories as before but directly
instead of using superfluous todo-mode-external-set function.

* test/lisp/calendar/todo-mode-tests.el (todo-test-edit-quit): New test.
2018-08-14 21:39:24 +02:00
Paul Eggert
11c7c2f758 Remove more traces of misc (Bug#32405)
Remove misc-objects-consed and the misc component of
memory-use-count, since misc objects no longer exist.
* doc/lispref/internals.texi, etc/NEWS: Mention this,
and adjust better to recent removal of misc objects.
* src/alloc.c (MEM_TYPE_MISC): Remove; no longer used.
(Fmemory_use_counts): Omit misc count, since miscs
no longer exist.
(misc-objects-consed): Remove.
2018-08-14 12:08:03 -07:00
Glenn Morris
db6f511eb7 ; Merge from origin/emacs-26
The following commit was skipped:

f882de8 (origin/emacs-26) Port better to x86 -fexcess-precision=fast
2018-08-14 09:06:43 -07:00
Glenn Morris
2eabf4c13c Merge from origin/emacs-26
34e75c1 Add comment about floating point test
e73e683 Ibuffer: Add toggle ibuffer-do-toggle-lock
12f7116 Ibuffer: Detect correctly the buffers running a process
2018-08-14 09:06:43 -07:00
Glenn Morris
2e08ca25fd ; Merge from origin/emacs-26
The following commit was skipped:

1842297 Backport fix for Bug#32226
2018-08-14 09:06:43 -07:00
Glenn Morris
d113142a8b Merge from origin/emacs-26
614cc65 ; * lisp/simple.el (line-move-visual): Fix typo.
d2ad4ba Do not consider external packages to be removable (Bug#27822)
ec0995c * src/alloc.c: Remove obsolete comments.
ec6f588 Better support utf-8-with-signature and utf-8-hfs in HTML
eb026a8 Don't use -Wabi compiler option
2018-08-14 09:06:43 -07:00
Paul Eggert
396a33a365 Port recent changes to older GCC
Problem reported by Glenn Morris in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00446.html
* src/lisp.h (make_pointer_integer_unsafe):
Port to older GCC.
2018-08-14 04:39:05 -07:00
Paul Eggert
dc18a0917a Update doc strings for fixnum constants
* src/data.c (most-positive-fixnum, most-negative-fixnum):
Update doc strings in the light of fixnums.
2018-08-13 15:55:53 -07:00
Paul Eggert
76101698a7 Fix check for unsafe watch descriptor
* src/lisp.h (make_pointer_integer_unsafe): New function.
(make_pointer_integer): Use it.
* src/gfilenotify.c (dir_monitor_callback): Omit redundant eassert.
(Fgfile_add_watch): Signal an error instead of failing an
assertion if the pointer does not work.
2018-08-13 15:55:53 -07:00
Paul Eggert
f882de8b80 Port better to x86 -fexcess-precision=fast
Problem reported by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00380.html
* src/data.c (arithcompare): Work around incompatibility
between gcc -fexcess-precision=fast and the C standard on x86,
by capturing the results of floating-point comparisons before
the excess precision spontaneously decays.  Although this fix
might not work in general, it does work here and is probably
good enough for the platforms we care about.

(cherry picked from commit a84cef9095)
2018-08-13 20:16:56 +03:00
Paul Eggert
34e75c144e Add comment about floating point test
* test/src/data-tests.el (data-tests--float-greater-than-fixnums):
New constant.
(data-tests-=, data-tests-<, data-tests->, data-tests-<=)
(data-tests->=, data-tests-min): Use it.
2018-08-13 09:37:09 -07:00
Raimon Grau
eb787d749f Add uuid as allowed thingatpt symbol (Bug#32372)
* etc/NEWS: Mention changes in thingatpt.el.
* lisp/thingatpt.el (thing-at-point-uuid-regexp): Add regexp for uuid.
(top-level): Add 'bounds-of-thing-at-point' operation for 'uuid'.
* test/lisp/thingatpt-tests.el: Add tests for uuid at point.
2018-08-13 07:46:35 -04:00
Tino Calancha
e73e6838aa Ibuffer: Add toggle ibuffer-do-toggle-lock
Toggle the locked status in marked buffers or the buffer
at point (Bug#32421).
* lisp/ibuffer.el (ibuffer-do-toggle-lock): New command.
(ibuffer-mode-map): Bind it to 'L'.
(ibuffer-mode-operate-map): Add entries for
`ibuffer-do-toggle-read-only' and `ibuffer-do-toggle-lock'.
* etc/NEWS (Changes in Specialized Modes and Packages in Emacs 26.2):
Announce the change.
2018-08-13 19:24:31 +09:00
Tino Calancha
12f7116714 Ibuffer: Detect correctly the buffers running a process
* lisp/ibuffer.el (filename-and-process): Store the process buffer
as a text property; check for such property to detect a buffer
with a process (Bug#32420).
2018-08-13 19:22:49 +09:00
Paul Eggert
a1e0868f74 Pacify gcc -Og -Wuninitialized
This addresses the -Og uninitialized variable warnings I ran
into on Fedora 28, which uses 8.1.1 20180712 (Red Hat 8.1.1-5).
It also changes some explicit initializations to UNINIT
when the variable does not actually need to be initialized.
* src/process.c (connect_network_socket):
* src/sysdep.c (system_process_attributes):
* src/xfns.c (x_real_pos_and_offsets):
* src/xterm.c (get_current_wm_state) [USE_XCB]:
Add UNINIT.
* src/editfns.c (tzlookup):
* src/fns.c (Fnconc):
* src/font.c (font_parse_fcname):
* src/frame.c (x_set_frame_parameters):
Prefer UNINIT to explicit initialization.
2018-08-12 17:25:54 -07:00