]> git.eshelyaron.com Git - emacs.git/log
emacs.git
5 years agoFix last changes in src/ftfont.c
YAMAMOTO Mitsuharu [Sun, 5 May 2019 06:55:07 +0000 (15:55 +0900)]
Fix last changes in src/ftfont.c

* src/ftfont.c (ftfont_shape): Add missing argument direction.
(fthbfont_shape) [HAVE_HARFBUZZ]: Remove unused variable ftfont_info.
(fthbfont_driver) [HAVE_HARFBUZZ]: Remove redundant redeclaration.

5 years agoAdd new font backend drivers for text shaping by HarfBuzz
YAMAMOTO Mitsuharu [Sat, 4 May 2019 23:21:49 +0000 (08:21 +0900)]
Add new font backend drivers for text shaping by HarfBuzz

* etc/NEWS: Mention new font backend drivers xfthb and ftcrhb.

* src/font.h [HAVE_HARFBUZZ]: Include hb.h.
(struct font_driver) [HAVE_HARFBUZZ]: New members begin_hb_font and
end_hb_font.
(ftfont_match, ftfont_list): Remove externs.
(ftfont_match2, ftfont_list2):
(fthbfont_combining_capability, fthbfont_begin_hb_font)
(fthbfont_shape) [HAVE_HARFBUZZ]:
(xfthbfont_driver) [HAVE_XFT && HAVE_HARFBUZZ]:
(ftcrhbfont_driver) [USE_CAIRO && HAVE_HARFBUZZ]: Add externs.

