* src/composite.c (composition_compute_stop_pos): Use an 'endpos' that
is not too far away.
(find_automatic_composition): Use a 'head' that is not too far away.
Also make sure that this code path is not taken when long line
optimizations are disabled.
* src/dispextern.h (struct composition_it): Add a field that points
to the parent iterator.
* src/xdisp.c (get_visually_first_element,
(move_it_vertically_backward): Do not go back too far with bidi.
(get_narrowed_begv): Do not return 0 anymore instead of BEGV.
(handle_fontified_prop): Simplify accordingly.
Add locked narrowing around pre- and post-command-hook
* src/keyboard.c (safe_run_hooks_maybe_narrowed): New function.
(command_loop_1): Use it for 'pre-command-hook' and 'post-command-hook'.
(syms_of_keyboard): Update docstrings of 'pre-command-hook' and
'post-command-hook'.
Declare `key-valid-p` and `readablep` as error-free
* lisp/keymap.el (key-valid-p):
* lisp/subr.el (readablep): These functions are effect-free; declare
them correspondingly. Note that readablep is not pure since its
return value depends on ambient state.
Stefan Kangas [Sun, 31 Jul 2022 16:16:45 +0000 (18:16 +0200)]
Make ps-def.el obsolete (part 1/2)
This file was created to maintain Emacs/XEmacs compat code more
easily, and no longer serves any purpose. It currently contains only
obsolete function and variable aliases.
* lisp/ps-def.el: Move from here...
* lisp/obsolete/ps-def.el: ...to here.
Stefan Kangas [Sun, 31 Jul 2022 11:15:22 +0000 (13:15 +0200)]
Remove some leftover compat code from ps-print
* lisp/ps-def.el (ps-mark-active-p): Make obsolete in favor of
'mark-active'. Update callers.
(ps-face-foreground-name): Make obsolete in favor of
'face-foreground'. Update callers.
(ps-face-background-name): Make obsolete in favor of
'face-background'. Update callers.
(ps-color-device): Make into obsolete function alias for
'display-color-p'. Update callers.
* lisp/emacs-lisp/rx.el (rx--to-expr, rx--pcase-transform):
Don't autoload.
(rx--pcase-macroexpander): Extract body into...
(rx--pcase-expand): ...a separate function, which is autoloaded.
* test/lisp/subr-tests.el (test-print-unreadable-function):
* test/src/print-tests.el (test-print-unreadable-function-buffer):
Instead of binding the value of nominally side-effect-free
expressions to an ignored variable (_), make use of them.
This is more robust and provides useful extra checks in the test.
* lisp/files.el (file-name-quoted-p): Autoload because it's
referred to from tramp-loaddefs.
* lisp/net/tramp.el (defvar): Put the entire form into the
loaddefs file instead of eval-and-compile -- this fixes a
dependency problem when byte-compiling the loaddefs file.
(tramp-methods, tramp-default-method-alist)
(tramp-default-user-alist, tramp-default-host-alist)
(tramp-local-host-regexp, tramp-terminal-type)
(tramp-foreign-file-name-handler-alist): Autoload to avoid
compilation warnings. Also put (require 'cl-lib) into the
loaddefs file for the same reason.
(tramp-ensure-dissected-file-name)
(tramp-set-completion-function)
(tramp-register-foreign-file-name-handler): Autoload.
* lisp/emacs-lisp/cl-macs.el (cl--optimize)
(cl-struct-sequence-type, cl-struct-slot-offset): Autoload since
they are referred to by code in cl-loaddefs.el.
Stefan Kangas [Sun, 31 Jul 2022 09:33:42 +0000 (11:33 +0200)]
Delete additional items obsolete since 20, 21 and 22
* lisp/font-lock.el (font-lock-reference-face): Delete variable
alias obsolete since 20.3.
* lisp/progmodes/cc-cmds.el (c-toggle-auto-state): Delete alias
obsolete since 22.1.
* lisp/replace.el (query-replace-regexp-eval): Delete function
obsolete since 22.1.
(replace-count, replace-re-search-function): Doc fixes; adjust for
above deleted function.
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler):
Move to the main loaddefs file since it's referred to by functions
there.
* lisp/net/tramp.el (tramp-file-name-handler): Autoload to avoid
warning when byte-compiling loaddefs.el.
Fix further package.el loaddefs byte-compile warnings
* lisp/emacs-lisp/package.el (package-directory-list)
(package-quickstart-file): Specify group to avoid warning when
byte-compiling loaddefs.el.
(package-activated-list): Autoload since we're assigning the
variable from a function completely autoloaded.
* src/xterm.c (x_scroll_bar_create): Create an InputOnly window.
Update event masks accordingly and stop allocating back buffer.
(x_scroll_bar_remove): Stop deallocating back buffer.
(XTset_vertical_scroll_bar, x_scroll_bar_set_handle): Draw onto
the edit window so they can be synchronized with buffer flips.
(x_scroll_bar_clear): Redraw scroll bars instead of just
clearing them.
(x_scroll_bar_handle_expose, x_scroll_bar_redraw): New
functions.
(x_scroll_bar_expose, x_scroll_bar_end_update): Delete
functions.
(handle_one_xevent): Update exposure logic accordingly.
Stefan Kangas [Sat, 30 Jul 2022 23:44:22 +0000 (01:44 +0200)]
Delete redisplay-end-trigger-functions and related defuns
This variable and related functions have been obsolete since 23.1.
The last things to depend on this (fast-lock.el and lazy-lock.el) were
recently removed.
* src/dispextern.h (struct it): Delete field
'redisplay_end_trigger_charpos'.
* src/window.c (Fwindow_redisplay_end_trigger)
(Fset_window_redisplay_end_trigger): Delete defuns and corresponding
defsubrs for functions obsolete since 23.1.
* src/window.h (wset_redisplay_end_trigger): Delete function.
(GCALIGNED_STRUCT): Delete 'redisplay_end_trigger'.
* src/xdisp.c (run_redisplay_end_trigger_hook): Delete function.
(syms_of_xdisp) <redisplay_end_trigger_functions>: Delete
variable obsolete since 23.1.
(init_iterator, next_element_from_buffer): Don't run or set above
deleted hook variable.
* lisp/emacs-lisp/icons.el (icons--create): Choose another
character that's unlikely to appear in non-Emoji fonts. (Comment
left in place since this should be fixed in a less breakable way.)
* lisp/mail/mail-parse.el (mail-header-parse-address-lax):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address): Clarify what
these functions do (bug#56824).
Stefan Kangas [Fri, 15 Jul 2022 16:08:34 +0000 (18:08 +0200)]
Make outline-view-change-hook obsolete
According to a comment, this hook "Seems only used by lazy-lock.
I.e. obsolete." But lazy-lock has been deleted.
* lisp/outline.el (outline-view-change-hook): Make obsolete.
Po Lu [Sat, 30 Jul 2022 03:26:46 +0000 (11:26 +0800)]
Minor improvements to precision scroll interpolation
* lisp/pixel-scroll.el (pixel-scroll-start-momentum): Bump GC
cons threshold temporarily. This leads to a very noticable
improvement to animation speed.
Po Lu [Sat, 30 Jul 2022 01:40:00 +0000 (09:40 +0800)]
Don't freeze if the compositing manager crashes
* src/xterm.c (x_if_event): New function, like XIfEvent but with
a timeout.
(x_sync_wait_for_frame_drawn_event): Disable frame
synchronization if x_if_event times out after 1 second.
Improve narrowing when iterator has moved outside of narrowing bounds.
* src/xdisp.c (get_narrowed_begv, get_narrowed_zv): Add 'pos'
parameter.
(init_iterator): Add arguments to 'get_narrowed_begv' and
'get_narrowed_zv'.
(handle_fontified_prop): Recompute the narrowing when iterator
has moved outside of narrowing bounds.
Po Lu [Fri, 29 Jul 2022 12:54:30 +0000 (20:54 +0800)]
Fix handling of extended frame resize synchronization
* src/xterm.c (x_sync_wait_for_frame_drawn_event): Don't wait if
the frame is invisible. If it is mapped again the compositing
manager is obliged to send us another event, so we can wait in
that case.
(x_sync_update_begin, x_sync_update_finish): Handle extended
resize synchronization here.
(XTframe_up_to_date, handle_one_xevent): Save stuff here.
* src/xterm.h (struct x_output): New field
`resize_counter_value'.
* lisp/outline.el (outline-minor-mode-highlight-buffer): Factor
out... (bug#56820).
(outline--use-buttons-p): ... to here.
(outline-hide-subtree, outline--fix-up-all-buttons)
(outline-show-subtree): Use it.
Po Lu [Fri, 29 Jul 2022 08:20:32 +0000 (16:20 +0800)]
Implement monitor refresh rate synchronization on X
* src/xfns.c (x_set_parent_frame, Fx_create_frame): Disable
vsync on child and embedded frames.
* src/xmenu.c (x_menu_show): Fix XMenu position calculation in
child frames.
* src/xterm.c (x_sync_is_frame_drawn_event)
(x_sync_wait_for_frame_drawn_event): New functions.
(x_sync_update_begin): Wait for frame to be drawn if not double
buffered.
(x_sync_update_finish): Set FRAME_X_WAITING_FOR_DRAW (f).
(show_back_buffer): Wait for frame to be drawn before flipping
buffers.
(XTframe_up_to_date): Set FRAME_X_WAITING_FOR_DRAW if bumped.
(handle_one_xevent): Handle frame drawn events.
* src/xterm.h (struct x_output): New fields for frame dirtyness
and vsync.
Po Lu [Fri, 29 Jul 2022 02:13:54 +0000 (10:13 +0800)]
Implement extended frame synchronization
* src/xterm.c (x_atom_refs): New atom _NET_WM_FRAME_TIMINGS.
(x_sync_update_finish, x_sync_update_begin): New frame.
(x_update_begin, x_update_end, XTframe_up_to_date): Begin and
end frames accordingly if extended frame synchronization is
enabled.
(handle_one_xevent): Ignore timing and frame drawn events.
* src/xterm.h (struct x_display_info): New atom.
(FRAME_X_COUNTER_VALUE): New macro.
Po Lu [Fri, 29 Jul 2022 00:50:55 +0000 (08:50 +0800)]
Don't offer meaningless selection targets during drag-and-drop
* lisp/select.el (xselect-dnd-target-available-p): New function.
(selection-converter-alist): Register it as the availability
function for DND specific targets.