1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-16 00:01:05 -08:00
Commit graph

39790 commits

Author SHA1 Message Date
Paul Eggert
e13bdfee17 Make garbage collection more conservative
Check for a pointer anywhere within the object, as opposed to just
the start of the object.  This is needed for gcc -Os -flto on
x86-64 (Bug#28213).  This change means that the garbage collector
is more conservative, and will incorrectly keep objects that it
does not need to, but that is better than incorrectly discarding
objects that should be kept.
* src/alloc.c (ADVANCE, VINDEX): Now functions, not macros;
this is easier to debug.
(setup_on_free_list): Rename from SETUP_ON_FREE_LIST.
Now a function with two args, not a macro with three.
All callers changed.
(live_string_holding, live_cons_holding, live_symbol_holding)
(live_misc_holding, live_vector_holding, live_buffer_holding):
New functions, which check for any object containing the addressed
byte, not just for an object at the given address.
(live_string_p, live_cons_p, live_symbol_p, live_misc_p)
(live_vector_p, live_buffer_p):
Redefine in terms of the new functions.
(live_float_p): Refactor slightly to match the new functions.
(mark_maybe_object, mark_maybe_pointer): Use the new functions.
Don’t bother checking mark bits, as mark_object already does that,
and omitting the checks here simplifies the code.  Although
mark_maybe_object can continue to insist that tagged pointers
still address the start of the object, mark_maybe_pointer now is
more conservative and checks for pointers anywhere into an object.
2017-08-29 14:58:49 -07:00
Paul Eggert
9baeed3514 Improve stack-top heuristic
This is needed for gcc -Os -flto on x86-64; otherwise, GC misses part
of the stack when scanning for heap roots, causing Emacs to crash
later (Bug#28213).  The problem is that Emacs's hack for getting an
address near the stack top does not work when link-time optimization
moves stack variables around.
* configure.ac (HAVE___BUILTIN_FRAME_ADDRESS): New macro.
* lib-src/make-docfile.c (DEFUN_noinline): New constant.
(write_globals, scan_c_stream): Support noinline.
* src/alloc.c (NEAR_STACK_TOP): New macro.
(SET_STACK_TOP_ADDRESS): Use it.
(flush_stack_call_func, Fgarbage_collect): Now noinline.
2017-08-29 14:58:49 -07:00
Paul Eggert
f1fdb5bc57 Align stack bottom properly.
This is needed for gcc -Os -flto on x86-64 (Bug#28213).
* src/emacs.c (main): Align stack-bottom variable as a pointer,
since mark_memory requires this.
2017-08-29 14:58:48 -07:00
Eli Zaretskii
02255c5fbc Avoid spinning waiting for git-gui.exe on Windows
* src/w32proc.c (waitpid): If GetExitCodeProcess returns
STILL_ACTIVE, and we were called with WNOHANG, pretend that the
process exited.  (Bug#28268)
2017-08-29 21:53:49 +03:00
Alan Third
fdde98113c Fix cross macOS version building (bug#28222)
* src/macfont.h (CGContextSetFontSmoothingStyle): Function
declaration.
* src/macfont.m (macfont_draw): Limit new code to macOS 10.8 and up.
2017-08-29 17:19:05 +01:00
Ben Bonfil
1b0d72244d Enable thin font smoothing in macOS (bug#28222)
* src/nsterm.m (syms_of_nsterm): Define var ns-use-thin-smoothing.
* src/macfont.m (macfont_draw): Use font smoothing.

Copyright-paperwork-exempt: yes
2017-08-29 17:19:04 +01:00
Eli Zaretskii
bf0045d7a4 Avoid aborting in 'waitpid' on MS-Windows
* src/w32proc.c (waitpid): Don't allow quitting if called with
WNOHANG in OPTIONS.  (Bug#28268)
2017-08-29 18:13:44 +03:00
Paul Eggert
7b8699759f Simplify remove_slash_colon
* src/process.c (remove_slash_colon): Simplify
and avoid a special case for "/:" by itself.
2017-08-28 21:51:38 -07:00
Paul Eggert
b93a5f197e Don’t assume -g3 in .gdbinit
* src/.gdbinit (EMACS_INT_WIDTH, USE_LSB_TAG):
Use reasonable defaults if not in the symbol table.
2017-08-28 08:38:29 -07:00
Glenn Morris
c99507645a Fix previous xterm.h change for non-gtk builds
* src/xterm.h (GTK_CHECK_VERSION) [!USE_GTK]: Define it.
2017-08-27 10:06:30 -07:00
Philipp Stephani
853ed4533b Fix GdkSettings-related deprecation warnings
* src/gtkutil.c (xg_initialize): Don’t set deprecated and ignored
gtk-menu-bar-accel setting in new versions of GTK+.  Use g_object_set
instead of deprecated gtk_settngs_set_string_property otherwise.
2017-08-27 15:00:18 +02:00
Philipp Stephani
fe49aa17d5 Always use gtk_window_move in new versions
* src/gtkutil.c (my_log_handler): Don’t define in new versions of
GTK+.
(xg_set_geometry): Always use gtk_window_move in new versions of GTK+.

* src/xterm.c (syms_of_xterm): Document that x-gtk-use-window-move
is ignored.

* lisp/subr.el (x-gtk-use-window-move): Make obsolete.
2017-08-27 14:45:58 +02:00
Philipp Stephani
d309ce4299 Remove use of a deprecated GTK+ function in new versions
* src/gtkutil.c (xg_make_tool_item): Use gtk_widget_set_focus_on_click
if available
2017-08-27 14:09:36 +02:00
Philipp Stephani
2132629573 Stop using deprecated GdkScreen monitor functions in newer GDK
* src/xfns.c (Fx_display_monitor_attributes_list): Use GdkMonitor
objects instead of the deprecated GdkScreen functions in GDK 3.22+
2017-08-27 14:05:40 +02:00
Philipp Stephani
7cb3d3bba1 Use GdkSeat in new GDK versions
* src/gtkutil.c (xg_event_is_for_scrollbar): Use GdkSeat instead of
GdkDeviceManager in GDK 3.20+
2017-08-27 13:53:36 +02:00
Philipp Stephani
982ec0398c * src/xterm.c (XTflash): Don’t use gdk_cairo_create in GDK 3.22+ 2017-08-27 13:44:47 +02:00
Philipp Stephani
a1faaf3092 Remove call of deprecated GDK function
* src/xterm.h (XSync): Don’t call gdk_window_process_all_updates in
GDK 3.22 or later.
2017-08-27 13:27:02 +02:00
Paul Eggert
e8001d4c27 Do not munge contents of local symbolic links
This lets Emacs deal with arbitrary local symlinks without
mishandling their contents (Bug#28156).  For example,
(progn (shell-command "ln -fs '~' 'x'") (rename-file "x" "/tmp/x"))
now consistently creates a symbolic link from '/tmp/x' to '~'.
Formerly, it did that only if the working directory was on the
same filesystem as /tmp; otherwise, it expanded the '~' to
the user's home directory.
* lisp/dired.el (dired-get-filename): Use files--name-absolute-system-p
instead of rolling our own code.
* lisp/files.el (files--name-absolute-system-p): New function.
(file-truename, file-chase-links): Use it to avoid mishandling
symlink contents that begin with ~.
(copy-directory, move-file-to-trash):
Use concat rather than expand-file-name, to avoid mishandling
symlink contents that begin with ~.
* src/fileio.c (Fmake_symbolic_link): Do not expand leading "~" in the
target unless interactive.  Strip leading "/:" if interactive.
(emacs_readlinkat): Do not prepend "/:" to the link target if
it starts with "/" and contains ":" before NUL.
* test/src/fileio-tests.el (try-link): Rename from try-char,
and accept a string instead of a char.  All uses changed.
(fileio-tests--symlink-failure): Also test leading ~, and "/:",
to test the new behavior.
2017-08-26 18:36:38 -07:00
Paul Eggert
0becd64d63 Improve doc for file-name-absolute-p. 2017-08-26 13:45:25 -07:00
Paul Eggert
2b7e009257 Fix file-attributes race on GNU hosts
* doc/lispref/files.texi (File Attributes):
Document file-attributes atomicity.
* etc/NEWS: Document the fix.
* src/dired.c (file_attributes): New args DIRNAME and FILENAME,
for diagnostics.  All callers changed.  On platforms like
GNU/Linux that support O_PATH, fix a race condition in
file-attributes and similar functions, so that these functions do
not return nonsense if a directory entry is replaced while getting
its attributes.  On non-GNU platforms, do a better (though not
perfect) job of detecting the race, and return nil if detected.
2017-08-25 13:19:45 -07:00
Paul Eggert
9a223dab90 Simplify expand_and_dir_to_file
* src/fileio.c (expand_and_dir_to_file): Simplify by omitting 2nd
argument, since in practice it always has the default value.  All
callers changed.  Prefer C99 style decls in nearby code.
2017-08-25 09:32:09 -07:00
Eli Zaretskii
579890f1c7 ; * src/w32.c (faccessat): Fix last change. (Bug#28207) 2017-08-25 18:01:19 +03:00
Eli Zaretskii
0d2b409398 Fix file-name completion on network shares
* src/w32.c (faccessat): Don't assume that F_OK is non-zero.
(Bug#28207)
2017-08-25 17:43:15 +03:00
Paul Eggert
daf434b40d Prefer ‘double’ for FP temps in xterm.c
* src/xterm.c (xm_scroll_callback, xaw_jump_callback)
(x_set_toolkit_scroll_bar_thumb)
(x_set_toolkit_horizontal_scroll_bar_thumb): Prefer ‘double’ to
‘float’ for individual local floating-point temporaries.
2017-08-24 16:17:39 -07:00
Michael Albinus
0332a0ef2b Minor improvements for tramp-interrupt-process, documentation
* doc/lispref/processes.texi (Signals to Processes):
* etc/NEWS: Document interrupt-process-functions.

* lisp/net/tramp.el (tramp-interrupt-process): Test also for
`process-live-p'.

* src/process.c (Vinterrupt_process_functions): Fix docstring.

* test/lisp/net/tramp-tests.el (tramp-test28-interrupt-process):
Extend test.
2017-08-24 15:53:56 +02:00
Reuben Thomas
fa5e63e404 Fix a comment whitespace typo.
src/fileio.c: A double space was added after "..", used in a code
example. Make it a single space.
2017-08-23 23:52:24 +01:00
Alan Third
9538ba6a0f Use lisp type in log message (bug#28176)
* src/nsimage.m (ns_load_image): Use make_number on index.
2017-08-23 21:13:22 +01:00
Alan Third
95130f192b Fix PNGs on macOS (bug#28176)
* src/nsimage.m (ns_load_image): Remove index check.
(EmacsImage::getAnimatedBitmapImageRep): New function.
(EmacsImage::getMetadata): Use getAnimatedBitmapImageRep.
(EmacsImage::setFrame): Use getAnimatedBitmapImageRep and check index
is valid.
2017-08-23 19:57:00 +01:00
Alan Third
7baa50eca2 Add ability to change macOS WM theme (bug#27973)
* src/frame.c (make_frame, frame_parms, syms_of_frame)
[NS_IMPL_COCOA]: Add ns-appearance and ns-transparent-titlebar
options.
* src/frame.h (ns_appearance_type) [NS_IMPL_COCOA]: Add enum to
represent NSAppearance options.
(struct frame) [NS_IMPL_COCOA]: Add ns_appearance and
ns_transparent_titlebar frame parameters.
* src/nsfns.m (ns_frame_parm_handlers) [NS_IMPL_COCOA]: Add
ns_set_appearance and ns_set_transparent_titlebar handlers.
(Sx_create_frame): Handle ns-appearance and ns-transparent-titlebar
frame parameters.
(Qdark): Add new symbol for use with ns-appearance.
* src/nsterm.h (ns_set_appearance, ns_set_transparent_titlebar)
[NS_IMPL_COCOA]: Add prototypes.
* src/nsterm.m (ns_set_appearance, ns_set_transparent_titlebar)
[NS_IMPL_COCOA]: New functions.
(initFrameFromEmacs) [NS_IMPL_COCOA]: Handle ns-appearance and
ns-transparent-titlebar frame parameters.
* doc/lispref/frames.texi (Window Management Parameters): Document
ns-apperance and ns-transparent-titlebar.
2017-08-23 19:57:00 +01:00
Eli Zaretskii
ee5a146e33 ; * src/w32.c: Fix a typo in a comment. 2017-08-22 19:52:47 +03:00
Eli Zaretskii
80fccd4290 Avoid losing the buffer restriction in flyspell-mode
* src/intervals.c (get_local_map): Don't allow C-g to quit as long
as we have the buffer widened, to make sure the restriction is
preserved.  (Bug#28161)
2017-08-21 20:21:28 +03:00
Sven Joachim
694e2d8f23 Fix the 'versionclean' target in src/Makefile
* src/Makefile.in (versionclean): Don't accidentally remove
emacs-module.h.  (Bug#28169)
2017-08-21 19:28:55 +03:00
Michael Albinus
01844e40dc Implement `interrupt-process-functions'
* lisp/net/tramp.el (tramp-interrupt-process): Rename from
`tramp-advice-interrupt-process'.  Adapt according to changed API.
(top): Add it to `interrupt-process-functions'.

* src/process.c (Finternal_default_interrupt_process): New defun.
(Finterrupt_process): Change implementation, based on
Vinterrupt_process_functions.
(Vinterrupt_process_functions): New defvar.

* test/lisp/net/tramp-tests.el (tramp-test40-unload): Do not
test removal of advice.
2017-08-21 17:30:33 +02:00
Eli Zaretskii
76fbe2f454 Avoid floating-point exceptions while drawing underwave
* src/w32term.c (x_get_scale_factor):
* src/xterm.c (x_get_scale_factor): Don't let the scale factors
become less than 1.  Reported by Yuri D'Elia <wavexx@thregr.org> in
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00459.html.
2017-08-21 17:46:42 +03:00
Paul Eggert
6763399ef3 Fix recently-introduced file descriptor leak
* src/fileio.c (Fmake_temp_file_internal):
Don’t leak a file descriptor if write_region signals an error.
2017-08-18 23:52:52 -07:00
Paul Eggert
e73691e1a4 Improve make-temp-file performance on local files
* lisp/files.el (make-temp-file): Let make-temp-file-internal do
the work of inserting the text.
* src/fileio.c (Fmake_temp_file_internal): New arg TEXT.
All callers changed.
2017-08-18 20:37:31 -07:00
Eli Zaretskii
a1ed97e510 Implement HiDPI support for underwave on MS-Windows
* src/w32term.c (x_get_scale_factor): New function.
(w32_draw_underwave): Use it.
* src/xterm.c (x_draw_underwave): Offset the wave starting point
to make it identical with original code.
2017-08-18 11:32:10 +03:00
Stephen Pegoraro
efb508bbb4 Support HiDPI displays for wave style underlines
* src/xterm.c (x_draw_underwave): Compute height, length and thickness
based on scale factor.
(x_get_scale_factor): New function.

Copyright-paperwork-exempt: yes
2017-08-18 11:02:40 +03:00
Eli Zaretskii
61631476d7 Support Posix semantics of 'rename' on MS-Windows
* src/w32.c (sys_rename_replace): Support Posix semantics of
'rename': return an error if OLD is a directory while NEW is not,
or vice versa.
2017-08-17 19:48:49 +03:00
Eli Zaretskii
7791bca1c5 * src/w32.c (sys_rename_replace): Support renaming a directory. 2017-08-17 17:58:08 +03:00
Paul Eggert
794c3cd3a2 Merge from Gnulib; use ‘open’ for O_CLOEXEC
This incorporates:
2017-08-15 renameat: ensure declaration in <stdio.h> on NetBSD
2017-08-15 extensions: enable NetBSD specific extensions
2017-08-14 open: support O_CLOEXEC
2017-08-13 reallocarray: new module
* admin/merge-gnulib (AVOIDED_MODULES): Remove ‘open’, since
it now supports O_CLOEXEC and this simplifies Emacs.
* build-aux/config.guess, lib/fcntl.in.h, lib/stdio.in.h:
* lib/stdlib.in.h, m4/extensions.m4, m4/stdlib_h.m4:
Copy from Gnulib.
* lib/cloexec.c, lib/cloexec.h, lib/open.c:
* m4/mode_t.m4, m4/open-cloexec.m4, m4/open.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]:
Remove, as Gnulib does this for us.
* src/filelock.c (create_lock_file):
* src/sysdep.c (emacs_open, emacs_pipe):
Don’t worry about O_CLOEXEC == 0, as Gnulib no longer sets it to 0.
2017-08-16 14:04:33 -07:00
Alan Third
69f2b755f4 Allow use of run-time OS version checks on macOS (bug#27810)
* src/nsterm.h (NSWindowTabbingMode): Define in pre-Sierra macOS.
(MAC_OS_X_VERSION_10_6, MAC_OS_X_VERSION_10_7, MAC_OS_X_VERSION_10_8,
MAC_OS_X_VERSION_10_9, MAC_OS_X_VERSION_10_12, HAVE_NATIVE_FS): Remove
defines.
(NSWindowStyleMaskFullScreen,
NSWindowCollectionBehaviorFullScreenPrimary,
NSApplicationPresentationFullScreen,
NSApplicationPresentationAutoHideToolbar): Define in macOS 10.6.
* src/nsterm.m (colorForEmacsRed, colorUsingDefaultColorSpace,
check_native_fs, ns_read_socket, ns_select, runAlertPanel,
initFrameFromEmacs, windowDidMiniaturize, windowDidEnterFullScreen,
windowDidExitFullScreen, isFullscreen, updateCollectionBehavior,
toggleFullScreen, constrainFrameRect, scrollerWidth, syms_of_nsterm):
Allow use of run-time checks and replace version check macros.
* src/nsfns.m (ns_screen_name): Use run-time OS version checks.
* src/macfont.m (macfont_draw): Use run-time OS version checks.
* src/nsmenu.m (menuWillOpen): Use run-time OS version checks.

Co-authored-by: Charles A. Roelli <charles@aurox.ch>
2017-08-16 20:56:55 +01:00
Alan Third
3505b77ad7 Add multiframe image support to NS port (bug#21714)
* src/nsimage.m (ns_load_image): Handle multiple frames.
(EmacsImage::getMetadata, EmacsImage::setFrame): New functions.
* src/nsterm.h (EmacsImage::getMetadata, EmacsImage::setFrame): New
function prototypes.
2017-08-16 20:56:55 +01:00
Eli Zaretskii
63daecda01 Fix the MS-Windows build
* src/fileio.c (Frename_file): Don't use ENOTSUP if it is equal to
ENOSYS.  (Bug#28097)  (Bug#27986)
2017-08-15 19:17:41 +03:00
Paul Eggert
97460582e2 Improve rename-file port to macOS
* src/fileio.c (Frename_file): On macOS, renameat_noreplace can
fail with errno == ENOTSUP on file systems where it is not
supported, according to the Apple documentation.
2017-08-14 18:16:23 -07:00
Paul Eggert
13a846823a Improve rename-file behavior on macOS
Problem reported by Philipp Stephani (Bug#27986).
* src/fileio.c (Frename_file):
Worry about file name case sensitivity only if CYGWIN or DOS_NT.
* src/sysdep.c (renameat_noreplace): Use renameatx_np on macOS,
since this provides the necessary atomicity guarantees.
2017-08-14 15:53:28 -07:00
Eli Zaretskii
5ba4c7d16b Implement renameat_noreplace for MS-Windows
* src/sysdep.c (renameat_noreplace) [WINDOWSNT]: Implement minimal
emulation for MS-Windows.  (Bug#27986)
2017-08-14 19:31:12 +03:00
Eli Zaretskii
16f11be4b9 Fix 'rename' on MS-Windows
* src/w32.c (sys_rename_replace): Use the FORCE argument only if
the primitive rename errors out with EEXIST.
2017-08-14 19:17:22 +03:00
Eli Zaretskii
28a5b8adcc Fix vertical cursor motion across too wide images
* src/indent.c (Fvertical_motion): If lines are truncated and we
end up beyond the right margin of the window, don't assume we are
in the next screen line, unless VPOS actually says so.  (Bug#28071)
2017-08-13 17:49:07 +03:00
Paul Eggert
ebf53ed4f6 Fix make-temp-file bug with ""/"."/".." prefix
The bug with "." and ".." has been present for a while; I
introduced the bug with "" earlier today in my patch for Bug#28023.
* lisp/files.el (make-temp-file): Do not use expand-file-name if
PREFIX is empty or "." or "..", as it does the wrong thing.
Compute absolute-prefix here ...
(files--make-magic-temp-file): ... instead of here ...
* src/fileio.c (Fmake_temp_file_internal): ... or here.

* lisp/files.el (make-temp-file): If the prefix is empty, append
"/" to the absolute prefix so that the new files are children
rather than siblings of temporary-file-directory.  This fixes a
bug introduced in the previous change.
* test/lisp/files-tests.el (files-test-make-temp-file-empty-prefix):
New test, for the bug.
2017-08-12 20:05:23 -07:00