1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-20 19:42:53 -08:00
Commit graph

46009 commits

Author SHA1 Message Date
Po Lu
ec025f22ef Handle bad actual actions during DND
* src/xterm.c (x_dnd_begin_drag_and_drop): Behave correctly when
the target gives us a bad atom.
2022-04-17 21:25:25 +08:00
Lars Ingebrigtsen
b38c3fe863 Check whether we can restart in Fkill_emacs
* src/emacs.c (Fkill_emacs): Report an error if we can't restart.
2022-04-17 15:00:00 +02:00
Lars Ingebrigtsen
2136db067f Add new function `flush-standard-output'.
* doc/lispref/streams.texi (Output Functions): Document it.
* src/print.c (Fflush_standard_output): New function (bug#15180).
2022-04-17 14:06:25 +02:00
Lars Ingebrigtsen
5be9a9cacf Add a new command `restart-emacs'
* doc/lispref/os.texi (Killing Emacs): Document it.

* lisp/files.el (save-buffers-kill-emacs): Add new RESTART parameter.
(restart-emacs): New function.

* src/emacs.c (terminate_due_to_signal, Fkill_emacs): Take an
optional RESTART parameter.

* test/lisp/files-tests.el
(files-tests-save-buffers-kill-emacs--confirm-kill-processes):
* src/xterm.c (x_connection_closed):
* src/xsmfns.c (Fhandle_save_session):
* src/keyboard.c (Fcommand_error_default_function, command_loop)
(command_loop_1, read_menu_command, read_event_from_main_queue)
(read_key_sequence, quit_throw_to_read_char):
* src/eval.c (process_quit_flag): Adjust Fkill_emacs callers.
2022-04-17 13:37:51 +02:00
Paul Eggert
0353c6fd08 * src/filelock.c (Fcreate_lockfiles): Doc string fix. 2022-04-17 01:50:59 -07:00
Paul Eggert
ff7bc01830 Merge from origin/emacs-28
4641bc1c55 Fix GC bug in filelock.c
2022-04-17 01:44:30 -07:00
Po Lu
5bc3ed492b Fix race conditions waiting for menu bar resize events on Haiku
* src/haikufns.c (haiku_create_frame, haiku_create_tip_frame):
Clear `wait_for_event_type'.
(haiku_set_menu_bar_lines): Clean up coding style.
* src/haikuterm.c (haiku_wait_for_event): New function.
(haiku_read_socket): Implement waiting for MENU_BAR_RESIZE
events.
* src/haikuterm.h (struct haiku_output): New field
`wait_for_event_type'.
2022-04-17 08:14:06 +00:00
Po Lu
9a7430ce84 Fix race conditions waiting for menu bar resize events on Haiku
* src/haikufns.c (haiku_create_frame, haiku_create_tip_frame)
(haiku_set_menu_bar_lines): Clear `wait_for_event_type'.
* src/haikumenu.c (set_frame_menubar): Wait for menu bar resize
event.
* src/haikuterm.c (haiku_wait_for_event): New function.
(haiku_read_socket): Handle waiting for MENU_BAR_RESIZE.
* src/haikuterm.h (struct haiku_output): New field
`wait_for_event_type'.
2022-04-17 08:14:06 +00:00
Po Lu
38d72d8d88 Get rid of unused flags on Haiku
* src/haikufns.c (haiku_free_frame_resources): Syntax fixes.
* src/haikumenu.c (set_frame_menubar, run_menu_bar_help_event):
* src/haikuterm.c (haiku_read_socket): Stop setting and
consulting `menu_up_to_date_p'.
* src/haikuterm.h (struct haiku_output): Delete
`menu_up_to_date_p'.
2022-04-17 08:14:06 +00:00
Po Lu
5a18cd8821 * src/haikufns.c (haiku_free_frame_resources): Free saved menu event. 2022-04-17 08:14:05 +00:00
Po Lu
e8b0808e20 Fix hangs when clicking on Haiku menu bar to activate frame
* src/haiku_io.c (haiku_len): Handle new event `MENU_BAR_CLICK'.
* src/haiku_support.cc (class EmacsWindow): Remove most of the
menu bar cv stuff.
(MessageReceived): Handle REPLAY_MENU_BAR message.
(EmacsWindow_signal_menu_update_complete): Delete function.
(be_replay_menu_bar_event): New function.

* src/haiku_support.h (enum haiku_event_type): New event type
`MENU_BAR_CLICK'.
(struct haiku_menu_bar_click_event): New struct.