* src/ftcrfont.c (ftcrfont_list): Use ftfont_list2.
(ftcrfont_match): Use ftfont_match2.
(ftcrfont_open): Get font type from entity.
(ftcrfont_open) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified.
(ftcrfont_shape) [HAVE_HARFBUZZ]: Make shaping fail.
(ftcrhbfont_list, ftcrhbfont_match)
(ftcrhbfont_begin_hb_font) [HAVE_HARFBUZZ]: New functions.
(ftcrhbfont_driver) [HAVE_HARFBUZZ]: New variable.
(syms_of_ftcrfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register it.
(syms_of_ftcrfont) [HAVE_HARFBUZZ]: New symbol Qftcrhb.

* src/ftfont.c: Include math.h for lround.
(fthbfont_driver) [HAVE_HARFBUZZ]: New variable.
(ftfont_get_hb_font) [HAVE_HARFBUZZ]: Remove function.
(ftfont_list, ftfont_match): Make static.
(ftfont_list2, ftfont_match2): New functions.
(ftfont_open2) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified.
(ftfont_open): Get font type from entity.
(ftfont_shape, ftfont_combining_capability, ftfont_driver) [HAVE_HARFBUZZ]:
Move HarfBuzz specific part from here ...
(fthbfont_shape, fthbfont_combining_capability)
(fthbfont_driver) [HAVE_HARFBUZZ]: ... to here.   New functions and variable.
(fthbfont_begin_hb_font) [HAVE_HARFBUZZ]: New function.
(fthbfont_shape_by_hb) [HAVE_HARFBUZZ]: Rename from ftfont_shape_by_hb.
Don't take FreeType specific arguments ft_face and matrix.  Use begin_hb_font
and end_hb_font font driver functions.  Use text_extents font driver functions
instead of ftfont_glyph_metrics.
(syms_of_ftfont) [HAVE_HARFBUZZ]: New symbol Qfreetypehb.
(syms_of_ftfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register
fthbfont_drivert.

* src/ftxfont.c (ftxfont_list): Use ftfont_list2.
(ftxfont_match): Use ftfont_match2.
(ftxfont_driver) [HAVE_HARFBUZZ]: Don't initialize shape member explicitly.

* src/xfns.c (Fx_create_frame) [USE_CAIRO && HAVE_HARFBUZZ]:
(Fx_create_frame) [HAVE_XFT && HAVE_HARFBUZZ]: Register HarfBuzz versions of
font drivers.

* src/xftfont.c (xftfont_list): Use ftfont_list2.
(xftfont_match): Use ftfont_match2.
(xftfont_open): Get font type from entity.
(xftfont_open) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified.
(xftfont_shape) [HAVE_HARFBUZZ]: Make shaping fail.
(xfthbfont_list, xfthbfont_match, xfthbfont_begin_hb_font)
(xfthbfont_end_hb_font) [HAVE_HARFBUZZ]: New functions.
(xftfont_driver) [HAVE_HARFBUZZ]: Don't initialize shape member explicitly.
(xfthbfont_driver) [HAVE_HARFBUZZ]: New variable.
(syms_of_xftfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register it.
(syms_of_xftfont) [HAVE_HARFBUZZ]: New symbol Qxfthb.

5 years agoFix NS build
YAMAMOTO Mitsuharu [Thu, 2 May 2019 00:33:01 +0000 (09:33 +0900)]
Fix NS build

* src/macfont.m: Fix prototype of macfont_shape.
(mac_font_shape): Fix type of 5th argument.

5 years agoMerge branch 'master' into harfbuzz
YAMAMOTO Mitsuharu [Sat, 27 Apr 2019 09:33:39 +0000 (18:33 +0900)]
Merge branch 'master' into harfbuzz

5 years agoFix -nw sessions on MS-Windows broken by a recent commit
Eli Zaretskii [Sat, 27 Apr 2019 08:34:05 +0000 (11:34 +0300)]
Fix -nw sessions on MS-Windows broken by a recent commit

* src/w32console.c: Include dispextern.h.
(initialize_w32_display): Populate defined_color_hook.

5 years agoFix MS-Windows build broken by a recent commit
Eli Zaretskii [Sat, 27 Apr 2019 07:43:05 +0000 (10:43 +0300)]
Fix MS-Windows build broken by a recent commit

* src/w32term.c (w32_new_focus_frame): Fix a typo in a recent
commit.

5 years agoFix --with-x-toolkit=no build breakage
YAMAMOTO Mitsuharu [Sat, 27 Apr 2019 06:27:36 +0000 (15:27 +0900)]
Fix --with-x-toolkit=no build breakage

* oldXMenu/Create.c (XMenuCreate): Add const modifier to variable def_val.
* oldXMenu/Create.c:
* src/frame.h: Add const modifier to return type of x_get_resource_string.
* src/frame.c (x_get_resource_string): Exempt x_get_string_resource from
renaming generic x_* identifiers.

5 years agoUpdate multicolor font support status
YAMAMOTO Mitsuharu [Sat, 27 Apr 2019 05:43:19 +0000 (14:43 +0900)]
Update multicolor font support status

* etc/NEWS: Mention multicolor font support on Cairo and NS.
* src/macfont.m (macfont_list): Re-enable color bitmap fonts.

5 years ago* src/frame.c (x_get_resource_string): Fix typo
Alexander Gramiak [Sat, 27 Apr 2019 03:49:52 +0000 (21:49 -0600)]
* src/frame.c (x_get_resource_string): Fix typo

5 years ago* src/xdisp.c: Only check FRAME_RIF for graphical frames
Alexander Gramiak [Sat, 27 Apr 2019 03:32:06 +0000 (21:32 -0600)]
* src/xdisp.c: Only check FRAME_RIF for graphical frames

5 years agoRename x_highlight_frame property to highlight_frame
Alexander Gramiak [Wed, 17 Apr 2019 13:39:25 +0000 (07:39 -0600)]
Rename x_highlight_frame property to highlight_frame

* src/nsterm.h:
* src/nsterm.m:
* src/w32term.c:
* src/w32term.h:
* src/xdisp.c:
* src/xterm.c:
* src/xterm.h: Rename.

5 years agoCheck for existence of terminal hooks before use
Alexander Gramiak [Mon, 15 Apr 2019 17:33:19 +0000 (11:33 -0600)]
Check for existence of terminal hooks before use

This should not be necessary, and is merely a precaution. For
background, see:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00639.html

* src/frame.c:
* src/xdisp.c: Check for existence of terminal hooks before use.

5 years agoAdd terminal hook query_frame_background_color
Alexander Gramiak [Sun, 14 Apr 2019 02:41:31 +0000 (20:41 -0600)]
Add terminal hook query_frame_background_color

* src/termhooks.c (query_frame_background_color): New terminal hook.

* src/image.c (image_query_frame_background_color): Remove. Use the
terminal hook instead.

* src/nsterm.m:
* src/w32term.c:
* src/xterm.c: Implement and set the new terminal hook.

5 years agoAdd terminal hook defined_color_hook
Alexander Gramiak [Sat, 13 Apr 2019 14:59:07 +0000 (08:59 -0600)]
Add terminal hook defined_color_hook

* src/termhooks.h (defined_color_hook): New terminal hook.

* src/xterm.c:
* src/nsterm.m:
* src/term.c:
* src/w32term.c: Set defined_color_hook.

* src/xfaces.c: Use defined_color_hook.
(defined_color): Remove.

* src/image.c: Remove redefinitions of x_defined_color, and use
defined_color_hook.

5 years agoRename generic x_* identifiers
Alexander Gramiak [Sat, 13 Apr 2019 15:40:03 +0000 (09:40 -0600)]
Rename generic x_* identifiers

* src/image.c: Rename x_* procedures to image_*.

* src/frame.c: Rename x_* procedures to gui_*. Rename
xrdb_get_resource to gui_display_get_resource. Rename x_get_arg to
gui_display_get arg.

* src/frame.h: Rename can_x_set_window_size to can_set_window_size.

* src/xfaces.c: Rename realize_x_face to realize_gui_face. Rename
x_supports_face_attributes_p to gui_supports_face_attributes_p.

* src/keyboard.c:
* src/lisp.h:
* src/nsterm.m:
* src/w32term.c:
* src/xterm.c: Rename x_get_keysym_name to get_keysym_name.

* src/nsfns.c:
* src/nsterm.m: Rename x_* procedures to ns_*.

* src/w32fns.c:
* src/w32term.c: Rename x_* procedures to w32_*.

* src/termhooks.h (query_colors, get_focus_frame, focus_frame_hook)
(frame_visible_invisible_hook, iconify_frame_hook)
(set_window_size_hook, set_frame_offset_hook, set_frame_alpha_hook)
(set_new_font_hook, set_bitmap_icon_hook, implicit_set_name_hook)
(activate_menubar_hook, change_tool_bar_height_hook)
(set_scroll_bar_default_width_hook)
(set_scroll_bar_default_height_hook, get_string_resource_hook): New
terminal hooks to replace backend-specific x_* procedures.

* src/dispextern.h (clear_under_internal_border): New RIF procedure.

* src/alloc.c:
* src/frame.c:
* src/xdisp.c: Use FRAME_OUTPUT_DATA instead of FRAME_X_OUTPUT.

* src/frame.c:
* src/w32term.c:
* src/w32fns.c: Use FRAME_NATIVE_WINDOW instead of FRAME_X_WINDOW.

5 years agoAdd prefixes to some window system-dependent procedures
Alexander Gramiak [Thu, 11 Apr 2019 15:00:58 +0000 (09:00 -0600)]
Add prefixes to some window system-dependent procedures

* src/nsterm.m (note_mouse_movement):
* src/w32fns.c (construct_console_modifiers):
* src/w32inevt.c:
* src/w32term.c (frame_highlight, frame_unhighlight)
(construct_mouse_click, construct_mouse_wheel, construct_drag_n_drop)
(lispy_file_action, queue_notifications, note_mouse_movement):
* src/w32term.h:
* src/xterm.c (frame_highlight, frame_unhighlight)
(construct_mouse_click, note_mouse_movement, get_current_wm_state):
Add and use window system prefixes.

5 years agoRename generic x_* procedures in xdisp.c
Alexander Gramiak [Sat, 23 Mar 2019 17:19:40 +0000 (11:19 -0600)]
Rename generic x_* procedures in xdisp.c

* src/xdisp.c (x_consider_frame_title, x_get_glyph_overhangs)
(x_produce_glyphs, x_write_glyphs, x_insert_glyphs)
(x_clear_end_of_line), x_fix_overlapping_area)
(x_update_cursor, x_clear_cursor, x_clear_window_mouse_face)
(x_draw_vertical_border, x_draw_right_divider, x_draw_bottom_divider)
(x_intersect_rectangles): Rename with a gui prefix to indicate
non-X-specific functionality.

* src/composite.c:
* src/dispextern.h:
* src/nsfns.m:
* src/nsterm.m:
* src/w32fns.c:
* src/w32term.c:
* src/window.c:
* src/xfns.c:
* src/xterm.c: Use the renamed procedures.

5 years agoAvoid assertion violations in calculating line-number width
Eli Zaretskii [Fri, 26 Apr 2019 19:40:54 +0000 (22:40 +0300)]
Avoid assertion violations in calculating line-number width

* src/indent.c (line_number_display_width): Don't use the
window's start marker if it belongs to a different buffer.
(Bug#35429)

5 years ago* lib-src/profile.c: Delete long-obsolete file
Stefan Monnier [Fri, 26 Apr 2019 12:54:02 +0000 (08:54 -0400)]
* lib-src/profile.c: Delete long-obsolete file

This auxiliary executable was used by the old `profile.el` which later
inspired `elp.el`.  It was made obsolete when Emacs acquired native timers.

* lib-src/Makefile.in (UTILITIES): Remove profile.
(profile${EXEEXT}): Delete rule.

5 years agoHandle quoted file names in tramp-archive.el
Michael Albinus [Fri, 26 Apr 2019 10:31:50 +0000 (12:31 +0200)]
Handle quoted file names in tramp-archive.el

* lisp/net/tramp-archive.el (tramp-archive-file-name-p):
Suppress quoted file names.
(tramp-archive-file-name-handler): Handle quoted file names.

* lisp/net/tramp-compat.el (tramp-compat-file-name-quoted-p):
Add optional TOP argument.

5 years agoAvoid compiler warning in dynlib.c
Eli Zaretskii [Fri, 26 Apr 2019 07:39:24 +0000 (10:39 +0300)]
Avoid compiler warning in dynlib.c

* src/dynlib.c (dynlib_addr) [WINDOWSNT]: Rename the first
argument to be consistent with other platforms.  Cast it to
'void *' to avoid compiler warning as result of changing the
function's signature as part of the last recent change in
dynlib.c.

5 years ago* test/lisp/progmodes/sql-tests.el (sql-tests-buffer-naming-harness):
Glenn Morris [Fri, 26 Apr 2019 02:06:34 +0000 (22:06 -0400)]
* test/lisp/progmodes/sql-tests.el (sql-tests-buffer-naming-harness):
Fix previous for TEST_LOAD_EL=no.

5 years agoFix the formatting of '\' (including apostrophes) in CC Mode.
Alan Mackenzie [Fri, 26 Apr 2019 01:15:00 +0000 (01:15 +0000)]
Fix the formatting of '\' (including apostrophes) in CC Mode.

In particular, the second apostrophe must also get font-lock-warning-face.

* lisp/progmodes/cc-mode.el (c-parse-quotes-before-change)
(c-parse-quotes-after-change): Add cond arms to recognize and handle the
anomalous construct '\'.  Correct the handling of c-new-BEG in
c-parse-quotes-before-change.

5 years ago* test/lisp/progmodes/sql-tests.el (sql-tests-buffer-naming-harness):
Glenn Morris [Thu, 25 Apr 2019 23:53:02 +0000 (19:53 -0400)]
* test/lisp/progmodes/sql-tests.el (sql-tests-buffer-naming-harness):
Skip if no sqlite program.

5 years agoFix Bug#33618; define search path variables for grep, byte-compile
Stephen Leake [Thu, 25 Apr 2019 22:49:38 +0000 (15:49 -0700)]
Fix Bug#33618; define search path variables for grep, byte-compile

* etc/NEWS: Mention new variables.

* lisp/emacs-lisp/bytecomp.el (emacs-lisp-compilation-search-path): New.

* lisp/progmodes/grep.el (grep-search-path): New.

5 years agoMinor tweaks to recent UBSan-related fix
Paul Eggert [Thu, 25 Apr 2019 20:42:50 +0000 (13:42 -0700)]
Minor tweaks to recent UBSan-related fix

* src/alloc.c: No need to include stdalign.h; it’s pervasive.
(GC_STRING_OVERRUN_COOKIE_SIZE): Align to sdata’s alignment,
so that the code works even if alignof (sdata) exceeds 8.
Don’t require the cookie size to be 8, as this overly fattens
32-bit platforms and one DEADBEEF should be enough.
(GC_STRING_EXTRA): Omit now-unnecessary ‘verify’.
(allocate_string_data): Omit unnecessary cast.

5 years agoPort to Oracle Developer Studio 12.6
Paul Eggert [Thu, 25 Apr 2019 20:21:39 +0000 (13:21 -0700)]
Port to Oracle Developer Studio 12.6

This compiler is a bit pickier about checking conformance to
the C standard, ranging from syntax trivia (no extra ";" at
the top level) to portability trivia (warnings re conversion
between function and data pointers) to more-important stuff
like lack of support for some __attribute__ usages.
* src/dynlib.c (dynlib_addr): First argument is a function
pointer, not a data pointer.  All callers changed.
* src/emacs-module.c (module_function_address):
Return module_funcptr, not void *.  All uses changed.
* src/lisp.h (module_funcptr) [HAVE_MODULES]: New type.
* src/lread.c (union ieee754_double): Don’t assume the usual
semantics for converting signed to unsigned int when initializing
a bitfield, as the Oracle compiler complains and the C standard
is unclear.
* src/pdumper.c (ALLOW_IMPLICIT_CONVERSION): Make it clearer
that -Wsign-conversion is disabled everywhere in this file.
(dump_trace, dump_tailq_prepend, dump_tailq_append):
Don’t assume __attribute__.
(dump_object_self_representing_p): Don’t disable conversion
warnings; it’s not needed here.
(DEFINE_FROMLISP_FUNC): Avoid possible signal in integer
conversion from unsigned to signed.
(DEFINE_FROMLISP_FUNC, finish_dump_pvec): Avoid warning about
unreachable statements on platforms not supporting the
__attribute__.
(intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp)
(dump_off_to_lisp, dump_emacs_reloc_immediate_lv)
(dump_emacs_reloc_immediate_ptrdiff_t)
(dump_emacs_reloc_immediate_intmax_t)
(dump_emacs_reloc_immediate_int, dump_emacs_reloc_immediate_bool):
Omit stray semicolon that violates C standard.
(dump_metadata_for_pdumper): Add cast to pacify compiler complaining
about conversion from function pointer to data pointer.
(Fdump_emacs_portable): Do not use CALLN to call a function
with zero arguments, as C99 prohibits empty initializers.
* src/xdisp.c (syms_of_xdisp): Do not nest calls to pure_list,
to work around a bug in Oracle Developer Studio 12.6.

5 years ago* lisp/simple.el (eval-expression): Fix paren typo.
Stefan Monnier [Thu, 25 Apr 2019 19:34:05 +0000 (15:34 -0400)]
* lisp/simple.el (eval-expression): Fix paren typo.

5 years agoMake sure that ‘sdata’ objects in ‘sblock’ objects are aligned.
Philipp Stephani [Thu, 25 Apr 2019 19:28:46 +0000 (21:28 +0200)]
Make sure that ‘sdata’ objects in ‘sblock’ objects are aligned.

Issue found by Clang’s UBSan.

* src/alloc.c (GC_STRING_OVERRUN_COOKIE_SIZE): Increase to 8.
(string_overrun_cookie): Extend accordingly.
(GC_STRING_EXTRA): Ensure that it’s properly aligned for ‘sdata’.
(allocate_string_data): Verify that ‘sdata’ blocks remain aligned.

5 years agoUse lexical-binding by default for M-:, --eval, and *scratch*
Stefan Monnier [Thu, 25 Apr 2019 18:36:03 +0000 (14:36 -0400)]
Use lexical-binding by default for M-:, --eval, and *scratch*

* lisp/startup.el (command-line): Default to lexical-binding in *scratch*.
(normal-no-mouse-startup-screen, command-line-1):
Use startup--get-buffer-create-scratch.
(command-line-1):
* lisp/simple.el (eval-expression):
* lisp/server.el (server-eval-and-print): Use lexical-binding to
evaluate the expression.
(server-execute): Use startup--get-buffer-create-scratch.
* lisp/ielm.el (inferior-emacs-lisp-mode): Default to lexical-binding.

5 years agoRestore fontification of delimiters of multiline CC Mode strings.
Alan Mackenzie [Thu, 25 Apr 2019 18:00:15 +0000 (18:00 +0000)]
Restore fontification of delimiters of multiline CC Mode strings.

E.g., on typing the closing delimiter of a string continued onto a second
line, the opening delimiter retained its font-lock-warning-face.

* lisp/progmodes/cc-defs.el (c-c++-raw-string-opener-re)
(c-c++-raw-string-opener-1-re): New constants.
(c-sub-at-c++-raw-string-opener, c-at-c++-raw-string-opener): New macros.

* lisp/progmodes/cc-engine.el (c-raw-string-pos)
(c-depropertize-raw-strings-in-region, c-after-change-unmark-raw-strings):
Replace uses of open-coded raw string regexps by the new constants and macros
in cc-defs.el.

* lisp/progmodes/cc-fonts.el (c-font-lock-raw-strings): Ditto

* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Set
c-new-BEG to the beginning of the string when we encounter its closing ".
When not in a raw string, but in a string, clear syntax-table properties from
its delimiters and set c-new-BEG/END to its limits.
(c-after-change-mark-abnormal-strings): When applying syntax-table properties
to string delimiters, also set c-new-BEG/END to ensure subsequent
fontification.

5 years agoMake wdired-mode ignore ls file indicators
Stephen Berman [Thu, 25 Apr 2019 17:17:23 +0000 (19:17 +0200)]
Make wdired-mode ignore ls file indicators

* lisp/wdired.el (wdired--restore-dired-filename-prop): When
dired-listing-switches includes "F" or "classify", don't treat
appended indicator characters as part of the file name (bug#34915).

* test/lisp/wdired-tests.el (wdired-test-bug34915): New test.

5 years agoPort emacsclient euidaccess to Solaris 10
Paul Eggert [Thu, 25 Apr 2019 15:50:50 +0000 (08:50 -0700)]
Port emacsclient euidaccess to Solaris 10

Without this fix, linking emacsclient fails with ‘Undefined
symbol eaccess’ on Solaris 10 sparc.
* lib-src/Makefile.in (LIB_EACCESS): New macro.
(emacsclient${EXEEXT}, emacsclientw${EXEEXT}): Use it.

5 years agoFix some corner cases in the recognition of C++ raw strings.
Alan Mackenzie [Thu, 25 Apr 2019 15:18:12 +0000 (15:18 +0000)]
Fix some corner cases in the recognition of C++ raw strings.

These are where changing the identifier in a raw string delimiter causes
different delimiters to match eachother.

* lisp/progmodes/cc-engine.el (c-raw-string-end-delim-disrupted): New
variable.
(c-before-change-check-raw-strings): Use new variable.
(c-after-change-unmark-raw-strings): When typing into an opening delimiter or
altering its close delimiter causes the opening delimiter to match a later
closing delimiter, clear all syntax-table char properties from the opening
delimiter onwards, and set c-new-END to point max.  Also, when changing a
closing delimiter, check whether its new value matches a previously open
opening delimiter earlier in the buffer, and amend the syntax-table text
properties appropriately.

5 years ago* lisp/progmodes/sql.el
Michael R. Mauger [Thu, 25 Apr 2019 00:59:25 +0000 (20:59 -0400)]
* lisp/progmodes/sql.el
(sql-is-sqli-buffer-p): New function.
(sql-generate-unique-sqli-buffer-name): Refactor and use it.
(sql-product-interactive): Simplify name logic.
* test/lisp/progmodes/sql-tests.el
(sql-tests-placeholder-filter-harness): New macro.
(sql-tests-placeholder-filter-simple)
(sql-tests-placeholder-filter-ampersand)
(sql-tests-placeholder-filter-period): Refactored tests and use macro.
(sql-tests-buffer-naming-harness): New macro.
(sql-tests-buffer-naming-default)
(sql-tests-buffer-naming-multiple)
(sql-tests-buffer-naming-explicit)
(sql-tests-buffer-naming-universal-argument)
(sql-tests-buffer-naming-existing): New tests.

5 years agoImprove port to platforms lacking euidaccess (Bug#35406)
Paul Eggert [Thu, 25 Apr 2019 00:41:05 +0000 (17:41 -0700)]
Improve port to platforms lacking euidaccess (Bug#35406)

* lib-src/emacsclient.c (set_local_socket):
Use faccessat with AT_EACCESS instead of using euidaccess.
* admin/merge-gnulib, lib/gnulib.mk.in, m4/gnulib-comp.m4:
Revert previous change.

5 years agoPort to platforms lacking euidaccess (Bug#35406)
Paul Eggert [Thu, 25 Apr 2019 00:34:09 +0000 (17:34 -0700)]
Port to platforms lacking euidaccess (Bug#35406)

* admin/merge-gnulib (GNULIB_MODULES): Add euidaccess.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.

5 years agoMerge from gnulib
Paul Eggert [Thu, 25 Apr 2019 00:29:06 +0000 (17:29 -0700)]
Merge from gnulib

5 years agoFix some strings in wordstar mode
Mark Oteiza [Wed, 24 Apr 2019 23:44:48 +0000 (19:44 -0400)]
Fix some strings in wordstar mode

* lisp/obsolete/ws-mode.el (ws-search-direction, ws-error, ws-end-block):
(ws-mark-word, ws-undo, ws-goto-last-cursorposition, ws-last-error):
(ws-kill-bol): Remove full stops from message string endings.  Minor
formatting tweaks.

5 years agoChange WordStar emulation into a minor mode (Bug#35148)
Mark Oteiza [Wed, 24 Apr 2019 23:38:20 +0000 (19:38 -0400)]
Change WordStar emulation into a minor mode (Bug#35148)

* lisp/obsolete/ws-mode.el: Turn on lexical-binding.  Update commentary.
(wordstar): New custom group.
(wordstar-mode-lighter): New custom variable.
(wordstar-mode): Declare with define-minor-mode.
(turn-on-wordstar-mode): New function.
(global-wordstar-mode): New function.  Use previous new function.

5 years agoFix project-find-regexp search for '--'
Dmitry Gutov [Wed, 24 Apr 2019 23:24:57 +0000 (02:24 +0300)]
Fix project-find-regexp search for '--'

* lisp/progmodes/project.el (project--find-regexp-in-files):
Add an explicit '-e' before the pattern.  Fixing the ability to
search for '--'.  Reported by Juri Linkov <juri@linkov.net>.

5 years ago* lisp/windmove.el (windmove-display-in-direction): Support consecutive calls
Juri Linkov [Wed, 24 Apr 2019 21:40:27 +0000 (00:40 +0300)]
* lisp/windmove.el (windmove-display-in-direction): Support consecutive calls

Remember action and delete it from display-buffer-overriding-action afterwards

5 years agoUnbreak build when building without GMP support.
Philipp Stephani [Wed, 24 Apr 2019 17:35:36 +0000 (19:35 +0200)]
Unbreak build when building without GMP support.

Add support for a new preprocessor macro EMACS_MODULE_HAVE_MPZ_T to
emacs-module.h.  If this macro is defined, assume that mpz_t is
already defined and don’t include gmp.h.

Don’t document the new macro for now, as it’s unclear whether we want
to support this in modules outside the Emacs tree.

* src/emacs-module.h.in: Allow user to prevent inclusion of gmp.h.

* src/emacs-module.c: Use mini-gmp if GMP is unavailable.  Don’t
include gmp.h.

* src/lisp.h: Don’t require gmp.h.  It’s not needed for lisp.h.

* test/Makefile.in (GMP_LIB, GMP_OBJ): New variables.
($(test_module)): Use them.

* test/data/emacs-module/mod-test.c: Use mini-gmp if GMP is unavailable.

5 years agoAdd missing GMP library to test module.
Philipp Stephani [Wed, 24 Apr 2019 21:14:13 +0000 (23:14 +0200)]
Add missing GMP library to test module.

* test/Makefile.in (GMP_LIB): Define variable.
($(test_module)): Use it.

5 years agoMove definition of Lisp_Module_Function to emacs-module.c.
Philipp Stephani [Wed, 24 Apr 2019 21:12:35 +0000 (23:12 +0200)]
Move definition of Lisp_Module_Function to emacs-module.c.

* src/lisp.h: Remove include of emacs-module.h.  Remove definition
of Lisp_Module_Function structure.

* src/emacs-module.c (module_function_documentation)
(module_function_address): New accessor functions for module function
fields.
(emacs_subr, struct Lisp_Module_Function): Move from lisp.h.

* src/print.c (print_vectorlike):
* src/doc.c (Fdocumentation): Use the new accessor functions.

5 years agoSimplify thread initialization and GC
Paul Eggert [Wed, 24 Apr 2019 20:35:14 +0000 (13:35 -0700)]
Simplify thread initialization and GC

* src/lisp.h (PVECHEADERSIZE): New macro.
(XSETPVECTYPESIZE): Use it.
* src/search.c (syms_of_search): No need to initialize or
staticpro last_thing_searched or saved_last_thing_searched, as
the thread code arranges for initialization and GC.
* src/thread.c (main_thread): Initialize statically.
(Fmake_mutex, Fmake_condition_variable, Fmake_thread):
Use ALLOCATE_ZEROED_PSEUDOVECTOR rather than zeroing by hand.
(mark_one_thread): No need to mark Lisp_Object members.
(init_main_thread, init_threads_once): Remove.  All uses removed.

5 years agoRegenerate src/emacs-module.h when emacs-module.h.in changes
Eli Zaretskii [Wed, 24 Apr 2019 15:38:31 +0000 (18:38 +0300)]
Regenerate src/emacs-module.h when emacs-module.h.in changes

* Makefile.in (CONFIG_STATUS_FILES_IN): Add
src/emacs-module.h.in.

5 years agoFix rescheduling timers after suspension
Eli Zaretskii [Wed, 24 Apr 2019 15:13:04 +0000 (18:13 +0300)]
Fix rescheduling timers after suspension

* lisp/emacs-lisp/timer.el (timer-event-handler): Fix the
comparison between next invocation time and current time.

5 years agoFix posn-at-point with line-number display and display properties
Eli Zaretskii [Wed, 24 Apr 2019 12:26:54 +0000 (15:26 +0300)]
Fix posn-at-point with line-number display and display properties

* src/xdisp.c (pos_visible_p): Account for line-number display
width when CHARPOS is covered by display property that begins
at the 2nd display element of a screen line.  (Bug#35404)

5 years agoFix a typo in a recent commit
Eli Zaretskii [Wed, 24 Apr 2019 12:18:18 +0000 (15:18 +0300)]
Fix a typo in a recent commit

* src/timefns.c (timespec_to_lisp): Fix a typo in function
definition.

5 years ago* doc/lispref/internals.texi (Module Values): Add a GMP example
Philipp Stephani [Wed, 24 Apr 2019 11:54:54 +0000 (13:54 +0200)]
* doc/lispref/internals.texi (Module Values): Add a GMP example

5 years agoClarify rounding mode when converting to struct timespec.
Philipp Stephani [Wed, 24 Apr 2019 11:41:05 +0000 (13:41 +0200)]
Clarify rounding mode when converting to struct timespec.

* doc/lispref/internals.texi (Module Values): Clarify that the
truncation is towards negative infinity.

* test/data/emacs-module/mod-test.c (Fmod_test_nanoseconds): Add test
function.
(emacs_module_init): Define it.

* test/src/emacs-module-tests.el (mod-test-nanoseconds): New unit test.

5 years agoFix return type of make_time.
Philipp Stephani [Wed, 24 Apr 2019 11:17:53 +0000 (13:17 +0200)]
Fix return type of make_time.

make_time is documented to return a (TICKS . HZ) pair, so we can’t use
make_lisp_time.  Introduce a new conversion function instead.

* src/emacs-module.c (module_make_time): Use timespec_to_lisp to
correct return type.

* src/timefns.c (timespec_to_lisp): New function.
(make_lisp_time): Use it.

* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid):
Check return type.

5 years agoAdd module functions to convert from and to big integers.
Philipp Stephani [Thu, 18 Apr 2019 20:38:29 +0000 (22:38 +0200)]
Add module functions to convert from and to big integers.

* src/module-env-27.h: Add new module functions to convert big
integers.

* src/emacs-module.h.in (emacs_mpz): Define if GMP is available.

* src/emacs-module.c (module_extract_big_integer)
(module_make_big_integer): New functions.
(initialize_environment): Use them.

* test/data/emacs-module/mod-test.c (Fmod_test_double): New test
function.
(emacs_module_init): Define it.

* test/src/emacs-module-tests.el (mod-test-double): New unit test.

* doc/lispref/internals.texi (Module Values): Document new functions.

5 years agoAdd conversions to and from struct timespec to module interface.
Philipp Stephani [Thu, 18 Apr 2019 15:42:45 +0000 (17:42 +0200)]
Add conversions to and from struct timespec to module interface.

Time values are a fundamental data type, and such conversions are hard
to implement within modules because of the various forms of time
values in Emacs Lisp.  Adding dedicated conversion functions can
significantly simplify module code dealing with times.

This approach uses nanosecond precision.  While Emacs in theory has
support for higher-precision time values, in practice most languages
and standards, such as POSIX, C, Java, and Go, have settled on
nanosecond-precision integers to represent time.

* src/emacs-module.h.in: Add header for struct timespec.

* src/module-env-27.h: Add module functions for time conversion.

* src/emacs-module.c (module_extract_time, module_make_time): New
functions.
(initialize_environment): Use them.

* test/data/emacs-module/mod-test.c (Fmod_test_add_nanosecond): New
test function.
(emacs_module_init): Define it.

* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid)
(mod-test-add-nanosecond/nil, mod-test-add-nanosecond/invalid): New
unit tests.

* doc/lispref/internals.texi (Module Values): Document time
conversion functions.

5 years agoRevert "Remove font.c code commented out for a decade"
Eli Zaretskii [Wed, 24 Apr 2019 06:38:03 +0000 (09:38 +0300)]
Revert "Remove font.c code commented out for a decade"

This reverts commit 64d0cd9810af6bd0c378fc6bc666c76ddfa97e40.

Rationale: any font-related code and comments, even if unused
for decades, serves as important source of useful information
in an area of Emacs code that is notoriously under-documented.

Please do NOT remove this stuff until we have an active
expert in this are on board, who will then decide whether
this can be retired.

5 years agoDon't link libXft when using cairo
YAMAMOTO Mitsuharu [Wed, 24 Apr 2019 03:31:37 +0000 (12:31 +0900)]
Don't link libXft when using cairo

* configure.ac: Check cairo early.  Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.

5 years ago* lisp/emacs-lisp/timer-list.el: Fix header-line alignment
Stefan Monnier [Tue, 23 Apr 2019 21:54:13 +0000 (17:54 -0400)]
* lisp/emacs-lisp/timer-list.el: Fix header-line alignment

Enable lexical-binding.
(cl-print-compiled, cl-print-compiled-button): Declare.
(timer-list-mode): Add spacing to align the header.

5 years ago* src/emacs-module.c: Add an additional requirement for API changes.
Philipp Stephani [Tue, 23 Apr 2019 21:39:35 +0000 (23:39 +0200)]
* src/emacs-module.c: Add an additional requirement for API changes.

5 years agoRemove some unnecessary #ifdef directives
Paul Eggert [Tue, 23 Apr 2019 20:51:07 +0000 (13:51 -0700)]
Remove some unnecessary #ifdef directives

These directives are in files that are compiled only if the
symbols are defined.
* src/gfilenotify.c: Remove unnecessary ‘#ifdef HAVE_GFILENOTIFY’.
* src/inotify.c: Remove unnecessary ‘#ifdef HAVE_INOTIFY’.
* src/kqueue.c: Remove unnecessary ‘#ifdef HAVE_KQUEUE’.

5 years ago* etc/package-keyring.gpg: Add the 2019 key
Stefan Monnier [Tue, 23 Apr 2019 20:36:59 +0000 (16:36 -0400)]
* etc/package-keyring.gpg: Add the 2019 key

5 years agoRemove font.c code commented out for a decade
Paul Eggert [Tue, 23 Apr 2019 20:29:42 +0000 (13:29 -0700)]
Remove font.c code commented out for a decade

* src/font.c (LSTRING_HEADER_SIZE, LSTRING_GLYPH_SIZE, check_gstring)
(check_otf_features, otf_list, otf_tag_symbol, otf_open)
(font_otf_capability, generate_otf_features)
(font_otf_DeviceTable, font_otf_ValueRecord)
(font_otf_Anchor, Ffont_drive_otf, Ffont_otf_alternates)
(Fdraw_string, syms_of_font): Remove "experimental and not
tested much" code that has been "#if 0"-ed out for more than a
decade and which was getting in the way of maintenance.

5 years agoUse three-argument form for out-of-range errors.
Philipp Stephani [Tue, 23 Apr 2019 14:59:46 +0000 (16:59 +0200)]
Use three-argument form for out-of-range errors.

This provides more debugging hints for callers.

* src/emacs-module.c (module_copy_string_contents): Use three-argument
form of args-out-of-range.

5 years agoUse high-level integer conversion macro in a few cases.
Philipp Stephani [Tue, 23 Apr 2019 14:48:49 +0000 (16:48 +0200)]
Use high-level integer conversion macro in a few cases.

INT_TO_INTEGER is more obviously correct and means we don’t have to
worry about data type sizes and signedness.

* src/json.c (json_parse_error): Use INT_TO_INTEGER.  The tiny
performance gain of make_fixed_natnum isn’t worth the trouble then
signaling an error.

5 years agoRename auto-revert-notify-watch-descriptor-hash-list
Mattias Engdegård [Tue, 23 Apr 2019 12:31:22 +0000 (14:31 +0200)]
Rename auto-revert-notify-watch-descriptor-hash-list

* lisp/autorevert.el
(auto-revert-notify-watch-descriptor-hash-list):
Rename to auto-revert--buffers-by-watch-descriptor.  Improved doc string.
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch,
auto-revert-notify-handler): Use new name.

5 years agoRemote processes cannot use a pipe process for stderr
Michael Albinus [Tue, 23 Apr 2019 14:07:38 +0000 (16:07 +0200)]
Remote processes cannot use a pipe process for stderr

* doc/lispref/processes.texi (Asynchronous Processes):
(Accepting Output): Remote processes cannot use a pipe process for
stderr.

5 years ago* src/json.c (json_make_string): Add missing cast.
Philipp Stephani [Tue, 23 Apr 2019 13:31:04 +0000 (15:31 +0200)]
* src/json.c (json_make_string): Add missing cast.

5 years agoSpeed up JSON parsing
Eli Zaretskii [Tue, 23 Apr 2019 10:20:46 +0000 (13:20 +0300)]
Speed up JSON parsing

Thanks to Dmitry Gutov <dgutov@yandex.ru> for running many
benchmarks and for useful discussions.
* src/json.c (json_make_string): Speed up parsing of JSON
strings by optimizing the normal case of a valid UTF-8 string
being returned from libjansson.  (Bug#31138)

5 years agoSmall fix for a JSON unit test.
Philipp Stephani [Tue, 23 Apr 2019 09:59:29 +0000 (11:59 +0200)]
Small fix for a JSON unit test.

* test/src/json-tests.el (json-parse-string/null): Make JSON object
syntactically valid.  This test is supposed to check whether an
escaped null character causes an error, but without quoting the string
it would be syntactically invalid in any case.

5 years agoOptimize for typing characters into long C++ raw strings.
Alan Mackenzie [Tue, 23 Apr 2019 09:16:05 +0000 (09:16 +0000)]
Optimize for typing characters into long C++ raw strings.

* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
(c-font-lock-objc-methods) (c-font-lock-declarations, c-font-lock-enum-tail)
(c-font-lock-cut-off-declarators, c-font-lock-enclosing-decls): If the chunk
been fontified consists entirely of comments and strings, don't attempt to
perform the function's action.

* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Don't
expand (c-new-BEG c-new-END) unnecessarily to the entire raw string being
fontified.
(c-fl-decl-start, c-fl-decl-end): When in a (raw or otherwise) string, don't
return a position outside of the string (which used to cause unneeded
fontification).

5 years agoRelease xft_data in widget destroy callback to avoid visual distraction
YAMAMOTO Mitsuharu [Tue, 23 Apr 2019 08:27:04 +0000 (17:27 +0900)]
Release xft_data in widget destroy callback to avoid visual distraction

* lwlib/lwlib-int.h (struct _widget_instance) [HAVE_XFT]: Remove nr_xft_data.
* lwlib/lwlib-Xaw.c (find_xft_data, xaw_update_one_widget) [HAVE_XFT]: Loop
while widget member is not NULL instead of using nr_xft_data.
(xaw_destroy_instance) [HAVE_XFT]: Move xft_data release code from here ...
(destroy_xft_data) [HAVE_XFT]: ... to here.
(make_dialog) [HAVE_XFT]: Add destroy_xft_data as destroy callback for dialog.

5 years agoLet plain ‘make’ work even not GNU Make
Paul Eggert [Tue, 23 Apr 2019 03:44:11 +0000 (20:44 -0700)]
Let plain ‘make’ work even not GNU Make

* Makefile.in (top_distclean): Clean makefile as well as Makefile.
* configure.ac: If not using plain ‘make’, create a makefile
so that plain ‘make’ simply calls $(MAKE).

5 years agoRevert Vinternal_interpreter_environment tweak
Paul Eggert [Tue, 23 Apr 2019 03:02:20 +0000 (20:02 -0700)]
Revert Vinternal_interpreter_environment tweak

Stefan Monnier pointed out examples like (funcall `(closure
,(let ((cycle (list nil))) (setcdr cycle cycle)) () a)),
where the user can set Vinternal_interpreter_environment
indirectly.
* src/eval.c (Fsetq): Revert recent change, going back to Fassq.

5 years agoImprove UBSan discussion in etc/DEBUG
Paul Eggert [Tue, 23 Apr 2019 00:26:11 +0000 (17:26 -0700)]
Improve UBSan discussion in etc/DEBUG

* etc/DEBUG: Improve -gdwarf-N documentation.
Go into more detail about UndefinedBehaviorSanitizer.

5 years agoTweak Vinternal_interpreter_environment lookup
Paul Eggert [Mon, 22 Apr 2019 19:34:26 +0000 (12:34 -0700)]
Tweak Vinternal_interpreter_environment lookup

* src/eval.c (Fsetq, eval_sub): Use assq_no_quit instead
of Fassq for a list that cannot contain cycles or be that long.

5 years agoImprove wur coverage on older GCCs
Paul Eggert [Mon, 22 Apr 2019 19:25:40 +0000 (12:25 -0700)]
Improve wur coverage on older GCCs

* src/conf_post.h (__has_attribute_warn_unused_result):
New macro for compilers lacking __has_attribute.
* src/systhread.h (__has_attribute): Remove ineffective define.
(ATTRIBUTE_WARN_UNUSED_RESULT): Work better on GCC 3.4 thru 4.

5 years agoGo back to old way of checking json int range
Paul Eggert [Mon, 22 Apr 2019 18:40:13 +0000 (11:40 -0700)]
Go back to old way of checking json int range

Although the lisp.h macros really need improvement,
INTEGER_TO_INT is not the right way to go about it, as it
causes conversion from intmax_t to uintmax_t and back again,
which can cause a signal if the value is negative.
* src/lisp.h (INTEGER_TO_INT, ranged_integer_to_int)
(ranged_integer_to_uint): Remove, reverting recent changes to
this file.
* src/json.c (lisp_to_json): Revert to previous code,
as the change messes up with uintmax_t<->intmax_t conversion.

5 years ago* src/lisp.h (INTEGER_TO_INT): Fix bug.
Philipp Stephani [Mon, 22 Apr 2019 16:58:51 +0000 (18:58 +0200)]
* src/lisp.h (INTEGER_TO_INT): Fix bug.

5 years agoPrecise handling of filenotify `stopped' events
Mattias Engdegård [Sat, 20 Apr 2019 11:16:37 +0000 (13:16 +0200)]
Precise handling of filenotify `stopped' events

* lisp/autorevert.el (auto-revert-notify-handler):
When getting a `stopped' event, deal with it for the buffers it applies to,
rather than for all buffers in auto-revert mode.

5 years ago* autorevert.el (auto-revert-notify-rm-watch): Simplify.
Mattias Engdegård [Mon, 22 Apr 2019 16:04:00 +0000 (18:04 +0200)]
* autorevert.el (auto-revert-notify-rm-watch): Simplify.

5 years agoRevert "Don't remove notify descriptor that is already gone"
Mattias Engdegård [Mon, 22 Apr 2019 15:55:32 +0000 (17:55 +0200)]
Revert "Don't remove notify descriptor that is already gone"

This reverts commit e9e807e9317ca7aa99a5dd220ee8586f8f4331bf,
which is no longer necessary as `file-notify-rm-watch' has been
made robust against reentry.

5 years agoMake file-notify-rm-watch robust against reentry
Mattias Engdegård [Sat, 20 Apr 2019 08:19:52 +0000 (10:19 +0200)]
Make file-notify-rm-watch robust against reentry

Allow file-notify callbacks to call `file-notify-rm-watch', harmlessly,
after receiving a `stopped' event without triggering recursion.

* lisp/filenotify.el (file-notify--watch): Note that `callback' can be nil.
(file-notify--rm-descriptor): Set the `callback' field to nil before
sending `stopped'.
(file-notify-rm-watch): Don't do anything if the `callback' field is nil.

5 years agoIntroduce a helper macro to convert a Lisp integer to a C integer.
Philipp Stephani [Mon, 22 Apr 2019 15:29:06 +0000 (17:29 +0200)]
Introduce a helper macro to convert a Lisp integer to a C integer.

This is similar to CONS_TO_INTEGER.  The inverse (INT_TO_INTEGER)
already exists.

* src/lisp.h (INTEGER_TO_INT): New macro.
(ranged_integer_to_int, ranged_integer_to_uint): New
functions.

* src/json.c (lisp_to_json): Use helper macro.

5 years agoImprove documentation around standard error pipes (Bug#35328).
Philipp Stephani [Sun, 21 Apr 2019 16:09:38 +0000 (18:09 +0200)]
Improve documentation around standard error pipes (Bug#35328).

* doc/lispref/processes.texi (Asynchronous Processes): Document
existence and properties of the standard error process.
(Accepting Output): Document that one has to accept output from the
standard error process separately.

5 years agoModule API: Don’t require null-terminated strings in make_string.
Philipp Stephani [Mon, 22 Apr 2019 13:43:52 +0000 (15:43 +0200)]
Module API: Don’t require null-terminated strings in make_string.

* emacs-module.c (module_make_string): Use make_unibyte_string, which
doesn’t require its argument to be null-terminated.  Since it always
returns a heap-allocated string, we don’t have to copy it any more
while decoding.
(module_decode): New helper function.

5 years agoUse utf-8-unix for coding system conversions in the module API.
Philipp Stephani [Mon, 22 Apr 2019 13:39:39 +0000 (15:39 +0200)]
Use utf-8-unix for coding system conversions in the module API.

Factor out conversions into helper functions to provide a simpler
interface.

* src/emacs-module.c (module_encode, module_decode_copy): New helper
functions.
(module_make_function, module_copy_string_contents)
(module_make_string): Use them.

5 years agoImprove pure and side-effect-free docs
Basil L. Contovounesios [Wed, 17 Apr 2019 15:34:47 +0000 (16:34 +0100)]
Improve pure and side-effect-free docs

For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00316.html
* doc/lispref/customize.texi (Composite Types): Do not overspecify
:match-alternatives predicates.
* doc/lispref/eval.texi (Intro Eval): Anchor definition of "side
effect" for cross-referencing...
* doc/lispref/functions.texi (What Is a Function): ...from here.
Define what a pure function is.
* doc/lispref/internals.texi (Writing Emacs Primitives): Describe
currently preferred approach to marking primitives as pure and
side-effect-free.
* doc/lispref/symbols.texi (Standard Properties): Expand description
of pure and side-effect-free properties.

5 years agoRefactoring: Inline a few macros.
Philipp Stephani [Mon, 22 Apr 2019 09:36:59 +0000 (11:36 +0200)]
Refactoring: Inline a few macros.

Now that CATCHER_ALL catches signals as well, we can simplify
MODULE_HANDLE_NONLOCAL_EXIT a bit.

* src/emacs-module.c (MODULE_SETJMP, MODULE_SETJMP_1): Remove.
(MODULE_HANDLE_NONLOCAL_EXIT): Inline MODULE_SETJMP and
MODULE_SETJMP_1.

5 years ago; * etc/NEWS: Improve wording of a recent addition.
Eli Zaretskii [Mon, 22 Apr 2019 08:12:45 +0000 (11:12 +0300)]
; * etc/NEWS: Improve wording of a recent addition.

5 years agoSome changes in tramp-tests
Michael Albinus [Mon, 22 Apr 2019 07:58:37 +0000 (09:58 +0200)]
Some changes in tramp-tests

* test/lisp/net/tramp-tests.el (tramp-test32-shell-command):
Check for backward compatibility.
(tramp-test33-environment-variables): Apply a better check for
unset variable.

5 years agoMention AddressSanitizer etc. in etc/DEBUG
Paul Eggert [Mon, 22 Apr 2019 06:15:42 +0000 (23:15 -0700)]
Mention AddressSanitizer etc. in etc/DEBUG

* etc/DEBUG: Modernize for AddressSanitizer etc.
* etc/NEWS: Defer to etc/DEBUG for this.

5 years agoRemove --enable-checking=xmallocoverrun
Paul Eggert [Mon, 22 Apr 2019 04:47:10 +0000 (21:47 -0700)]
Remove --enable-checking=xmallocoverrun

It doesn’t work anymore, and these days ‘gcc -fsanitize=address’
does a better job anyway.
* configure.ac: Remove the option.
* configure.ac (ac_xmalloc_overrun, XMALLOC_OVERRUN_CHECK):
* src/alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD)
(XMALLOC_OVERRUN_CHECK_SIZE, XMALLOC_OVERRUN_SIZE_SIZE)
(xmalloc_overrun_check_header, xmalloc_overrun_check_trailer)
(xmalloc_put_size, xmalloc_get_size, overrun_check_malloc)
(overrun_check_realloc, overrun_check_free):
Remove.  All uses removed.
* etc/NEWS: Mention this.

5 years agoRemove --enablechecking=conslist configure option
Paul Eggert [Mon, 22 Apr 2019 04:47:10 +0000 (21:47 -0700)]
Remove --enablechecking=conslist configure option

* configure.ac: Remove the option.
* configure.ac (ac_gc_check_cons_list, GC_CHECK_CONS_LIST):
* src/alloc.c (check_cons_list) [GC_CHECK_CONS_LIST]:
* src/lisp.h (lisp_h_check_cons_list, check_cons_list):
Remove.  All uses removed.
* etc/NEWS: Mention this.

5 years agoSimplify XPNTR
Paul Eggert [Mon, 22 Apr 2019 04:45:04 +0000 (21:45 -0700)]
Simplify XPNTR

Because XPNTR now uses ATTRIBUTE_NO_SANITIZE_UNDEFINED,
it can be simplified.
* src/alloc.c (macro_PNTR_ADD, PNTR_ADD, macro_XPNTR): Remove.
(XPNTR): Open-code rather than using the removed macros and
functions.  Also, simplify by using LISP_WORD_TAG.

5 years agoFix drain_reloc_list alignment bug
Paul Eggert [Mon, 22 Apr 2019 04:16:03 +0000 (21:16 -0700)]
Fix drain_reloc_list alignment bug

* src/pdumper.c (dump_charset): Use alignof (struct charset),
not alignof (int), since struct charset might be more strictly
aligned than int.  I think this is just a minor performance
issue, but we might as well use the correct alignment.
(drain_reloc_list): Use an alignment instead of a size for the
output alignment.  This prevents undefined behavior when
alignof (struct emacs_reloc) == 8 and sizeof (dump_off) == 4
when building on x86-64 with gcc -fsanitize=undefined.

5 years agoPort dump_bitset_clear to -fsanitize=undefined
Paul Eggert [Mon, 22 Apr 2019 03:36:56 +0000 (20:36 -0700)]
Port dump_bitset_clear to -fsanitize=undefined

* src/pdumper.c (dump_bitset_clear):
Pacify -fsanitize=undefined by avoiding memset (NULL, x, 0),
which strictly speaking has undefined behavior although it
works on all production platforms I know.

5 years agoPort to recent gcc -fsanitize=undefined
Paul Eggert [Mon, 22 Apr 2019 03:34:03 +0000 (20:34 -0700)]
Port to recent gcc -fsanitize=undefined

* src/alloc.c (XPNTR): Add ATTRIBUTE_NO_SANITIZE_UNDEFINED and
remove ATTRIBUTE_UNUSED.  Do not define as a macro, so that
ATTRIBUTE_NO_SANITIZE_UNDEFINED works.
* src/lisp.h (lisp_h_XSYMBOL): Remove.  All uses removed.
With recent GCC the macro does not work with -fsanitize=undefined,
and the macro can be omitted as its only function is to optimize -O0.

5 years agoMove side-effect-free from unsafep.el to subr.el
Basil L. Contovounesios [Wed, 17 Apr 2019 16:35:12 +0000 (17:35 +0100)]
Move side-effect-free from unsafep.el to subr.el

* lisp/emacs-lisp/unsafep.el: Move side-effect-free property setting
from here...
* lisp/subr.el: ...to here, as function declarations for modularity.

5 years agoFix double-free in pdumper
Paul Eggert [Sun, 21 Apr 2019 16:59:13 +0000 (09:59 -0700)]
Fix double-free in pdumper

Revert the double-free bug that I introduced in
2019-03-11T15:20:54Z!eggert@cs.ucla.edu.
* src/pdumper.c (dump_mmap_reset): Do not free the private member;
that’s the release function’s job.
(dump_mm_heap_cb_release): Free cb if its refcount goes to zero.
(dump_mmap_contiguous_heap): Mention memory leak in comment.

5 years agoMerge from origin/emacs-26
Glenn Morris [Sun, 21 Apr 2019 14:51:38 +0000 (07:51 -0700)]
Merge from origin/emacs-26

9d7e08d (origin/emacs-26) Avoid false positives and false negatives o...
75b589c Fix markup related to quoting in Info
fd6ff29 Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emac...
cd2204f Add a package: line to c-submit-bug-report.
a992dca ; Remove empty NEWS sections
ea67270 ; Add NEWS sections for 26.3
45b0946 ; Bump Emacs version to 26.2.50
aae8cc3 * admin/admin.el (set-version): Add NEWS headers for a .50 ve...