Commit graph

46920 commits

Author SHA1 Message Date
Po Lu
bc3e9f4f6d Fix mouse face handling during frame reentry on Haiku
* src/haikuterm.c (haiku_read_socket): Clear
last_mouse_glyph_frame like on X.
2022-07-25 09:39:26 +00:00
Po Lu
3c23ae13f0 Fix mouse face handling with tooltips
* src/xterm.c (handle_one_xevent): Clear last_mouse_motion_frame
and last_mouse_glyph_frame on LeaveNotify.  Otherwise, mouse
face will be restored by gui_redo_mouse_highlight and will not
be restored if an EnterNotify is later sent on top of the same
glyph.
2022-07-25 10:07:30 +08:00
Po Lu
b1f14e94ad ; Rename misnamed function in xterm.c
* src/xterm.c (x_init_master_valuators): Rename to
`x_cache_xi_devices'.  Update comment accordingly.  All callers
changed.
2022-07-25 09:23:15 +08:00
Po Lu
235045f712 Prevent exposing tooltip frames to Lisp code during drag-and-drop
* src/xterm.c (x_dnd_compute_toplevels): Ignore tooltip frames.
(x_tooltip_window_to_frame): Allow unrelated_tooltip_p to be
NULL.
(handle_one_xevent): Ignore DND events to tooltip frames.
2022-07-24 10:42:02 +08:00
Basil L. Contovounesios
26f4bcc6d7 Update pdumper.c after recent long lines changes
For discussion, see:
https://lists.gnu.org/r/emacs-devel/2022-07/msg00761.html

* src/pdumper.c (dump_buffer): Dump new field
long_line_optimizations_p introduced in commit e7b5912b23 of
2022-07-16 "Improvements to long lines handling."
(dump_buffer) [CHECK_STRUCTS]: Update hash accordingly
for --enable-checking=structs.
2022-07-23 16:33:09 +03:00
Mattias Engdegård
aa28829eb7 Correct symbol in error for failed CHECK_INTEGER (bug#56723)
Reported by Jeronimo Pellegrini.

* src/lisp.h (CHECK_INTEGER): Use integerp, not numberp.
2022-07-23 14:55:54 +02:00
Po Lu
49d16a7eb4 Undo C parts of "Don't use the Gtk region face"
This reverts commit a24f710395, apart
from the change to faces.el and NEWS.
2022-07-23 17:03:04 +08:00
Lars Ingebrigtsen
a24f710395 Don't use the Gtk region face
* lisp/faces.el (region): Don't use the Gtk region face, because
it produces low contrast combinations (bug#46493).
* src/gtkutil.h:
* src/gtkutil.c (xg_check_special_colors): Remove.

* src/xfns.c (x_defined_color):
* src/pgtkterm.c (pgtk_defined_color): Don't call.
2022-07-23 10:52:30 +02:00
Po Lu
792734a6e2 Improve efficiency of DND tooltip movement
* src/xterm.c (x_dnd_begin_drag_and_drop): Clear new flag.
(x_dnd_update_tooltip_position): Save last tooltip X and Y
somewhere, so we don't move it upon client lists being updated.
2022-07-23 09:35:20 +08:00
Stefan Kangas
df508ffd2b Merge from origin/emacs-28
ae1ace1cf4 Adjust help-fns.el tests for recent change
04bdcf4aaa * src/terminal.c (Fframe_terminal): Use active voice
7fa491a9e9 Improve 'terminal-live-p' docstring some more
b9ac8c29ae Improve terminal-live-p docstring
0b4c81a152 * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector): F...
8f8373170f * lisp/progmodes/cperl-mode.el: Don't mention obsolete arc...
25bc330a6d Make 'describe-function' say "byte-compiled" when appropriate
2b31e667be ;Improve documentation of locale-specific string comparison
2022-07-23 01:37:59 +02:00
Robert Pluim
1767f796b0 ; * src/xdisp.c (set_vertical_scroll_bar): Fix typo 2022-07-22 16:20:36 +02:00
Eli Zaretskii
12a3137cd3 Fix display of scroll-bar in mini-windows
* src/xdisp.c (set_vertical_scroll_bar): Ensure current_buffer is
set correctly when displaying scroll bar of a mini-window.
(Bug#56692)
2022-07-22 16:15:38 +03:00
Robert Pluim
04bdcf4aaa * src/terminal.c (Fframe_terminal): Use active voice 2022-07-22 14:19:04 +02:00
Robert Pluim
7fa491a9e9 Improve 'terminal-live-p' docstring some more
* terminal.c (Fterminal_live_p): Improve description of arguments and
return value.
2022-07-22 14:10:10 +02:00
Po Lu
82116a5ea3 Fix bug#56692 questionably
* src/xdisp.c (set_vertical_scroll_bar): Don't recompute window
end of a mini window.  (bug#56692)
2022-07-22 19:54:57 +08:00
Robert Pluim
b9ac8c29ae Improve terminal-live-p docstring
* src/terminal.c (Fterminal_live_p): Explain what happens when the
argument is nil.
2022-07-22 10:14:45 +02:00
Po Lu
f173028d15 Fix handling hscroll during drag-and-drop
* lisp/x-dnd.el (x-dnd-hscroll-flags): Delete function.
(x-dnd-get-modifiers, x-dnd-wheel-modifier-type): New functions.
(x-dnd-mwheel-scroll): Use that to determine hscroll instead.
* src/window.c (set_window_hscroll): Mark window as needing
redisplay if the hscroll really changed.
2022-07-22 15:37:28 +08:00
Po Lu
83c2c36d35 Fix posn-timestamp of scroll bar events on GTK
* src/xterm.c (x_get_last_toolkit_time): New function.
(x_scroll_bar_to_input_event)
(x_horizontal_scroll_bar_to_input_event): Use it to retrieve
toolkit time.
(xg_scroll_callback, xg_end_scroll_callback): Set last user time
if possible.
2022-07-22 09:38:32 +08:00
Eli Zaretskii
72278f21e0 ; Clarify doc string of 'long-line-threshold'
* src/buffer.c (syms_of_buffer) <long-line-threshold>: Clarify the
doc string.
2022-07-21 15:59:50 +03:00
Gregory Heytings
616da8fa8e Merge branch 'feature/fix-the-long-lines-display-bug' 2022-07-21 12:37:45 +02:00
Eli Zaretskii
51f8e86374 Update buffer's chars-modified tick when inserting from gap
* src/insdel.c (insert_from_gap): Update buffer's chars-modified
tick.  (Bug#56393)

* test/src/buffer-tests.el (test-buffer-chars-modified-ticks): New
test.
2022-07-21 12:40:28 +03:00
Po Lu
a29a3ad55d Apply tooltip assertions to all instances of x-show-tip
* src/haikufns.c (Fx_show_tip):
(syms_of_haikufns):
* src/nsfns.m (Fx_show_tip):
(syms_of_nsfns):
* src/pgtkfns.c (Fx_show_tip):
(syms_of_pgtkfns):
* src/xfns.c (Fx_show_tip):
(syms_of_xfns): Add assertion and adjust default values.
2022-07-21 16:26:50 +08:00
Eli Zaretskii
46052d1dcb Make sure we don't unknowingly truncate tooltip text
* src/w32fns.c (Fx_show_tip): Add assertion when the default
tooltip dimension limits are insufficient.  (Bug#56561)
2022-07-21 10:12:03 +03:00
Po Lu
50ff15bb8a Avoid wasting bandwidth to set user time
* src/xterm.c (x_display_set_last_user_time): Don't change the
user time property if nothing actually changed.
2022-07-21 14:55:19 +08:00
Po Lu
a641f55559 Improve handling screen resizes when built without RandR
* src/xterm.c (handle_one_xevent): Update DND tooltip position
upon ConfigureNotify for root window.
2022-07-21 09:39:24 +08:00
Gregory Heytings
e09c056a44 * src/xdisp.c (redisplay_window): Small optimization. 2022-07-20 21:54:39 +02:00
Eli Zaretskii
cec248ec31 ; * src/data.c (Fash): Improve wording of the doc string. 2022-07-20 22:03:45 +03:00
Gregory Heytings
c7eef61eee Further tweaks to long lines handling.
* src/xdisp.c (redisplay_window): Increase the threshold above which
long lines detection is performed in the buffer.  This should avoid
triggering that detection for most simple editing operations.

* src/lisp.h (modiff_incr): Explain why the counter is incremented
logarithmically.

* src/buffer.h (struct buffer_text): Adapt the comment about the
'modiff' field accordingly.

* src/buffer.c (modify_overlay): Increase the counter by 1 instead of
the size of the buffer section on which the overlay is placed.

* etc/NEWS: Small improvement.
2022-07-20 19:14:41 +02:00
Po Lu
83753d05eb Implement wheel movement during DND on Haiku
* lisp/term/haiku-win.el (haiku-dnd-wheel-count): New defvar.
(haiku-note-wheel-click, haiku-handle-drag-wheel): New
functions.

* src/haiku_support.cc (EmacsWindow): Get rid of window ID
logic.
(MessageReceived, MouseMoved, be_drag_message): Use thread ID to
identify windows instead of window ID.

* src/haikuselect.c (Fhaiku_drag_message): Record whether or not
the DND frame is a valid drop target.
(haiku_note_drag_wheel): New function.
(syms_of_haikuselect): New defvar.

* src/haikuterm.c (haiku_read_socket): Call
`haiku_note_drag_wheel' when appropriate.
* src/haikuterm.h: Update prototypes.
2022-07-20 07:37:41 +00:00
Po Lu
ffd38a9911 Fix setting user time upon scrolling self during DND
* src/xterm.c (handle_one_xevent): Set user time for emulated
scroll wheel events if Emacs ends up scrolled during DND.
2022-07-20 09:41:43 +08:00
Gregory Heytings
7c0fc85364 Simplified and improved heuristic for long lines detection.
* src/lisp.h (modiff_incr): Add a parameter to 'modiff_incr' to record
the extent of the modification.

