Eli Zaretskii [Sat, 1 Jan 2022 12:03:03 +0000 (07:03 -0500)]
Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years.
Po Lu [Sat, 1 Jan 2022 11:33:01 +0000 (19:33 +0800)]
Increase size of precision scrolling momentum ring
* lisp/pixel-scroll.el
(pixel-scroll-precision-initial-velocity-factor): Fix
calculation of last timestamp.
(pixel-scroll-precision):
(pixel-scroll-kinetic-state):
(pixel-scroll-accumulate-velocity):
(pixel-scroll-start-momentum):
(pixel-scroll-calculate-velocity): Increase default ring size
to 30.
Po Lu [Sat, 1 Jan 2022 10:29:44 +0000 (10:29 +0000)]
Make last change compile
* src/haiku_support.cc (EmacsShow): Fix last change.
(TearDownDoubleBuffering): Likewise.
(Draw): Draw normally if not double buffered even if shown_flag
is true.
Po Lu [Sat, 1 Jan 2022 09:56:14 +0000 (09:56 +0000)]
Fix some more off-by-one errors in Haiku image code
* src/haiku_draw_support.cc (BView_DrawBitmapWithEraseOp):
(BView_DrawMask):
(BBitmap_transform_bitmap):
* src/haiku_support.cc (AttachCairoSurface): Adjust calculations
to take account of BRect width and height functions returning
(start - end) instead of the actual width and height of the
rectangle.
Po Lu [Sat, 1 Jan 2022 09:33:15 +0000 (09:33 +0000)]
Fix deadlocks with invisible frames and threads in Haiku
* src/haiku_support.cc (class EmacsWindow): New field
`was_shown_p'.
(EmacsShow): Lock looper if the window wasn't ever visible.
(BWindow_new): Unlock window looper after creating it.
Po Lu [Fri, 31 Dec 2021 13:03:07 +0000 (13:03 +0000)]
On Haiku, sync a frames's connection to the app sever after raising
* src/haiku_support.h: (BWindow_sync)
* src/haiku_support.cc (BWindow_sync): New function.
* src/haikuterm.c (haiku_frame_raise_lower): Synchronize window
after raising it to avoid situations where raising windows is
done out-of-order, such as when ediff raises a frame.
Po Lu [Fri, 31 Dec 2021 09:31:27 +0000 (09:31 +0000)]
Use a single global lock for the child frame state on Haiku
Each BWindows (and various system callbacks) runs in a separate
thread, so there are very complicated locking semantics that
used to be handled manually. This changes child frame state to
use a single global lock, which makes things much easier.
* src/haiku_support.cc (child_frame_lock): New variable.
(class EmacsWindow):
(~EmacsWindow):
(Unparent):
(ParentTo):
(MoveChild):
(FrameMoved):
(EmacsHide):
(EmacsShow):
(GetParentWidthHeight):
(OffsetChildRect):
(MakeFullscreen):
(SetUpDoubleBuffering): Use a single lock for controlling access
to child frame state.
Stephen Berman [Fri, 31 Dec 2021 09:25:52 +0000 (10:25 +0100)]
Fix handling of webkit xwidget bookmarks
Make jumping to a bookmarked webkit xwidget in another window or
another frame show the xwidget only in that window or frame and
refactor new session code used by the bookmark code (bug#52856).
In addition, make xwidget-webkit-clone-* commands work.
* lisp/xwidget.el (xwidget-webkit-clone-and-split-below)
(xwidget-webkit-clone-and-split-right): Unbreak these functions by
passing just the URL to them, not the message displaying it.
(xwidget-webkit-bookmark-jump-new-session): Adjust doc string,
rephrasing and removing a customization suggestion that cannot
take effect.
(xwidget-webkit-bookmark-jump-handler): New autoloaded function.
(xwidget-webkit-bookmark-make-record): Use it.
(xwidget-webkit--create-new-session-buffer): New function
extracted from `xwidget-webkit-new-session'.
(xwidget-webkit-new-session): Use it.
Juri Linkov [Fri, 31 Dec 2021 09:20:51 +0000 (11:20 +0200)]
* lisp/tab-line.el (tab-line--get-tab-property): New function (bug#52881).
(tab-line-auto-hscroll): Use ‘tab-line--get-tab-property’ instead of
‘get-pos-property 1’, and ‘get-text-property’ instead of
‘get-pos-property’.
(tab-line-select-tab, tab-line-close-tab): Use tab-line--get-tab-property.
Eli Zaretskii [Fri, 31 Dec 2021 08:56:28 +0000 (10:56 +0200)]
Minor improvements of 'lisp-directory' docs
* lisp/startup.el (lisp-directory):
* etc/NEWS:
* doc/lispref/loading.texi (Library Search): Improve wording of
documentation of 'lisp-directory' and related features.
Po Lu [Fri, 31 Dec 2021 07:29:30 +0000 (07:29 +0000)]
Prevent double buffering from being disabled on USE_BE_CAIRO builds
The direct rendering code used in that situation never
completely worked, and the BDirectWindow destructor is also
buggy. Completely remove that code in order to let us inherit
from BWindow, so as to prevent the buggy destructor from being
run.
* src/haiku_support.cc (cairo_format_from_color_space): Delete
function.
(class EmacsWindow): Inherit from BWindow.
(EmacsWindow): Call BWindow constructor instead.
(MessageReceived):
(DispatchMessage):
(FrameResized):
(FrameMoved):
(Zoom): Call BWindow functions instead.
(EmacsView_cairo_surface): Stop looking for surfaces in the
window.
(EmacsWindow_begin_cr_critical_section):
(EmacsWindow_end_cr_critical_section): Stop locking the window.
* src/haikufns.c (haiku_set_inhibit_double_buffering): Always
enable double buffering on Cairo builds.
Stefan Monnier [Fri, 31 Dec 2021 04:17:45 +0000 (23:17 -0500)]
Don't store docstrings of preloaded .el files in etc/DOC
Since the location of those files changes between build time and
installation time, this requires to tweak the file name used in those
(#$ . NNN) references during the dump so they don't hardcode the build
directory. We do it in the same way as was already done for those
same file names in `load-history`, except we convert them back to
absolute file names more lazily (i.e. when fetching the actual
docstring rather than at startup), which requires remembering the
`lisp-dir` computed at startup in the new `lisp-directory` variable.
* src/Makefile.in ($(etc)/DOC): Don't scan Lisp files any more.
* src/lread.c (Fload): Use relative file names for `load-file-name`
when preloading for the dump, like we already did for `current-load-list`.
(read_list): Don't zero-out dynamic docstring references during the
preload since they won't be filled later by Snarf-documentation any more.
(read1): Remove the hash-hack for doc references that were zeroed.
* lisp/startup.el (lisp-directory): New variable.
(command-line): Set it.
* src/doc.c (get_doc_string): Use `lisp-directory` for dynamic
docstring references using relative file names.
(syms_of_doc): Add `Qlisp_directory`.
* lib-src/make-docfile.c (scan_file): Don't handle `.el` or `.elc`
files any more.
(IS_SLASH): Remove macro, not used any more.
(skip_white, read_lisp_symbol, search_lisp_doc_at_eol)
(scan_lisp_file): Remove functions, not used any more.
Po Lu [Fri, 31 Dec 2021 02:07:30 +0000 (10:07 +0800)]
Add pinch event support to xwidgets
* src/xterm.c (handle_one_xevent): Pass through pinch events to
xwidgets and provide root coordinates when translating motion
events.
* src/xwidget.c (xwidget_motion_notify): Use provided root
window coordinates.
(xwidget_pinch): New function.
* src/xwidget.h (xwidget_motion_notify): Update prototype.
(xwidget_pinch): New function prototype.
Po Lu [Fri, 31 Dec 2021 01:27:12 +0000 (09:27 +0800)]
Restore original xwidget embedder after performing a lispy event
* src/xwidget.c (Fxwidget_perform_lispy_event): Restore original
embedder after performing event.
(Fdelete_xwidget_view): Block input around non-reentrant
section.
Eli Zaretskii [Thu, 30 Dec 2021 18:28:58 +0000 (20:28 +0200)]
Avoid assertion violations with variable-weight fonts
* src/font.c (font_score, font_delete_unmatched): Don't assume
weight, slant, and width properties of the font must be fixnums:
some variable-weight fonts violate that assumption. Reported
by Sean Whitton <spwhitton@spwhitton.name>. Do not merge to
master. (Bug#52888)
Philipp Stephani [Thu, 30 Dec 2021 15:59:16 +0000 (16:59 +0100)]
Properly report errors about unbound ERT test symbols.
Assertions should only be used to check internal consistency within a
package, not to check arguments passed by callers. Instead, define
and use a new error symbol.
* lisp/emacs-lisp/ert.el (ert-test-unbound): New error symbol.
(ert-select-tests): Use it.
* test/lisp/emacs-lisp/ert-tests.el (ert-test-select-undefined): New
unit test.
Eli Zaretskii [Thu, 30 Dec 2021 14:44:13 +0000 (16:44 +0200)]
Fix multisession-tests on MS-Windows
* test/lisp/emacs-lisp/multisession-tests.el
(multi-test-files-simple): On MS-Windows and Haiku, wait before
invoking the Emacs sub-process, not after, to ensure the later
update is detected with 1-sec file time resolution.
Alan Mackenzie [Thu, 30 Dec 2021 11:32:25 +0000 (11:32 +0000)]
CC Mode: Prevent rapid alternation of fontification of "found types"
This fixes bug #52863.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): When a new type is
found, postpone entering it into c-found-types (and thus triggering the
fontification of that type throughout the buffer) until the end of the
function, when we're sure that the "type" found actually is a type.
Eli Zaretskii [Thu, 30 Dec 2021 11:21:01 +0000 (13:21 +0200)]
Fix start-of-box-face display after display and overlay strings
* src/xdisp.c (pop_it): Recompute the 'start_of_box_run_p' flag,
like we do in 'handle_fontified_prop', when faces change while
iterating over a buffer or string. (Bug#51550)
Po Lu [Thu, 30 Dec 2021 07:04:18 +0000 (15:04 +0800)]
Make xwidget motion commands hscroll the window of wide widgets
* lisp/xwidget.el (xwidget-info): New function declaration.
(xwidget-webkit-scroll-forward):
(xwidget-webkit-scroll-backward): Hscroll the window if the
widget is wider than the text area. (bug#52885)
* src/xwidget.c (xwidget_scroll, xwidget_motion_notify): Apply
clip offsets to coordinates.
Po Lu [Thu, 30 Dec 2021 02:04:29 +0000 (10:04 +0800)]
Use XRandR 1.5 to generate monitor attributes if available
* src/xfns.c (x_get_monitor_attributes_xrandr): Use XRR 1.5 if
present.
(xlw_monitor_dimensions_at_pos_1): Remove redundant XRR 1.5
code.
(xlw_monitor_dimensions_at_pos): Rely on
`x_get_monitor_attributes_xrandr' to retrieve the workarea
instead.
Juri Linkov [Wed, 29 Dec 2021 18:52:11 +0000 (20:52 +0200)]
* lisp/textmodes/sgml-mode.el (sgml-mode): Set skeleton-end-newline to nil.
Prevent skeleton.el from adding a newline to each inserted
skeleton. Those which do want a newline do that explicitly in
their define-skeleton form. This is what texinfo-mode does (bug#52864).
Eli Zaretskii [Wed, 29 Dec 2021 14:39:20 +0000 (16:39 +0200)]
Improve documentation of 'M-X' and related features
* doc/emacs/m-x.texi (M-x): Index 'M-X'.
* doc/lispref/commands.texi (Interactive Call, Command Modes):
Mention 'M-X' and 'execute-extended-command-for-buffer'.
* etc/NEWS: Clarify that the '(declare (completion ...' and
'(declare (modes ...' forms have no effect by default. Likewise
for '(interactive "..." MODE)' specs. (Bug#52839)
Po Lu [Wed, 29 Dec 2021 10:37:04 +0000 (18:37 +0800)]
Translate state of XI2 entry events when sending them to xwidgets
* src/xwidget.c (xi_translate_notify_detail): New function.
(xwidget_motion_or_crossing): Translate detail and state of
GenericEvents before sending them to the widget.
Po Lu [Wed, 29 Dec 2021 01:53:42 +0000 (09:53 +0800)]
Add support for xwidgets to the PGTK port
* src/emacsgtkfixed.c (EMACS_FIXED_GET_CLASS): New function.
(struct GtkFixedPrivateL): New struct.
(emacs_fixed_gtk_widget_size_allocate):
(emacs_fixed_class_init): New functions.
* src/keyboard.h: Declare lispy_function_keys also when
HAVE_PGTK.
* src/pgtkterm.c (x_free_frame_resources): Destroy all xwidget
views.
(pgtk_scroll_run): Move xwidget views that overlap with the
scrolled area.
(pgtk_emacs_to_gtk_modifiers): Expose function.
* src/pgtkterm.h: Wrap in include guard.
(pgtk_emacs_to_gtk_modifiers): New prototype.
* src/xwidget.c (xw_forward_event_translate):
(xw_forward_event_from_view): New functions.
(Fmake_xwidget): Remove obsolete PGTK specific code.
(Fxwidget_perform_lispy_event): Convert modifiers correctly on
PGTK.
(define_cursors): Use GDK functions to define cursors on PGTK.
(xwidget_view_from_window): Disable on non-PGTK builds.
(xwidget_show_view):
(xwidget_hide_view): Implement on PGTK.
(xv_do_draw): Disable on non-PGTK builds.
(offscreen_damage_event): Queue xwidget views for draw.
(xwidget_expose): Disable on non-PGTK builds.
(xwidget_init_view):
(x_draw_xwidget_glyph_string):
(Fdelete_xwidget_view): Implement for PGTK.
(syms_of_xwidget): Don't initialize XID to widget table on PGTK.
(lower_frame_xwidget_views): Disable on PGTK.
* src/xwidget.h (struct xwidget_view): New fields for PGTK
builds.
(kill_frame_xwidget_views): Enable on PGTK.