1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-31 01:20:37 -08:00
Commit graph

41071 commits

Author SHA1 Message Date
Paul Eggert
a038df77de Allow gap before first non-Lisp pseudovec member
Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00259.html
Solution suggested by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00282.html
* src/buffer.h (BUFFER_LISP_SIZE): Simplify by using PSEUDOVECSIZE.
(BUFFER_REST_SIZE): Simplify by using VECSIZE and BUFFER_LISP_SIZE.
* src/lisp.h (PSEUDOVECSIZE): Base it on the last Lisp field,
not the first non-Lisp field.  All callers changed.  Callers
without Lisp fields changed to use ALLOCATE_PLAIN_PSEUDOVECTOR.
(ALLOCATE_PLAIN_PSEUDOVECTOR): New macro.
2019-04-08 13:01:21 -07:00
Alexander Gramiak
0b8117ed1a ; * src/frame.h (MonitorInfo): Remove const modifier
This removes a compiler warning with xfree.
2019-04-07 19:17:48 -06:00
Alexander Gramiak
7b78857c0b ; * src/xfns.c (x-display-monitor-attributes-list) Fix typo. 2019-04-07 12:56:14 -06:00
Alexander Gramiak
a35e06bbe2 Plug memory leak in GTK x-display-monitor-attributes-list
* src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as
  well.

* src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug
  memory leak.

