1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-12 14:30:42 -08:00
Commit graph

46778 commits

Author SHA1 Message Date
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
Gregory Heytings
66704fbbcf Fix typo in e7b5912b23. 2022-07-17 01:36:10 +02:00
Gregory Heytings
e7b5912b23 Improvements to long lines handling.
* src/buffer.h (struct buffer): New field 'long_line_optimizations_p'.

* src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'.
(reset_buffer): Initialize the 'long_line_optimizations_p' field.
(Fbuffer_swap_text): Handle it.

* src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when
a buffer contains long lines.
(init_iterator): Use 'long_line_optimizations_p'.
(get_narrowed_begv): Update.
(SET_WITH_NARROWED_BEGV): New macro.
(unwind_narrowed_begv): New internal function used by the new macro.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.

* src/search.c (find_newline1): Make it externally visible.

* src/lisp.h: Make 'find_newline1' externally visible.

* src/dispextern.h (struct it): Update comment.  Remove the
'WITH_NARROWED_BEGV' macro.

* etc/NEWS: Mention the 'long-line-threshold' variable.
2022-07-16 21:13:33 +02:00
Eli Zaretskii
9de00e5fda Avoid assertion violations in 'back_to_previous_visible_line_start'
* src/xdisp.c (back_to_previous_visible_line_start): Avoid
assertion violations when narrowed_begv is in effect.
2022-07-09 13:26:05 +03:00
Eli Zaretskii
a740608453 Fix segfault in composite.c
* src/composite.c (find_automatic_composition): Don't use
narrowed_begv if it's zero.  This avoids segfault in
BACKWARD_CHAR, since zero is not a valid buffer position.
2022-07-09 13:16:12 +03:00
Gregory Heytings
afbac35bba Fix typo in 1792cbaddc. 2022-07-09 00:12:42 +02:00
Gregory Heytings
1792cbaddc Actually fix the long lines display bug (bug#56393).
* src/dispextern.h (struct it): New 'narrowed_begv' field.

* src/dispextern.h (WITH_NARROWED_BEGV): New macro.

* src/xdisp.c (get_narrowed_begv): New function.
(init_iterator): Initilize the 'narrowed_begv' field.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.

* src/dispextern.h: Prototype of 'get_narrowed_begv'.

* src/window.c (window_body_height): Make it externally visible.

* src/window.h: Prototype of 'window_body_height'.

* src/composite.c (find_automatic_composition): Optimize display in buffers
with very long lines with 'get_narrowed_begv'.

* lisp/obsolete/longlines.el: Reobsolete longlines-mode.

* etc/NEWS: Announce the new minor mode, and remove the unobsoletion
indication for 'longlines-mode'.

* doc/emacs/trouble.texi (Long Lines): Remove the section.
(Lossage): Remove the entry for the Long Lines section.

* doc/emacs/emacs.texi (Top): Remove the entry for the Long Lines section.
2022-07-08 23:36:58 +02:00
Gregory Heytings
60e51595c8 Revert commit 38b3780f6e. 2022-07-08 23:36:18 +02:00
Gregory Heytings
e31cffb5ab Revert commits 9ea9533f17, c0c4600ece, 7b19ce51fc, 051d2a1e36 and eb6d2fb58d. 2022-07-08 23:31:56 +02:00
Eli Zaretskii
9ea9533f17 * src/xdisp.c (set_vertical_scroll_bar): Remove stale comment. 2022-07-08 09:48:44 +03:00
Eli Zaretskii
c0c4600ece 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-08 09:42:02 +03:00
Gregory Heytings
eb6d2fb58d Various improvements to auto-narrow mode.
* lisp/files.el (auto-narrow-display-length): Improve docstring.
(auto-narrow-widen-automatically): Add 'undo' to the command list.
(auto-narrow-hook): New defcustom.
(auto-narrow-pre-command-function, auto-narrow-post-command-function):
Move initialization code.
(auto-narrow-mode): Do not make the 'auto-narrow-mode' permanent local
anymore.

* lisp/font-lock.el (turn-off-font-lock-mode): New convenience function.

* src/xdisp.c (set_vertical_scroll_bar): Fix typo.
(redisplay_window): Use the new convenience function.

* src/buffer.h (BUFFER_NEEDS_AUTO_NARROWING_P,
BUFFER_AUTO_NARROWED_NON_NARROWED_P): Two new convenience functions.

* src/window.c (Frecenter): Do not recenter auto-narrowed buffers that
are not actually narrowed.

* etc/NEWS: Improvement.

* doc/emacs/display.texi (Auto-Narrowing): Improvement.
2022-07-06 12:06:53 +02:00
Gregory Heytings
38b3780f6e Actually fix the long lines display bug (bug#56393).
* lisp/files.el (auto-narrow-mode): New minor mode.
(auto-narrow-pre-command-function, auto-narrow-post-command-function):
New auxiliary functions for the minor mode.
(auto-narrow-display-length, auto-narrow-widen-automatically): New
defcustoms for the minor mode.
(auto-narrow--widen-automatically, auto-narrow--isearch-widen-automatically,
auto-narrow--initialized): New internal variables for the minor mode.

* src/buffer.h (struct buffer): New internal variable for the minor mode.
(bset_auto_narrow__narrowing_state, BUFFER_AUTO_NARROWED_P): New
auxiliary functions.

* src/buffer.c (init_buffer_once, syms_of_buffer): New internal variable
for the minor mode. Update the docstring of mode-line-format.

* src/fileio.c (Finsert_file_contents): Detect whether the minor mode should
be entered when the buffer is displayed.
(syms_of_fileio): New defcustom for the minor mode.

* src/keyboard.c (syms_of_keyboard): New hook functions for the minor mode.
(command_loop_1): Execute the hook functions.

* src/xdisp.c (redisplay_window): Enter the minor mode when the buffer is
displayed.
(decode_mode_spec): Indicate when the minor mode is active
in the modeline.  Indicate the buffer position relative to the whole buffer.
(set_vertical_scroll_bar): Indicate the buffer position relative to the
whole buffer.
(syms_of_xdisp): Two new symbols.

* lisp/isearch.el (isearch-widen-automatically): New defcustom.
(isearch-search): Use the new defcustom.

* lisp/bindings.el (mode-line-modes): Do not propertize the indication
in the modeline when the new minor mode is active.

* etc/NEWS: Announce the new minor mode, and remove the unobsoletion
indication for 'longlines-mode'.

* lisp/longlines.el: Reobsolete longlines-mode.

* doc/emacs/display.texi (Auto-Narrowing): New section, describing the new
minor mode.
(Display): Entry for the new section.

* doc/emacs/trouble.texi (Long Lines): Remove the section.
(Lossage): Remove the entry for the Long Lines section.

* doc/emacs/emacs.texi (Top): Remove the entry for the Long Lines section.
2022-07-06 00:43:56 +02:00
Po Lu
9298a571eb Fix manually disowning Emacs drag atoms
* src/xterm.c (handle_one_xevent): Disown Motif drag atom if
eventp->time is CurrentTime as well.  This can happen with some
synthetic events.
2022-07-05 19:17:37 +08:00
Po Lu
b4d766fba5 Don't take XCB socket every time we want the no of the next request
* src/xterm.c (x_ignore_errors_for_next_request, x_uncatch_errors)
(x_check_errors, x_had_errors_p): Don't call XNextRequest
redundantly.  Use NextRequest if it was immediately preceded by
XNextRequest, which updates dpy->request.
2022-07-05 11:05:21 +08:00
Po Lu
08df1631b4 Don't overestimate supported input extension version on GTK 3
* src/xterm.c (x_term_init): If minor > original_minor (the
maximum version supported by libXi), set it back to
original_minor.
2022-07-05 10:13:37 +08:00
Paul Eggert
6d415d5f0b Fix core dump with x-get-local-selection
* src/xselect.c (Fx_get_local_selection): Check that VALUE has 4
elements, since x_get_local_selection can dump core otherwise.
This pacifies gcc -Wanalyzer-null-dereference, which found the
problem.
2022-07-04 16:22:17 -05:00
Stefan Kangas
599aea3012 * src/keymap.c (Fcopy_keymap): Document using defvar-keymap. 2022-07-04 17:01:53 +02:00
Po Lu
a218921172 Avoid code duplication converting XI event state in toolkit menu code
* src/xmenu.c (x_menu_translate_generic_event):
(popup_get_selection): Use `xi_convert_event_state' instead.
* src/xterm.c (xi_convert_event_state): Export on non-GTK
builds.
* src/xterm.h: Update prototypes.
2022-07-04 21:13:29 +08:00
Po Lu
c4e93b67c4 Handle errors caused by ignoring errors with GDK's trap installed
* src/xterm.c (x_ignore_errors_for_next_request)
(x_stop_ignoring_errors): Also tell GDK to ignore errors from
the following requests.  (bug#56372)
2022-07-04 14:02:42 +08:00
Po Lu
1da6a6d327 Always wait for XdndStatus before sending XdndDrop
* src/xterm.c (x_dnd_do_drop): New function.
(x_dnd_begin_drag_and_drop): Clear new flag.
(handle_one_xevent): Use that function; send drops upon receipt
of pending XdndStatus, to avoid race conditions where we don't
yet know the selected action.
2022-07-04 13:41:20 +08:00
Po Lu
bd034b342c Fix accessing dpyinfo after it is deallocated
* src/xterm.c (x_connection_closed): Print disconnect error for
the last terminal before freeing it.
2022-07-04 12:56:42 +08:00
Po Lu
c96cd5e2b7 Display list of traps and handlers when crashing due to an X error
* src/xterm.c (x_connection_closed): Print list of installed
error handlers if not crashing due to an IO error.
(NO_INLINE): Include error serial in error message.
2022-07-04 11:32:05 +08:00
Florian Rommel
bbca04fd9d Add support for fullscreen values fullheight and fullwidth on PGTK
* src/pgtkterm.c (window_state_event): Support values fullheight and
fullwidth for the fullscreen frame-parameter
* doc/lispref/frames.texi (Size Parameters): Document inability to
actively set hullheight/fullwidth for PGTK frames
* configure.ac: Bump GTK version for PGTK
* etc/NEWS: Change GTK version in PGTK announcement
2022-07-04 10:21:14 +08:00
Po Lu
06afa7b4e0 Add some more error checking code to `x_stop_ignoring_errors'
* src/xterm.c (x_stop_ignoring_errors): Abort if no request was
actually made, making the state inconsistent.
2022-07-04 09:33:19 +08:00
Florian Rommel
676d38cfc3 abort-redisplay: Add missing unbind_to in 'recenter'
* src/window.c (recenter): Add ubind_to before early return.
(Bug#56369)
2022-07-03 19:07:28 +03:00
Eli Zaretskii
e9bb92940e Fix implementation of 'reset' face values
* src/xfaces.c (Finternal_merge_in_global_face)
(gui_supports_face_attributes_p):  Only modify local copy of face
attributes when replacing 'reset' pseudo-values with real values.
(Bug#38771)
2022-07-03 15:37:50 +03:00
Po Lu
cfee07d4dd Improve performance when rejecting XI touch event
* src/xterm.c (handle_one_xevent): Avoid sync handling simple
error.
2022-07-03 19:49:24 +08:00
Eli Zaretskii
f5a11369ea ; * src/xfaces.c (Finternal_set_lisp_face_attribute): Fix last change. 2022-07-03 13:22:42 +03:00
Po Lu
2c4922d76b Improve efficiency of x_frame_highlight' and x_frame_unhighlight'
* src/xterm.c (x_frame_highlight, x_frame_unhighlight): Don't
sync catching errors.
2022-07-03 17:52:14 +08:00
Eli Zaretskii
45badeceec Implement pseudo-value 'reset' of face attrributes
* doc/lispref/display.texi (Face Attributes):
* etc/NEWS: Document the new pseudo-value 'reset'.

* src/xfaces.c (realize_named_face, lookup_derived_face)
(gui_supports_face_attributes_p, lookup_named_face)
(Finternal_merge_in_global_face, merge_named_face, merge_faces):
Handle the 'reset' pseudo-value of a face's attribute.
(syms_of_xfaces): New symbol 'reset'.
(RESET_P): New macro.
(check_lface_attrs, Finternal_set_lisp_face_attribute): Allow
'reset' as a value of any attribute except ':inherit'.
(Bug#38771)
2022-07-03 12:30:24 +03:00
Po Lu
fcdaaf241e Fix deadlocks with very old versions of libXi
* src/xfns.c (setup_xi_event_mask, Fx_create_frame): Set
`xi_mask' ourselves if the version of libXi is too old to have
working XIGetSelectedEvents.
* src/xterm.c (x_destroy_window): Free `xi_mask' with xfree in
that case.
2022-07-03 14:33:16 +08:00
Po Lu
4ef1e4daf5 Speed up receiving drops over slow connections
* lisp/x-dnd.el (x-dnd-debug-errors): New variable.
(x-dnd-handle-drag-n-drop-event): Bind
`x-fast-protocol-requests' to t if that is off.

* src/xfns.c (Fx_change_window_property):
(Fx_delete_window_property):
* src/xselect.c (Fx_send_client_message, x_send_client_event):
Don't sync to check for errors if fast protocol requests are
enabled.

* src/xterm.c (x_catch_errors_for_lisp, x_check_errors_for_lisp)
(x_uncatch_errors_for_lisp): New functions.
(syms_of_xterm): New variable `x-fast-protocol-requests'.
* src/xterm.h: Update prototypes.
2022-07-03 09:43:20 +08:00
Lars Ingebrigtsen
782e48b3db REQUIRE-MATCH doc string clarification
* src/minibuf.c (Fcompleting_read):
* lisp/minibuffer.el (read-file-name): Clarify what the return
value is in the REQUIRE-MATCH function case.
2022-07-02 22:03:06 +02:00
Lars Ingebrigtsen
3c125290d2 Add sanity check for Emacsen distributed without .el files
* src/lread.c (maybe_swap_for_eln): Add sanity check for Emacsen
distributed without .el files (bug#48342).
2022-07-02 18:42:36 +02:00
Po Lu
b25ca54298 Fix error handling for XCB Xlib
* src/xterm.c (xm_send_drop_message)
(xm_send_top_level_enter_message, xm_send_drag_motion_message)
(xm_send_top_level_leave_message, x_dnd_compute_toplevels)
(x_dnd_send_enter, x_dnd_send_position, x_dnd_send_leave)
(x_dnd_send_drop, handle_one_xevent, x_catch_errors_with_handler)
(x_request_can_fail, x_clean_failable_requests)
(x_ignore_errors_for_next_request, x_stop_ignoring_errors)
(x_uncatch_errors, x_check_errors, x_had_errors_p, x_error_handler)
(frame_set_mouse_pixel_position, x_focus_frame): Record serial
sequences instead of simply the next request when ignoring a
single request.  Use XNextRequest instead of NextRequest, since
the latter is unreliable when using Xlib built with XCB.

* src/xterm.h (struct x_failable_request): New struct..
(struct x_display_info): Make failable request variables the
right type.
2022-07-02 21:56:59 +08:00
Po Lu
59d109b73c Fix display disconnect when tooltip frame is alive
* src/xterm.c (x_connection_closed): Don't dereference nil when
loop finds a tooltip frame.
2022-07-02 21:56:59 +08:00
Lars Ingebrigtsen
b2670bfe42 Add a comment about buffer_local_value/find_symbol_value
* src/data.c: Note that buffer_local_value is very similar
(bug#48281).
2022-07-02 15:22:13 +02:00
Lars Ingebrigtsen
8b52d9f5f1 Allow NUL characters in JSON input
* src/json.c (Fjson_parse_string, Fjson_parse_buffer): Allow NUL
characters in JSON (bug#48274).
2022-07-02 15:06:24 +02:00
Mattias Engdegård
8d68760dde ; Fix typos. 2022-07-02 13:32:41 +02:00
Lars Ingebrigtsen
14d4d63c8c native-comp-eln-load-path doc string fix
* src/comp.c (syms_of_comp): Fix grammar in doc string.
2022-07-02 12:54:28 +02:00
Eli Zaretskii
631b3fbde7 * src/sheap.h (STATIC_HEAP_SIZE): Double the size of static heap. 2022-07-02 12:16:33 +03:00
Po Lu
50b3e9d23d Completely get rid of races during Motif drag window creation
* src/xterm.c (x_special_window_exists_p): New function.
(xm_get_drag_window_1): Rework workflow and display grabbing.
2022-07-02 16:42:06 +08:00
Stefan Kangas
9230953f23 ; Fix typos. 2022-07-02 10:20:23 +02:00
Stefan Kangas
3112d5a2f1 * src/xfns.c (Fx_server_input_extension_version): Fix typo. 2022-07-02 09:49:08 +02:00
Stefan Kangas
52c91122ee Merge from origin/emacs-28
1c3d107cb5 Fix "C-u C-x =" for SPC
7e33618bbc ; * src/fns.c (Frequire): Fix a typo in the doc string.  (...
6908309827 Doc fixes: don't refer to some obsolete items
dc3cb749f3 Remove obsolete cust-print from elisp index
9ffbbddf8e * admin/make-tarball.txt: Minor clarifications.
f5421104e9 Fix external image conversion on MS-Windows
6f22631a63 * doc/emacs/buffers.texi (Indirect Buffers): Mention modif...

# Conflicts:
#	doc/emacs/buffers.texi
#	lisp/emacs-lisp/nadvice.el
#	lisp/image/image-converter.el
2022-07-02 09:33:51 +02:00
Lele Gaifax
9dc0fdfdc1 Fix repeated "the"
* configure.ac (EMACS_CONFIG_FEATURES):
* etc/NEWS:
* lisp/dnd.el (dnd-begin-text-drag):
* src/pgtkfns.c (Fx_display_mm_height, Fx_display_mm_width):
(Fx_display_backing_store, Fx_display_visual_class):
* src/xterm.c: Fix repeated "the".  (Bug#56341)

Copyright-paperwork-exempt: yes
2022-07-02 10:04:32 +03:00
Stefan Monnier
a2d0a9ee5c * editfns.c (Fbyte_to_string): Use make_unibyte_string 2022-07-01 21:29:45 -04:00
Po Lu
eb6d74a26c Return the correct action from the Lisp side of drag-and-drop
* lisp/x-dnd.el (x-dnd-handle-drag-n-drop-event): Select
`window' when handling internal DND events.
(x-dnd-handle-unsupported-drop): Return an appropriate action.
* src/keyboard.c (kbd_buffer_get_event):
* src/termhooks.h (enum event_kind): Delete
`UNSUPPORTED_DROP_EVENT'.
* src/xterm.c (x_dnd_send_unsupported_drop): Set flags instead
of recording input event.
(x_clear_dnd_monitors): Rename to `x_clear_dnd_variables'.  Also
clear unsupported drop data.
(x_dnd_begin_drag_and_drop): Run unsupported drop function
inline (and safely), and use its return value if it returned a
symbol.
(syms_of_xterm): Update doc string of
`x-dnd-unsupported-drop-function'.

* src/xterm.h: Update declarations.
2022-07-02 09:06:36 +08:00
Po Lu
b55059bbeb Prevent XdndPosition messages from rarely being sent out of band
* src/xterm.c (handle_one_xevent): Don't clear
`x_dnd_waiting_for_status_window' if a pending position message
was sent in reply to an XdndStatus event.
2022-07-01 16:18:50 +08:00