* src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap,
insert_from_buffer_1, adjust_after_replace, replace_range,
replace_range_2, del_range_2, modify_text): Add an argument to each
call to 'modiff_incr'.

* src/textprop.c (modify_text_properties): Add an argument to the call
to 'modiff_incr'.

* src/buffer.c (Frestore_buffer_modified_p, Fbuffer_swap_text,
modify_overlay): Add an argument to each call to 'modiff_incr'.

* src/xdisp.c (redisplay_window): Use the improved version of 'MODIFF'
for the heuristic.
2022-07-19 23:34:09 +02:00
Gregory Heytings
c6bee17075 Revert commits 1ff69cc744 and 9a894206f6. 2022-07-19 23:30:17 +02:00
Gregory Heytings
9a894206f6 Improve the heuristic for long lines detection again.
* src/xdisp.c (redisplay_window): Improve the heuristic again.
2022-07-19 15:35:14 +02:00
Mattias Engdegård
ac1d15e95c ; * src/data.c (Fash): More precise doc string 2022-07-19 15:21:56 +02:00
Gerd Moellmann
f02944f5a1 Prevent GC of window referenced from EmacsScroller
* src/nsterm.m (EmacsScroller.mark, mark_nsterm): New functions.
* src/nsterm.h (EmacsScroller.mark, mark_nsterm): Declare.
* src/alloc.c (garbage_collect) [MAVE_NS]: Call mark_nsterm.
(Bug#56095)

(cherry picked from commit 5f1bd87247)
2022-07-19 16:04:13 +03:00
Stefan Kangas
4b807380cf Merge from origin/emacs-28
282dde887d ; Fix typo missed in previous change
62c47ffd5f ; * lisp/net/tramp-crypt.el: Improve commentary
cba30431ff Merge branch 'emacs-28' of git.savannah.gnu.org:/srv/git/e...
8f9993bb3f ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc ...
fec4bb89f9 ; Fix typos (Bug#56550)
2022-07-19 06:30:56 +02:00
Po Lu
6692df0279 Fix timestamp specified in wheel movement XDND events
* src/xterm.c (handle_one_xevent): Use the time of the wheel
event in XDND events sent in response to wheel movement.
2022-07-19 09:41:36 +08:00
Po Lu
bcbd06b4bb Make drag-and-drop wheel movement work locally too on X
This is provided by the XDND protocol, so it isn't fair for it
to not work with local drag-and-drop.

* lisp/x-dnd.el (x-dnd-note-wheel-movement): New function.  Set
it as the `x-dnd-wheel-function'.
* src/xterm.c (x_dnd_cleanup_drag_and_drop): Clear new flags.
(x_dnd_note_self_wheel): New function.  Set some flags.
(x_dnd_process_quit, x_dnd_begin_drag_and_drop, handle_one_xevent)
(x_connection_closed, x_delete_terminal, mark_xterm): Handle and
set new wheel movement flags
(syms_of_xterm): New variable `x-dnd-wheel-function'.
2022-07-19 09:33:09 +08:00
Eli Zaretskii
7dcea5a428 * src/xdisp.c (set_vertical_scroll_bar): Remove stale comment. 2022-07-18 22:51:25 +02:00
Eli Zaretskii
0699f80f85 Fix calculation of the vertical scroll bar's thumb
* src/xdisp.c (set_vertical_scroll_bar): Compute window's end
position "by hand" if w->window_end_pos cannot be relied upon.
2022-07-18 22:49:20 +02:00
Gregory Heytings
1ff69cc744 Improve the heuristic for long lines detection.
* src/buffer.h (struct buffer_text): New 'unchanged_size' field.
(BUF_UNCHANGED_SIZE): New macro to access the field.

* src/buffer.c (Fget_buffer_create): Initialize the field.
(Fbuffer_swap_text): Handle it.

* src/xdisp.c (mark_window_display_accurate_1): Set the field.
(redisplay_window): Use the field for long lines detection.
2022-07-18 17:54:55 +02:00
Gregory Heytings
6a097a8621 Shorter and safer fix for the segfault.
* src/xdisp.c (get_visually_first_element): Shorter and safer fix for
the segfault.  Improves the fix introduced in cc7f37b2a4.
2022-07-18 16:07:07 +02:00
Eli Zaretskii
8f9993bb3f ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc fix. 2022-07-18 15:31:26 +03:00
Mattias Engdegård
9de0b06e74 Clarify take and ntake documentation (bug#56521)
* doc/lispref/lists.texi (List Elements): Describe `ntake` better.
* src/fns.c (Ftake, Fntake): Rephrase doc strings.
2022-07-18 12:49:29 +02:00
Gregory Heytings
cc7f37b2a4 Further improvements to long lines handling.
* src/xdisp.c (get_visually_first_element): Fix segfault.
(get_narrowed_begv): Specific improvement for character-only terminals.
2022-07-18 12:11:08 +02:00
Po Lu
7b259b2eb1 Implement last change on Haiku as well
* lisp/term/haiku-win.el (haiku-dnd-drag-handler): Stop
redisplaying here.
* src/haikuselect.c (haiku_note_drag_motion): Use
redisplay_preserve_echo_area.
2022-07-18 04:49:46 +00:00
Po Lu
5480d02cc5 Preserve echo area message when running DND mouse movement function
* lisp/term/x-win.el (x-dnd-movement): Stop redisplaying here.
* src/xterm.c (x_dnd_begin_drag_and_drop): Redisplay with the
echo area preserved.
2022-07-18 12:42:55 +08:00
Po Lu
356618ca6a Handle virtual modifiers in the DND scrolling code
* lisp/x-dnd.el (x-dnd-modifier-mask): Handle virtual modifiers.
* src/xfns.c (Fx_get_modifier_masks): New function.
(syms_of_xfns): Define new subr.
* src/xterm.c (x_get_keyboard_modifiers): New function.
* src/xterm.h: Update prototypes.
2022-07-18 09:20:05 +08:00
Mattias Engdegård
d62766305a Add take and ntake (bug#56521)
These are useful list primitives, complementary to `nthcdr`.

* src/fns.c (Ftake, Fntake): New.
(syms_of_fns): Defsubr them.
* doc/lispref/lists.texi (List Elements):
* lisp/emacs-lisp/shortdoc.el (list): Document.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Declare `take` pure and side-effect-free.
* test/src/fns-tests.el (fns-tests--take-ref, fns--take-ntake):
New test.
* etc/NEWS: Announce.
2022-07-17 17:35:49 +02:00
Eli Zaretskii
637436970f Fix leaking of file descriptors due to pipe processes on MS-Windows
* src/w32proc.c (reader_thread): Wait for 'sys_close' to finish
processing the pipe read descriptor, before trying to close it.

* src/w32.c (sys_close): Attempt to detect when the reader thread
already exited, so that it would be possible to close descriptors
open by pipe processes for reading from the pipe.  (Bug#56606)
2022-07-17 15:44:50 +03:00