* src/haikumenu.c (haiku_activate_menubar): New function.
* src/haikuterm.c (haiku_read_socket): Save a
MENU_BAR_ACTIVATE_EVENT and the menu bar click event instead of
handling the menu bar update synchronously.
(haiku_create_terminal): Set `activate_menubar_hook'.
(syms_of_haikuterm): Remove extraneous newline.

* src/haikuterm.h (struct haiku_output): New field
`saved_menu_event'.
2022-04-17 08:14:05 +00:00
Paul Eggert
4641bc1c55 Fix GC bug in filelock.c
Fix a bug where if GC occurred at the wrong moment when locking a
file, the lock file’s name was trashed so file locking did not work.
This bug was introduced in Emacs 28.1.  The bug sometimes caused
filelock-tests-detect-external-change test failures on Fedora 35
x86-64 in an en_US.utf8 locale.
* src/filelock.c (lock_file_1, current_lock_owner, lock_if_free)
(lock_file, unlock_file, Ffile_locked_p):
Use Lisp_Object, not char *, for string, so that GC doesn’t trash
string contents.
(make_lock_file_name): Return the encoded name, not the original.
All callers changed.
2022-04-17 01:08:21 -07:00
Po Lu
265f4ef702 Make sure the ftcr font driver is used on Haiku when Cairo is enabled
* src/haikufont.c (syms_of_haikufont): [USE_BE_CAIRO]: Make sure
`ftcr' superseeds `haiku'.
2022-04-17 04:07:07 +00:00
Paul Eggert
f1ba92448d Document encode-time caveats
* doc/lispref/os.texi (Time of Day, Time Conversion):
Move the warnings about DST being -1 to closer to where DST is
discussed, and reword and improve the discussions and warnings.
Be more precise about years before 1969 (possible west of UTC) vs the
Epoch.  Mention some problems due to leap seconds, leap years,
daylight saving transitions, and time zone changes.  Modernize
discussion of OS timestamp range.  Prefer secular ‘BCE’ to religious
‘BC’.  Omit discussion of decoded-time-add and make-decoded-time, as
they are in a library and are not always available; instead, mention
the library.  Warn about common mistakes when doing simple date
arithmetic.
* src/timefns.c (Fencode_time): In doc string, mention date
arithmetic and tighten up the wording a bit.
2022-04-16 18:54:31 -07:00
Max Nikulin
15a5cf9a9a Stress difference of new and old ways to call `encode-time'
* doc/lispref/os.texi (Time Conversion): Add a warning that blind
changing of code calling `encode-time' to use single list instead of
multiple values may cause deferred bugs since it is common to use nil
for ignored arguments such as DST in the old calling convention.
* src/timefns.c (encode-time): Mention the warning added to the elisp
reference in the docstring.