* src/frame.h (MonitorInfo): Declare name as pointing to const char.
2019-04-07 12:49:02 -06:00
Paul Eggert
404a5470cf Simplify fill_gstring_header
* src/composite.c (fill_gstring_header): Omit first argument HEADER,
since in practice it is always nil.  Change caller to match.
Help the compiler by telling it LEN is nonnegative.
Problem found with --enable-gcc-warnings and gcc -O2 -Og.
2019-04-07 11:44:04 -07:00
Paul Eggert
74732c5412 Help the compiler with byte order
* src/xsettings.c (parse_settings): Help the compiler by
letting it deduce the native endianness at compile-time.
2019-04-07 11:44:04 -07:00
Stefan Monnier
43f4c7ddd2 * src/buffer.c (Fget_buffer_create): Apply booleans's eta-reduction 2019-04-06 18:54:31 -04:00
Eli Zaretskii
91018cec01 Encode the FILENAME argument of 'file-locked-p'
* src/filelock.c (Ffile_locked_p): Encode the file name,
before passing it to system APIs.  (Bug#35171)
2019-04-06 17:53:30 +03:00
Basil L. Contovounesios
7dc0a06959 Don't leave inhibit_buffer_hooks uninitialized
* src/buffer.c (Fget_buffer_create): Explicitly initialize
inhibit_buffer_hooks. (bug#34847)
2019-04-06 14:35:04 +01:00
Eli Zaretskii
47aae7cfe1 ; * src/w32fns.c (Fw32_read_registry): Doc fix. 2019-04-06 16:16:32 +03:00
Konstantin Kharlamov
051533c6fa Minor cleanup in widget.c
* src/widget.c (update_wm_hints): Remove variables that are
always zero, and simplify all expressions which used them.
(Bug#35062)
2019-04-05 10:15:46 +03:00
Konstantin Kharlamov
3187efe713 Minor cleanup in gtkutil.c
* src/gtkutil.c (x_wm_set_size_hint): Remove variables that
are always zero, and simplify all expressions which used
them.  (Bug#35062)
2019-04-05 10:01:58 +03:00
Eli Zaretskii
2bcf0f097c Improve commentary in 'field_relpos'
* src/pdumper.c (PDUMPER_MAX_OBJECT_SIZE): New macro.
(field_relpos): Use PDUMPER_MAX_OBJECT_SIZE, and comment on
why we require that relpos be not too large.
2019-04-03 20:41:47 +03:00
Eli Zaretskii
b29b79efd9 Restore process-environment after portable dumping
* src/pdumper.c (struct dump_context): New member
old_process_environment.
(Fdump_emacs_portable): Record the original value of
process-environment.
(dump_unwind_cleanup): Restore the original values of
process-environment and post-gc-hook.
2019-04-03 20:30:23 +03:00
Noam Postavsky
b36913d803 Allow partial decompression (Bug#33133)
* src/decompress.c (Fzlib_decompress_region): Add optional
ALLOW-PARTIAL parameter.
* lisp/url/url-http.el (url-handle-content-transfer-encoding): Use it.
* doc/lispref/text.texi (Decompression): Document it.
* etc/NEWS: Announce it.
2019-04-02 22:02:32 -04:00
Stefan Monnier
84616144ca * lisp/subr.el (prog2): Define as a macro
* src/eval.c (Fprog2): Delete function.
(syms_of_eval): Don't register it.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/generator.el (cps--transform-1): Remove `prog2` case.

* lisp/emacs-lisp/bytecomp.el (prog2): Remove handlers.
(byte-compile-prog2): Delete.

* lisp/emacs-lisp/lisp-mode.el (prog2): Remove property.
2019-04-02 10:04:44 -04:00
Paul Eggert
74b63d27a6 Make struct Lisp_Objfwd etc. objects read-only
Initialize these objects statically, and make them constants.
This is a bit safer and more efficient.
* src/data.c (XBOOLFWD, XKBOARD_OBJFWD, XFIXNUMFWD, XOBJFWD):
* src/lisp.h (XBUFFER_OBJFWD):
Return a pointer-to-const instead of an unrestricted pointer.
(lispfwd): fwdptr is now a pointer-to-const instead of an
unrestricted pointer.  All uses changed.
(SET_SYMBOL_FWD): Accept pointer-to-const instead of an
unrestricted pointer.
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_KBOARD): Initialize static structures statically
instead of dynamically, and make them const.
* src/lread.c (defvar_int, defvar_bool, defvar_lisp_nopro)
(defvar_lisp, defvar_kboard): Accept pointer-to-const instead
of an unrestricted pointer; it’s now the caller’s
responsibility to initialize the pointed-to storage.  No need
for a separate address argument any more.  All callers
changed.
2019-04-01 12:02:37 -07:00
Paul Eggert
9287813da1 Fix union Lisp_Fwd * alignment bug
It's not portable to cast (e.g.) struct Lisp_Objfwd * to union
Lisp_Fwd * and then back again, because the compiler can then assume
that the pointer is aligned for union Lisp_Fwd * when accessing
the struct Lisp_Objfwd * components, and this assumption might
be incorrect becase we don't force that alignment.
* src/lisp.h (lispfwd): New type, replacing ...
(union Lisp_Fwd): ... this type, which was removed.
All uses changed.
(SET_SYMBOL_FWD): 2nd arg is now void *, not lispfwd.
All uses changed (casts no longer needed; they were
not portable anyway).
2019-04-01 12:02:37 -07:00
Stefan Monnier
197fbfc71f * lisp/subr.el (setq-default): Define as a macro
* lisp/emacs-lisp/bytecomp.el (byte-compile-setq-default): Delete.
(byte-compile-set-default): Inline the part that it used.

* lisp/emacs-lisp/edebug.el (setq-default): Remove the debug spec.

* src/data.c (Fsetq_default): Delete.
(syms_of_data): Don't register.
2019-04-01 12:35:10 -04:00
Eli Zaretskii
20ef15fbe6 Fix a typo in xterm.c and w32term.c
* src/xterm.c (x_window_to_scroll_bar):
* src/w32term.c (x_window_to_scroll_bar): Fix a typo.
2019-04-01 17:39:30 +03:00
Eli Zaretskii
dd7d83e1db Fix a thinko in a recent commit
* src/buffer.c (Fkill_buffer): Fix last change.  (Bug#31138)
Reported by Mattias Engdegård <mattiase@acm.org>.
2019-03-30 14:27:11 +03:00
Mattias Engdegård
f2c14b2f01 Release regexp before signalling overflow error
* src/search.c (looking_at_1, search_buffer_re): Unfreeze the regexp
buffer before signalling a matcher overflow, since the error
processing may require quite some regexp use as well (Bug#34910).
2019-03-30 11:54:10 +01:00
Mattias Engdegård
75ec1b1952 Fix spurious regexp reentrancy error
* src/search.c (compile_pattern): Don't give up if the last regexp
cache entry is busy.  Instead, use the last (least recently used)
non-busy entry, and only signal a reentrancy error if there is no free
entry at all (Bug#34910).
2019-03-30 11:48:25 +01:00
Eli Zaretskii
9c0fa1172f Don't run buffer-related hooks in " *code conversion work*" buffers
Note: portions of this change were mistakenly pushed as part
of an unrelated commit a35a1f6a9.

* src/buffer.c (Fget_buffer_create): Set inhibit_buffer_hooks
non-zero for temporary buffers created by coding.c.  Don't run
buffer-list-update-hook for such buffers.
(Frename_buffer, Fkill_buffer, record_buffer)
(Fbury_buffer_internal): Don't run hooks for buffers whose
inhibit_buffer_hooks flag is set.
* src/buffer.h (struct buffer): New member
inhibit_buffer_hooks.
* src/pdumper.c (dump_buffer): Dump the new field.  Update the
hash value in HASH_buffer_XXX.
* src/coding.c (make_conversion_work_buffer): Function deleted;
code moved to code_conversion_save.
(code_conversion_save): Insert code from
make_conversion_work_buffer, but arrange for unwind-protecting
the current buffer before switching to the work buffer.  This
avoids leaving reused_workbuf_in_use set if user presses C-g
during encoding/decoding.
(Vcode_conversion_workbuf_name): Now external variable.
* src/coding.h (Vcode_conversion_reused_workbuf): Declare.
2019-03-30 12:01:58 +03:00
Eli Zaretskii
2da9f8bf42 Fix display of sliced images on MS-Windows
* src/w32term.c (x_draw_image_foreground): Fix detection of
scaled images for sliced images.  Scale the original width of
a slice and its coordinates of origin as well.
2019-03-28 18:00:06 +02:00
Paul Eggert
7f129f2ecf Simpler way to export HAVE_X_WINDOWS to GDB
* src/.gdbinit: Simplify by removing dependency on globals
implementation.  This is useful for a future performance
improvement that I have in mind.
* src/alloc.c (enum defined_HAVE_X_WINDOWS, defined_HAVE_X_WINDOWS):
New enum and constant.
(gdb_make_enums_visible) [__GNUC__]: Use it, to make
defined_HAVE_X_WINDOWS visible to GDB.
2019-03-27 21:51:57 -07:00
Paul Eggert
81795bb713 Tweak re_registers allocation
* src/regex-emacs.c (re_match_2_internal):
No need to allocate one extra trailing search register;
Emacs does not use it.  Avoid quadratic behavior on
reallocation.
2019-03-27 21:24:26 -07:00
Paul Eggert
eac5f967ca No need for m_search_regs_saved in thread.h
* src/search.c (save_search_regs, restore_search_regs):
Don’t use m_search_regs_saved; it’s equivalent to
saved_search_regs.num_regs != 0.
* src/thread.h (struct thread_state): Remove m_search_regs_saved.
2019-03-27 21:24:26 -07:00
Paul Eggert
361e88986f Fix search_regs memory leak when thread destroyed
* src/thread.c (free_search_regs): New function.
(finalize_one_thread): Use it.
2019-03-27 21:24:25 -07:00
Eli Zaretskii
a35a1f6a94 Attempt to fix crashes under GDB on Windows 10
* src/pdumper.c (dump_discard_mem)
[VM_SUPPORTED == VM_MS_WINDOWS]: Don't pass NULL pointer as
last argument to VirtualProtect.  Reported by Martin Rudalics
<rudalics@gmx.at>.
2019-03-27 20:34:22 +02:00
YAMAMOTO Mitsuharu
2755cf1848 Support native image resizing on cairo
* src/xterm.c (x_cr_draw_image): Add arguments image_width and
image_height and support scaling.  All callers changed.
* src/image.c (Fimage_scaling_p): Return t when USE_CAIRO.
(x_set_image_size) [USE_CAIRO]: Record the scaled dimensions
in the image struct.
* src/dispextern.h (HAVE_NATIVE_SCALING): Define when
USE_CAIRO as well.

* etc/NEWS: Update the announcement of native image scaling.
2019-03-27 11:12:18 +09:00
YAMAMOTO Mitsuharu
d7e4426517 Fix cairo image drawing with box
* src/xterm.c (x_cr_draw_image): Don't call cr_clip for non-mask case.
(x_draw_image_foreground) [USE_CAIRO]: Draw image here ...
(x_draw_image_glyph_string) [USE_CAIRO]: ... instead of here.
(x_draw_image_foreground, x_draw_image_foreground_1)
(x_draw_image_glyph_string) [USE_CAIRO]: Ifdef away unused code path.
2019-03-27 11:12:17 +09:00
YAMAMOTO Mitsuharu
ae68fad033 Use cairo image surface instead of pattern for fringe bitmap
* src/xterm.c (fringe_bmp, x_cr_define_fringe_bitmap)
(x_cr_destroy_fringe_bitmap, x_cr_draw_image) [USE_CAIRO]:
Change type of fringe bitmap.
2019-03-26 18:58:35 +09:00
YAMAMOTO Mitsuharu
9a6cba2bd3 Fix cairo scrolling for left scroll bars case
* src/xterm.c (x_scroll_run) [USE_CAIRO]: Fix scrolling by unusing
WINDOW_LEFT_EDGE_X.  (Bug#31288)
2019-03-26 16:39:07 +09:00
YAMAMOTO Mitsuharu
b40db491cb Support tool bar icon image on GTK+ >= 3.10 with cairo
* src/gtkutil.c (xg_get_image_for_pixmap) [USE_CAIRO]: Use cairo image
surface for GtkImage source.
(xg_tool_item_stale_p, update_frame_tool_bar) [USE_CAIRO]: Use cairo
image surface instead of pixmap for data associated with tool bar item.
2019-03-26 14:50:10 +09:00
YAMAMOTO Mitsuharu
75b7b2cf7c Simplify cairo image surface creation and destruction
* src/dispextern.h (struct image) [USE_CAIRO]: Remove member cr_data2.
* src/image.c (set_cairo_image_surface): New function split from
original create_cairo_image_surface.  Call cairo_surface_mark_dirty.
(create_cairo_image_surface): Just create image surface and return it.
(x_clear_image): Don't free cr_data2.
(xpm_load, pbm_load, png_load_body, jpeg_load_body, tiff_load)
(gif_load, imagemagick_load_image, svg_load_image) [USE_CAIRO]: Use
new create_cairo_image_surface and cairo_image_surface_get_data
instead of xmalloc.  Use set_cairo_image_surface instead of old
create_cairo_image_surface.
(pbm_load) [USE_CAIRO]: Call cairo_surface_destroy for surface instead
of xfree for data.
(gif_load) [USE_CAIRO]: Multiply y-coordinate value by width instead
of subimg_width.
2019-03-26 14:42:10 +09:00
Paul Eggert
7f967b1658 Port recent ngettext stub to non-glibc
* src/editfns.c: Don’t try to call glibc ngettext;
we’re not ready for that yet.
(Fngettext): Do not restrict integer arguments to fixnums.
Improve doc string a bit.
2019-03-25 15:20:59 -07:00
Paul Eggert
db53731c5f Fix alignment bug with pure bignums
Problem found on 32-bit sparc, which has stricter alignment
checking than x86-64.
* src/alloc.c (pure_alloc): When TYPE is negative it now specifies
the negation of the required alignment of the result.
(make_pure_bignum): Specify bignum limb alignment.
2019-03-25 14:34:44 -07:00
Juri Linkov
389475dbcc * lisp/international/mule-cmds.el (ngettext): Move to editfns.c.
* src/editfns.c (Fngettext): Move from mule-cmds.el and use
gettext's ngettext when available.
2019-03-25 23:32:09 +02:00
Paul Eggert
b7a9899378 Fix some integer issues in regex-emacs
Also, remove some duplicate comments related to thread.h.
* src/regex-emacs.h (struct re_registers):
* src/regex-emacs.c (SIGN_EXTEND_CHAR): Remove.
(TALLOC, RETALLOC): Remove.  All uses replaced by usual
allocators, which check for integer overflow.
(extract_number): Redo without using ‘unsigned’.
(CHARSET_RANGE_TABLE_EXISTS_P): Clearly return a boolean.
(print_fastmap, print_partial_compiled_pattern, CHECK_INFINITE_LOOP)
(regex_compile, analyze_first, bcmp_translate, mutually_exclusive_p)
(re_match_2_internal):
Use bool for booleans.
(print_fastmap, regex_compile, execute_charset):
Prefer int to unsigned where either will do.
(print_double_string): Prefer ptrdiff_t to ssize_t, since the
latter can in theory be narrower than the former.  Use fwrite
instead of repeated putchar.
(emacs_re_max_failures, fail_stack_type, compile_stack_type)
(re_wctype_parse, regex_compile, re_search, re_search_2)
(re_match_2, re_match_2_internal, re_compile_pattern):
Prefer ptrdiff_t to size_t where either will do.
(union fail_stack_elt, PUSH_FAILURE_REG, POP_FAILURE_REG_OR_COUNT):
Make the integer an intptr_t, not long.
(GET_BUFFER_SPACE, EXTEND_BUFFER, regex_compile):
Use xpalloc to simplify allocation.
(regex_compile): Check for integer overflow when calculating
register numbers.
* src/regex-emacs.c (re_set_registers, re_match_2_internal):
* src/regex-emacs.h (struct re_registers, struct re_pattern_buffer):
* src/search.c (Freplace_match):
Prefer ptrdiff_t to unsigned where either will do.
* src/regex-emacs.h (struct re_pattern_buffer):
Prefer bool_bf to unsigned where either will do.
2019-03-25 09:03:29 -07:00
Paul Eggert
176ababa8c * src/regex-emacs.c (regex_compile): Fix comments. 2019-03-25 09:03:29 -07:00
Paul Eggert
d2a9273c77 * src/lisp.h (primary_thread): Remove unused decl. 2019-03-24 08:26:24 -07:00
Eli Zaretskii
dbd6490ad4 * src/Makefile.in ($(AM_V_GEN)POSIXLY_CORRECT): Use AM_V_GEN. 2019-03-23 11:47:49 +02:00
Eli Zaretskii
86c3cd99bf Avoid compiler warning in w32proc.c
* src/w32proc.c (w32_executable_type): Avoid compiler warnings
about potential NULL pointer dereferencing.
2019-03-23 10:31:06 +02:00
Eli Zaretskii
09d746dad3 Revert "Revert "Revert "Rely on conservative stack scanning to find "emacs_value"s"""
This reverts commit 093d3e78d2,
which reverted ee7ad83f20,
which reverted 3eb93c07f7.
2019-03-22 11:02:46 +03:00
Stefan Monnier
76fea1eba1 Fix misuses of NULL when talking about the NUL character
* lisp/subr.el (inhibit-null-byte-detection): Make it an obsolete alias.

* src/coding.c (setup_coding_system): Use new name.
(detect_coding): Rename null_byte_found => nul_byte_found.
(detect_coding_system): Use new name.
Rename null_byte_found => nul_byte_found.
(Fdefine_coding_system_internal): Use new name.
(syms_of_coding): Rename inhibit-null-byte-detection to
inhibit-nul-byte-detection.
* src/w16select.c (get_clipboard_data): null_char => nul_char.
* src/json.c (check_string_without_embedded_nuls): Rename from
check_string_without_embedded_nulls.
(Fjson_parse_string): Adjust accordingly.
* src/coding.h (enum define_coding_undecided_arg_index)
(enum coding_attr_index): ...null_byte... => ...nul_byte....
* lisp/info.el (info-insert-file-contents, Info-insert-dir):
* lisp/international/mule.el (define-coding-system):
* lisp/vc/vc-git.el (vc-git--call):
* doc/lispref/nonascii.texi (Lisp and Coding Systems): Use the new name.
2019-03-21 23:55:28 -04:00
Eli Zaretskii
093d3e78d2 Revert "Revert "Rely on conservative stack scanning to find "emacs_value"s""
This reverts commit ee7ad83f20.

There was no consensus on reverting
3eb93c07f7, so doing that will have to
wait until the discussion ends.
2019-03-21 21:29:52 +02:00
Philipp Stephani
ee7ad83f20 Revert "Rely on conservative stack scanning to find "emacs_value"s"
This reverts commit 3eb93c07f7.

There was no consensus for that commit, see
https://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00150.html.
Also, reverting this commit should fix Bug#31238.
2019-03-21 20:10:27 +01:00
Eli Zaretskii
107215596c Avoid duplicate entries in process-environment after re-dumping
* src/pdumper.c (Fdump_emacs_portable): Reset
process-environment to nil.  (Bug#34936)
2019-03-21 17:55:16 +02:00
Glenn Morris
1fc6afbdf1 Merge from origin/emacs-26
24b6e6e (origin/emacs-26) * etc/AUTHORS: Update.
2f22a17 * ; ChangeLog.3 update
0f523de Improve indexing of the user manual
bd5795e Fix url-copy-file arglist
eaa188a ; * admin/notes/bugtracker: Minor additions and updates.
5ed05fb Fix downloading updates for packages with non-ASCII descriptions
e9f2d1f * etc/NEWS: Remove temporary markers.
24fc133 * doc/misc/cc-mode.texi (Config Basics): in @itemize, @asis -...
0f325d1 Don't clobber 'comint-input-autoexpand' in 'read-shell-command'
bc75589 Document restrictions when setting window margins, fringes or...
cc4cebf More improvements for 'read-buffer's doc string
d026d9a * lisp/progmodes/cc-defs.el: Update c-version to 5.33.2 for E...
5dbf08b * src/minibuf.c (Fread_buffer): Minor doc fixes.  (Bug#34749)

# Conflicts:
#	etc/NEWS
#	lisp/url/url-handlers.el
2019-03-20 13:47:07 -07:00