Paul Eggert [Wed, 27 Feb 2019 09:14:27 +0000 (01:14 -0800)]
DEFVAR_INT variables are now intmax_t
Formerly they were fixnums, which led to problems when dealing
with values that might not fit on 32-bit platforms, such as
string-chars-consed or floats_consed. 64-bit counters should
be good enough for these (for a while, anyway...).
While we’re at it, fix some unlikely integer overflow bugs
that have been in the code for a while.
* lib-src/make-docfile.c (write_globals):
* src/data.c (do_symval_forwarding, store_symval_forwarding):
* src/eval.c (restore_stack_limits, call_debugger):
* src/frame.h (struct frame.cost_calculation_baud_rate):
* src/keyboard.c (last_auto_save, bind_polling_period, read_char):
* src/lisp.h (struct Lisp_Intfwd.intvar):
* src/lread.c (defvar_int):
* src/pdumper.c (dump_fwd_int):
* src/thread.h (struct thread_state.m_lisp_eval_depth):
* src/undo.c (truncate_undo_list):
* src/xselect.c (wait_for_property_change)
(x_get_foreign_selection):
* src/xterm.c (x_emacs_to_x_modifiers):
DEFVAR_INT variables now have the C type intmax_t, not EMACS_INT.
* src/data.c (store_symval_forwarding):
* src/gnutls.c (Fgnutls_boot):
* src/keyboard.c (bind_polling_period):
* src/macros.c (pop_kbd_macro, Fexecute_kbd_macro):
* src/undo.c (truncate_undo_list):
Allow any integer that fits into intmax_t, instead of
requiring it to be a Lisp fixnum.
* src/dispnew.c (update_window):
* src/frame.c (x_figure_window_size):
* src/gnutls.c (init_gnutls_functions)
(emacs_gnutls_handle_error):
* src/keyboard.c (make_lisp_event):
* src/nsterm.m (ns_dumpglyphs_image):
* src/profiler.c (make_log):
* src/scroll.c (calculate_scrolling)
(calculate_direct_scrolling):
* src/termcap.c (tputs):
* src/xterm.c (x_draw_image_relief):
Avoid implementation-defined behavior on conversion of
out-of-range integers.
* src/eval.c (when_entered_debugger): Now intmax_t.
(max_ensure_room): New function, that avoids signed integer overflow.
(call_debugger, signal_or_quit): Use it.
* src/fileio.c (Fdo_auto_save):
* src/keyboard.c (make_lisp_event):
* src/term.c (calculate_costs):
* src/xdisp.c (build_desired_tool_bar_string)
(hscroll_window_tree, try_scrolling, decode_mode_spec)
(x_produce_glyphs):
Avoid signed integer overflow.
* src/lisp.h (clip_to_bounds): Generalize to intmax_t.
* src/pdumper.c (dump_emacs_reloc_immediate_emacs_int): Remove, ...
(dump_emacs_reloc_immediate_intmax_t): ... replacing with this
function. All uses changed.
* src/profiler.c (make_log): Omit args. All callers changed.
* src/termcap.c: Include stdlib.h, for atoi.
Include intprops.h.
* src/window.c (sanitize_next_screen_context_lines): New function.
(window_scroll_pixel_based, window_scroll_line_based):
Use it to avoid signed integer overflow.
Paul Eggert [Tue, 26 Feb 2019 01:44:46 +0000 (17:44 -0800)]
Fix mod-test build failure
Problem reported by Glenn Morris in:
https://lists.gnu.org/r/emacs-devel/2019-02/msg00739.html
* test/Makefile.in (HYBRID_MALLOC, LIBEGNU_ARCHIVE):
New macros, taken from ../src/Makefile.in.
(MODULE_CFLAGS): Add -I$(srcdir)/../lib.
($(test_module)): Link $(LIBEGNU_ARCHIVE) too.
Paul Eggert [Mon, 25 Feb 2019 19:33:51 +0000 (11:33 -0800)]
format-time-string: document new '+' flag
* doc/lispref/os.texi (Time Parsing), etc/NEWS:
* src/timefns.c (Fformat_time_string): Document the new
behavior, added for compatibility with POSIX.1-2017.
* lisp/net/tramp-cmds.el (tramp-cleanup-connection-hook)
(tramp-cleanup-all-connections-hook): New hook variables.
(tramp-cleanup-connection): Set `tramp-current-connection' always
to nil.
(tramp-cleanup-connection): Do not call `tramp-recentf-cleanup'.
Run ´tramp-cleanup-connection-hook`.
(tramp-cleanup-all-connections): Do not call
`tramp-archive-cleanup-hash' and ´tramp-recentf-cleanup'. Run
`tramp-cleanup-all-connections-hook'.
pending_signals is often set if no quit is pending. This results in
bugs in module code if the module returns but no quit is actually
pending.
As a better alternative, add a new process_input environment function
for Emacs 27. That function processes signals (like maybe_quit).
* configure.ac: Add module snippet for Emacs 27.
* src/module-env-27.h: New file.
* src/emacs-module.h.in: Add process_input function to environment
interface.
* src/emacs-module.c (module_should_quit): Use QUITP macro to check
whether the caller should quit.
(module_process_input): New function.
(initialize_environment): Use it.
* src/eval.c: Remove obsolete comment.
* test/data/emacs-module/mod-test.c (signal_wrong_type_argument)
(signal_errno): New helper functions.
(Fmod_test_sleep_until): New test module function.
* test/src/emacs-module-tests.el (mod-test-sleep-until): New unit
test.
Stefan Monnier [Sun, 24 Feb 2019 21:19:59 +0000 (16:19 -0500)]
* lisp/term.el: Fix minor compilation issues with cl-lib and lexbind
Remove left-over comment from the bulk comint->term query/replace.
(term-command-function): Rename from term-command-hook.
Give it a global default value.
(term-suppress-hard-newline): Mark it as generally obsolete.
(term-mode): Don't manually make hooks buffer-local.
(term--remove-fake-newlines): Fix assert -> cl-assert.
(term-char-mode): Use add-function.
(term-send-input): Use run-hook-with-args.
(term-dynamic-complete): Use run-hook-with-args-until-success.
(term-dynamic-simple-complete): Completion tables can be plain lists.
(serial-read-name): Simplify and fix misuse of `set`.
John Shahid [Mon, 21 Jan 2019 00:08:17 +0000 (19:08 -0500)]
Adjust line wrapping on window resize and killing text
* lisp/term.el (term-mode): Advice filter-buffer-substring-function to
remove line unwrapping from killed text.
(term-reset-size): Add or remove line unwrapping depending on the new
terminal width.
(term-suppress-hard-newline): Mark obsolete.
(term-unwrap-line): Use text properties to be able to find the
newlines later.
Eric Abrahamsen [Wed, 30 Jan 2019 20:31:49 +0000 (12:31 -0800)]
Make pinyin to Chinese character mapping available to elisp
* leim/Makefile.in: Build the file pinyin.el from pinyin.map.
* lisp/international/titdic-cnv.el (pinyin-convert): New function that
writes the library pinyin.el, containing a new constant
`pinyin-character-map'.
* .gitignore: Ignore the generated pinyin.el file.
Richard Stallman [Sun, 24 Feb 2019 18:45:34 +0000 (10:45 -0800)]
fix rmail armor decryption problems
* lisp/mail/rmail.el (rmail-epa-decrypt): Don't decrypt an armor
that was copied into the message from a message it is a reply to.
(rmail-epa-decrypt-1): Catch and ignore errors in
epa-decrypt-region. Make armor-start and armor-end markers.
Paul Eggert [Sat, 23 Feb 2019 21:47:52 +0000 (13:47 -0800)]
Don’t assume timersub and gettimeofday
POSIX does not specify timersub, and marks gettimeofday as
obsolescent. Avoid porting problems by using timespec.h
functions instead.
* src/editfns.c: Include systime.h instead of sys/time.h.
(EXTRA_CONTEXT_FIELDS): Replace start and max_secs with
time_limit. All uses changed. This removes the need to call
gettimeofday or timersub.
* src/term.c (timeval_to_Time): Remove. Replace all uses with ...
(current_Time): ... this new function, removing the need to
call gettimeofday.
* src/editfns.c (Freplace_buffer_contents): Add two optional arguments
for mitigating performance issues.
* lisp/emacs-lisp/subr-x.el (replace-region-contents): Move from
subr.el. Add the same two arguments as for replace-buffer-contents.
* lisp/json.el (json-pretty-print-max-secs): New variable holding the
default MAX-SECS value json-pretty-print passes to
replace-buffer-contents.
(json-pretty-print): Use it.
* doc/lispref/text.texi (Replacing): Add documentation for
replace-buffer-contents two new optional arguments. Document
replace-region-contents.
Stefan Monnier [Thu, 21 Feb 2019 17:09:03 +0000 (12:09 -0500)]
* lisp/vc/diff-mode.el: Reduce redundancy in diff-syntax-fontify code
(diff--iterate-hunks): New function extracted from diff--font-lock-refined.
(diff--font-lock-refined, diff--font-lock-syntax): Use it.
(diff--overlay-auto-delete): Rename from diff--font-lock-refine--refresh.
(diff--font-lock-syntax--refresh): Delete.
(diff-syntax-fontify-hunk): Don't completely silence errors.
(diff-syntax-fontify-props): Remove `no-init` arg, testing if `file` is
nil instead. Adjust all callers.
(diff-syntax-fontify-props): Remove redundant code since we don't
modify the buffer.
Correct implementation of `sql-set-product-feature' (Bug#30494).
* lisp.progmodes/sql.el (sql-add-product): Correct argument spec.
(sql-set-product-feature): Handle all cases as intended.
(sql-get-product-feature): Fetch varaiable value by `eval'.
* test/lisp/progmodes/sql-tests.el (sql-test-feature-value-[a-d]):
New test variables.
(sql-test-product-feature-harness): New test macro.
(sql-test-add-product, sql-test-add-existing-product)
(sql-test-set-feature, sql-test-set-indirect-feature)
(sql-test-set-existing-feature)
(sql-test-set-existing-indirect-feature)
(sql-test-set-missing-product, sql-test-get-feature)
(sql-test-get-indirect-feature, sql-test-get-missing-product)
(sql-test-get-missing-feature)
(sql-test-get-missing-indirect-feature): New ERT tests
Glenn Morris [Wed, 20 Feb 2019 06:04:19 +0000 (22:04 -0800)]
Remove .art from the default list of ImageMagick extensions
It seems that .art files can be non-image files that
ImageMagick mistakenly treats as extremely large images.
Real .art images seem rare.
* lisp/image.el (imagemagick-enabled-types): Remove ART. (Bug#22289)
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
Simplify a one-argument call to "or" and use buffer-narrowed-p instead
of checking that condition by hand.
João Távora [Mon, 18 Feb 2019 20:32:38 +0000 (20:32 +0000)]
switch-to-buffer's completion table uses its own sorting
* src/minibuf.c (Finternal_complete_buffer): Add
Qcycle_sort_function to completion table's metadata.
(syms_of_minibuf): New symbol Qcycle_sort_function.
* lisp/progmodes/sql.el: Added password wallet using
`auth-source' package.
(sql-auth-source-search-wallet): New function.
(sql-password-wallet): New variable.
(sql-password-search-wallet-function): New variable.
(sql-get-login): Handle password wallet search.
(sql-product-interactive): Handle password function.
* test/lisp/progmodes/sql-test.el: Test wallet changes.
(sql-test-login-params): New test variable.
(with-sql-test-connect-harness): New macro to wrap test
configuration around calls to `sql-connect'.
(sql-test-connect, sql-test-connect-password-func)
(sql-test-connect-wallet-server-database)
(sql-test-connect-wallet-database)
(sql-test-connect-wallet-server): New ERT tests.
* etc/NEWS: Updated SQL Mode descriptions.
(sql-statement-regexp): if 'ansi' dialect is not defined, use "select"
(sql-interactive-mode): establish process sentinel iff there is a
process. Default values for :prompt-regexp and :prompt-length.
(sql-product-interactive): only check process status iff there is a
process.
Paul Eggert [Mon, 18 Feb 2019 22:42:45 +0000 (14:42 -0800)]
Minor profiler improvements
* src/profiler.c (evict_lower_half, record_backtrace)
(setup_cpu_timer, cmpfn_profiler, hashfn_profiler):
Assume C99. Use bool for boolean.
(timer_getoverrun): Remove; simplify use to not need it.
(Fprofiler_cpu_start): Any negative return from setup_cpu_timer fails.
(Fprofiler_cpu_stop): Simplify initialization.
Stefan Monnier [Mon, 18 Feb 2019 14:43:59 +0000 (09:43 -0500)]
* lisp/vc/smerge-mode.el (smerge-change-buffer-confirm): New var
(smerge-vc-next-conflict): Obey it. Save buffer before going to
the next. Don't emit message when vc-find-conflicted-file can't find
other conflicted file.
Paul Eggert [Mon, 18 Feb 2019 07:17:12 +0000 (23:17 -0800)]
emacs-init-time outputs more digits now
* lisp/time.el (emacs-init-time): Output more digits;
formerly this was always outputting "0.0 seconds" for me
because the number of seconds was less than 0.1.
Alan Mackenzie [Sun, 17 Feb 2019 18:57:10 +0000 (18:57 +0000)]
Fontify C function identifiers in parentheses correctly (e.g. in lisp.h)
Fix handling of CC Mode's syntactic WS cache. Make noise-macro option
variables buffer local.
* lisp/progmodes/cc-engine.el (c-put-is-sws, c-put-in-sws, c-remove-is-sws)
(c-remove-in-sws c-remove-is-and-in-sws): Add edebug specs.
(c-invalidate-sws-region-before): Add a `beg' parameter. Handle noise
macros like other literals.
(c-invalidate-sws-region-after-del): Move the adjustment of (cdr
c-sws-lit-limits) due to buffer change to c-invalidate-sws-region-after.
(c-invalidate-sws-region-after-ins): Move (goto-char end) to the correct
place.
(c-invalidate-sws-region-after): Adjust (cdr c-sws-lit-limits) due to buffer
change. Handle noise macros.
(c-backward-sws): Set simple-ws-beg appropriately when the start point is in
the middle of a noise macro.
(c-forward-decl-or-cast-1): Recognize a function identifier being declared in
parentheses.
* lisp/promodes/cc-mode.el (c-before-change): Supply a `beg' argument to
c-invalidate-sws-region-before.
* lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re)
(c-noise-macro-name-re, c-noise-macro-names, c-noise-macro-with-parens-names):
Make these buffer local variables.
Prevent over-eager rx character range condensation
`rx' incorrectly considers character ranges between ASCII and raw bytes to
cover all codes in-between, which includes all non-ASCII Unicode chars.
This causes (any "\000-\377" ?Å) to be simplified to (any "\000-\377"),
which is not at all the same thing: [\000-\377] really means
[\000-\177\200-\377] (Bug#34492).
* lisp/emacs-lisp/rx.el (rx-any-condense-range): Split ranges going
from ASCII to raw bytes.
* test/lisp/emacs-lisp/rx-tests.el (rx-char-any-raw-byte): Add test case.
* etc/NEWS: Mention the overall change (Bug#33205).
Eli Zaretskii [Sat, 16 Feb 2019 09:51:25 +0000 (11:51 +0200)]
Fix handling of manpage references divided by hyphenation
* lisp/man.el (Man-reference-regexp): Accept a newline as part
of a manpage name only if it's preceded by a hyphen. (Bug#34286)
(Man-translate-references): Adapt to change in
'Man-reference-regexp'.
(Man-default-man-entry): Support references divided between
two lines by an ASCII hyphen. This is a left-over from fixing
bug#6289.
Eli Zaretskii [Sat, 16 Feb 2019 07:15:40 +0000 (09:15 +0200)]
Fix 'early-init-file' value when file is missing
* lisp/startup.el (command-line): Pass 'early-init.el', with
an explicit .el extension, to load-user-init-file.
Reported by Radon Rosborough <radon.neon@gmail.com> in
http://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00314.html.
(compilation-shell-minor-mode, compilation-minor-mode): Use :lighter
rather than the old positional args.
(compilation-next-error): Make "No error here" into a user-error.
Eli Zaretskii [Fri, 15 Feb 2019 13:45:23 +0000 (15:45 +0200)]
Make ls-lisp.el behave like Posix hosts when directory doesn't exist
* lisp/ls-lisp.el (ls-lisp-insert-directory): For a directory
that cannot be accessed, signal an error, like insert-directory
does on Posix systems. This causes files-tests.el to pass on
MS-Windows.
Avoid errors in erc-dcc.el when erc-dcc-verbose is non-nil
* lisp/erc/erc-dcc.el (erc-dcc-get-filter): Don't assume STR
is always a string. Use 'buffer-name' to get the DCC file
name, as buffer-file-name is not set in the process buffer.