Refactoring related to `encode-time' caused (bug#54731), so it is better
to make apparent the difference between the recommended and the
obsolescent ways to call the function.  More details concerning the
purpose and limitations of the DST field are added after discussion with
Paul Eggert in (bug#54764).
2022-04-16 18:54:30 -07:00
Po Lu
18ec3fcce9 Restore pending_signals at a point in the DND event loop
* src/xterm.c (x_dnd_begin_drag_and_drop): Restore
pending_signals after unblock_input.
2022-04-17 08:38:37 +08:00
Eli Zaretskii
44ba0270b7 Merge from origin/emacs-28
d53c999b4a Further vcs-cvs/rcs-responsible-p updates from master
dc3d1628ec ; * src/sysdep.c: Fix mistake in previous commit
855e15dbf1 Fix builds on older versions of macOS
9da744e450 Fix documentation of Outline minor mode options
a8bb12ab05 Improve discoverability of 'insert-directory-program'
3f166bdf44 ; * etc/PROBLEMS: Describe MS-Windows issues with fonts.  ...
803ac857ee Fix cursor motion under truncate-lines with Flymake fringe...

# Conflicts:
#	etc/PROBLEMS
#	lisp/outline.el
#	src/sysdep.c
2022-04-16 13:58:31 -04:00
Eli Zaretskii
8804dfdb1a Merge from origin/emacs-28
5e47d6284b * lisp/gnus/mm-encode.el (mm-default-file-encoding): Fix "...
e71c7a7c60 Fix default-directory of buffers visiting files in renamed...
cccaa9c31d Fix a kill-append regression
33828e4818 * doc/misc/eww.texi (Advanced): Correct outdated info (bug...
e8d2f40f41 Clean up the MSDOS port
338eda09d8 Fix typo in next-error-find-buffer-function

# Conflicts:
#	doc/misc/eww.texi
2022-04-16 13:45:50 -04:00
Eli Zaretskii
5890b80bca Merge from origin/emacs-28
84a2857722 Fix scrolling of the stack window in Calc
9dd44505b1 ; * src/window.c (Fset_window_start): Clarify the effect o...
24a6c7c8c0 Update and fix instructions and scripts for updating the W...
886339747b Extend tramp-archive-test45-auto-load
ff997ad786 Ensure local `default-directory' in Tramp when needed
4f27588a16 Clarify "idleness" in the ELisp manual
2022-04-16 13:43:33 -04:00
Po Lu
5ad6a08a2e Prevent race conditions with async input during drag-and-drop
* src/xterm.c (XTread_socket): Don't read events here during
drag-and-drop, otherwise the right hold_quit might not be used
for selection events.
2022-04-16 19:12:56 +08:00
Mattias Engdegård
6815db492f Fix builds on older versions of macOS
This adds back macOS-specific code replaced earlier (bug#48548),
specifically to fix build errors on macOS 10.7.5.  See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg00779.html .

* src/sysdep.c (HAVE_RUSAGE_INFO_CURRENT, HAVE_PROC_PIDINFO): New.
(system_process_attributes): Use alternative code or exclude features
when building on older macOS versions.

(cherry picked from commit 855e15dbf1)
2022-04-16 12:25:39 +02:00
Mattias Engdegård
dc3d1628ec ; * src/sysdep.c: Fix mistake in previous commit 2022-04-16 12:16:45 +02:00
Mattias Engdegård
855e15dbf1 Fix builds on older versions of macOS
This adds back macOS-specific code replaced earlier (bug#48548),
specifically to fix build errors on macOS 10.7.5.  See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg00779.html .

* src/sysdep.c (HAVE_RUSAGE_INFO_CURRENT, HAVE_PROC_PIDINFO): New.
(system_process_attributes): Use alternative code or exclude features
when building on older macOS versions.
2022-04-16 11:33:14 +02:00
Po Lu
625d6da5ba Fix build with toolkit scroll bars without XI2
* src/xterm.c (mark_xterm): Fix up ifdefs slightly.
2022-04-16 17:13:43 +08:00
Po Lu
760107639b Protect windows from garbage collection when a ClientMessage is pending
* src/xterm.c (x_protect_window_for_callback)
(x_unprotect_window_for_callback): New functions.
(x_send_scroll_bar_event): Protect windows from garbage
collection before sending event containing pointer to window.
(handle_one_xevent): Unprotect after such a ClientMessage is
received and the window put in the keyboard buffer.
(x_term_init): Initialize protected windows list.
(x_delete_display): Free that list.
(mark_xterm): Mark the windows in that list.
* src/xterm.h (struct x_display_info): New fields for recording
a list of protected windows.
2022-04-16 16:50:02 +08:00
Po Lu
c5c6d5cf1c Add some missing multilingual keys to Haiku
* src/haiku_support.cc (keysym_from_raw_char): Support keys
found on some East Asian keyboards.
2022-04-16 04:04:25 +00:00
Po Lu
1fed6e7b56 Handle errors getting selection ownership when starting DND
* src/xterm.c (x_clear_dnd_targets): New function.
(x_dnd_begin_drag_and_drop): Handle errors in `x_own_selection'.
2022-04-16 08:54:40 +08:00
Po Lu
dfee279054 Fix default registry of Haiku font backend
* src/haiku_support.h (struct haiku_zoom_event): Fix coding
style.
(enum haiku_font_specification): Move FSPECs over here.
* src/haikufont.c (haikufont_apply_registry)
(haikufont_get_fallback_entity, haikufont_pattern_to_entity)
(haikufont_spec_or_entity_to_pattern, haikufont_list): Use
`iso10646-1' as the default registry instead of `utf8', which is
not a registry.
2022-04-15 12:22:55 +00:00
Po Lu
8e464272bd ; * src/haiku_support.h: Fix header coding style. 2022-04-15 12:00:35 +00:00
Po Lu
4ac25d53af Clean up keysyms from Haiku headers
* src/haiku_support.cc (keysym_from_raw_char): Add keysym
numbers here and use those instead.
* src/haiku_support.h: Delete all the X11 keysym definitions.
2022-04-15 12:00:35 +00:00
Po Lu
09ac2c73ee Fix dismissal of tooltips on Haiku
* src/haikuterm.c (haiku_mouse_or_wdesc_frame): New argument
`accept_tooltip'.
(haiku_read_socket): Use it when handling MOUSE_MOTION events.
2022-04-15 11:25:54 +00:00
Eli Zaretskii
2b92b57923 ; * src/fringe.c: Include pgtkterm.h only in HAVE_PGTK builds. 2022-04-15 12:22:15 +03:00
Eli Zaretskii
803ac857ee Fix cursor motion under truncate-lines with Flymake fringe indicator
* src/indent.c (Fvertical_motion): Don't consider fringe bitmaps
as "images" for the purpose of vertical-motion logic dealing with
overshooting buffer positions.  (Bug#54946)
2022-04-15 12:03:36 +03:00
Po Lu
504779f744 More PGTK related cleanup
* src/pgtkfns.c (x_set_foreground_color, x_set_background_color)
(x_set_border_color, x_set_cursor_color, x_set_title)
(x_set_menu_bar_lines, x_set_tab_bar_lines, x_set_tool_bar_lines)
(x_set_child_frame_border_width, x_set_internal_border_width)
(x_set_icon_type, x_set_icon_name, x_set_cursor_type)
(x_set_mouse_color, x_set_undecorated, x_set_skip_taskbar)
(x_set_override_redirect, pgtk_frame_parm_handlers)
(Fx_create_frame): Rename most `x_' functions to `pgtk_' ones.
All callers changed.
* src/pgtkmenu.c (Fx_menu_bar_open_internal): Remove duplicate
doc string definition.
* src/pgtkterm.c (x_set_offset, pgtk_iconify_frame)
(x_set_parent_frame, x_set_no_focus_on_map, x_set_no_accept_focus)
(x_set_z_group, x_set_cursor_gc, x_set_mouse_face_gc)
(x_set_mode_line_face_gc, x_set_glyph_string_gc)
(x_set_glyph_string_clipping, x_set_glyph_string_clipping_exactly)
(x_setup_relief_color, x_setup_relief_colors)
(x_set_clip_rectangles, x_draw_relief_rect, x_draw_box_rect)
(x_draw_glyph_string_box, x_draw_image_relief)
(x_draw_image_foreground, x_draw_stretch_glyph_string)
(pgtk_draw_glyph_string, x_set_toolkit_scroll_bar_thumb)
(x_set_toolkit_horizontal_scroll_bar_thumb)
(pgtk_set_vertical_scroll_bar, pgtk_set_horizontal_scroll_bar)
(x_set_frame_alpha, frame_highlight, frame_unhighlight)
(pgtk_create_terminal, map_event): Rename most `x_' functions to
`pgtk_' ones.  All callers changed.
* src/pgtkterm.h: Update prototypes.
2022-04-15 16:44:18 +08:00
Po Lu
bdceac0d5a Clean up some extraneous stuff in pgtkfns.c
* src/pgtkfns.c (Fx_gtk_debug): Fix doc string and remove extra
version check.
(syms_of_pgtkfns): Delete left over defvar from NS port.
2022-04-15 16:44:18 +08:00
Po Lu
4d2aa420bd Fix core string lookup with modifiers on XI2
* src/xterm.c (handle_one_xevent): Clean modifiers from
xkey.state before giving it to XLookupString.
2022-04-15 15:09:18 +08:00
Po Lu
095a776d06 Clean up various bits of Haiku code
* src/haiku_font_support.cc (BFont_string_width): Delete unused
function.
* src/haiku_support.cc (BWindow_new): Clean up type of `view'.
(BWindow_quit): Clean up coding style.
(BView_mouse_down, BView_mouse_up, BView_mouse_moved): Delete
unused functions.
(unwind_popup_file_dialog): Clean up coding style.
(be_popup_file_dialog_safe_set_target): Delete function.
(be_popup_file_dialog): Improve code clarity.
* src/haiku_support.h: Fix coding style.
* src/haikufns.c (haiku_get_color, haiku_display_info_for_name)
(check_haiku_display_info, Fhaiku_read_file_name)
(Fx_display_save_under, Fhaiku_frame_restack): Remove references
to "Be displays" and replace them with "Haiku displays".
* src/haikuselect.h: Clean up coding style.
* src/haikuterm.c (haiku_read_socket): Clean up coding style and
fix a few latent bugs.
2022-04-15 06:36:37 +00:00
Po Lu
2c5b4ae93a Add missing extern declarations to headers
* src/xterm.h (xi_device_from_id, xi_frame_selected_for): Add
`extern' declaration.
2022-04-15 14:08:40 +08:00
Po Lu
24df0273e9 Make Haiku scroll bar behave more like other programs
* haiku_support.cc (class EmacsScrollBar): New field
`repeater_start'.
(Pulse): Wait for time to pass repeater_delay.
(MouseDown): Set it to the current time + the system repeater
delay.
2022-04-15 02:38:35 +00:00
Paul Eggert
7c17bd2a6d New time-equal-p test
* test/src/timefns-tests.el (time-equal-p-NaN-NaN): New test.
2022-04-14 19:09:51 -07:00
Po Lu
6c4559d138 Properly wait for app thread exit on Haiku
* src/haiku_support.cc (MessageReceived): Handle
QUIT_APPLICATION.
(start_running_application): Clean up code a little.
(wait_for_exit_of_app_thread): New function.
(BApplication_setup): Add atexit handler to clean up app thread.
(be_app_quit): Delete function.
* src/haikuterm.c (haiku_delete_terminal): Un-implement
function.
* src/haikuterm.h: Update prototypes.
2022-04-15 01:23:27 +00:00
Po Lu
804d919ac5 Fix calls to XKB functions without testing for server support
* src/xterm.c (x_dnd_cleanup_drag_and_drop):
(x_dnd_begin_drag_and_drop): Never call XkbSelectEvents if the
X server doesn't have XKB.
2022-04-15 08:55:25 +08:00
Eli Zaretskii
67e7870a62 Fix mouse clicks in hscrolled window with variable-height fonts
* src/xdisp.c (move_it_in_display_line_to): Fix calculation of
height of a screen-line that is completely hscrolled out of view.
Reported by Yasushi SHOJI <yasushi.shoji@gmail.com>.
2022-04-14 20:40:24 +03:00
Philip Kaludercic
17b639aabb Avoid possibly unnecessary lisp_time_struct call
* timefns.c (time_cmp): Defer the calculation of the time struct, in
  case A and B are eq to one another.
2022-04-14 18:39:35 +02:00
Po Lu
a9b8ebf34c Fix races with child frame locks on Haiku
* src/haiku_support.cc
(CHILD_FRAME_LOCK_INSIDE_LOOPER_CALLBACK): New macro.
(FrameMoved, WorkspacesChanged): Lock child frame data with that
macro instead.
2022-04-14 13:14:32 +00:00
Po Lu
e5ef0fe832 Keep track of keyboard state during drag and drop
* src/xterm.c (x_dnd_cleanup_drag_and_drop): Deselect for
keyboard state changes.
(x_dnd_begin_drag_and_drop): Select for keyboard state changes
when XKB is available.
(x_dnd_update_state, handle_one_xevent): Use current XKB state
if it is available.
(x_term_init): Reformat code a little.
2022-04-14 19:02:13 +08:00
Po Lu
203c503ff2 Minor fixes to menus on XI2
* src/xfns.c (Fx_create_frame): Populate `xi_masks'.
* src/xmenu.c (x_activate_menubar)
(create_and_show_popup_menu, x_menu_show): Only clear input
extension grabs if we (or the toolkit) actually selected for
XI_ButtonPress events.
* src/xterm.c (xi_frame_selected_for): New function.
(xi_populate_device_from_info, handle_one_xevent): Store device
use instead of just whether or not it's a master device.
(x_dnd_begin_drag_and_drop): Clean up block_input stuff.
* src/xterm.h: Update prototypes.
(struct xi_device_t): Rename `master_p' to `use'.
2022-04-14 16:04:59 +08:00
Po Lu
c10024911d Ignore XdndPosition events triggered by the wrong mouse button
* src/xterm.c (x_dnd_send_position): Don't send if button is set
but not a scroll wheel button.
2022-04-14 10:26:39 +08:00
Po Lu
63c28d389d Add support for Xdnd features introduced after version 5
* src/xterm.c (x_dnd_send_position, x_dnd_update_state)
(handle_one_xevent): Add support for sending button and keyboard
state during DND.
2022-04-14 09:31:02 +08:00
Eli Zaretskii
be42fdc6dc ; * src/xterm.c (x_term_init): Fix whitespace. 2022-04-13 16:48:13 +03:00