Stefan Kangas [Sun, 9 Jan 2022 10:11:47 +0000 (11:11 +0100)]
New minor mode elide-head-mode
* lisp/elide-head.el (elide-head-mode): New minor mode. (Bug#52980)
(elide-head--delete-overlay, elide-head--show)
(elide-head--hide): New functions factored out from ...
(elide-head, elide-head-show): ... here. Make obsolete in favor
of elide-head-mode.
(elide-head-headers-to-hide): Doc fix.
* test/lisp/elide-head-tests.el (ert-x): Require.
(elide-head-tests-elide-head-mode)
(elide-head-tests-elide-head-mode/enable-disable)
(elide-head-tests-elide-head-mode/normal-mode)
(elide-head-tests-elide-head-mode/revert-buffer): New tests.
(elide-head--add-test): Update test to use elide-head-mode.
(elide-head-tests-elide-head)
(elide-head-tests-elide-head-with-prefix-arg)
(elide-head-tests-show): Make obsolete.
Po Lu [Sat, 8 Jan 2022 10:24:53 +0000 (18:24 +0800)]
Add an option to rely on passive touch grabs on X
This prevents crashes with three-finger touch gestures on
Xwayland running on GNOME Shell, and also when running some
programs that make use of an Emacs window's XID on the same X
server.
* src/xterm.c (handle_one_xevent): Respect
`x-input-grab-touch-events'.
(syms_of_xterm): New option `x-input-grab-touch-events.
Po Lu [Sat, 8 Jan 2022 07:21:51 +0000 (15:21 +0800)]
Allow using GTK+ to handle input methods on X
* doc/emacs/xresources.texi (Table of Resources): Document new
value of `inputStyle'.
* etc/NEWS: Announce new option.
* lisp/cus-start.el (standard): Add `x-gtk-use-native-input'.
* src/gtkutil.c (xg_mark_data): Mark xg_pending_quit_event.
(xg_add_virtual_mods):
(xg_im_context_commit):
(xg_im_context_preedit_changed):
(xg_im_context_preedit_end):
(xg_widget_key_press_event_cb):
(xg_filter_key): New functions.
* src/gtkutil.h: Add prototype for `xg_filter_key'.
* src/xfns.c (xic_set_preeditarea): Set cursor location for the
GTK IM context as well.
* src/xterm.c (xg_pending_quit_event): New variable.
(x_focus_changed): Set focus on the GTK input context as well.
(x_filter_event): Filter events through GTK if the user asked
for it.
(handle_one_xevent): Likewise.
(XTread_socket): Set hold_quit to xg_pending_quit_event if it
exists.
(x_draw_window_cursor): Always set preedit area even if XIC
doesn't exist.
* src/xterm.h (struct x_display_info): New field
`prefer_native_input'.
(struct x_output): New field `im_context'.
Po Lu [Fri, 7 Jan 2022 06:35:29 +0000 (14:35 +0800)]
Display pre-edit information from X input methods
This also repurposes the `pgtk-preedit-text' event to be
meaningful on X, renames it `preedit-text', and documents it.
* doc/lispref/commands.texi (Misc Events): Document
`preedit-text'.
* lisp/term/pgtk-win.el (pgtk-preedit-text): Bind to
`preedit-text' instead.
* lisp/term/x-win.el (x-preedit-overlay): New variable.
(x-preedit-text): New command, bound as a special event to
`preedit-text'.
* src/xfns.c (Xxic_preedit_draw_callback):
(Xxic_preedit_caret_callback):
(Xxic_preedit_done_callback):
(Xxic_preedit_start_callback): New callback variables.
(STYLE_OFFTHESPOT, STYLE_OVERTHESPOT):
(STYLE_ROOT, STYLE_CALLBACK, STYLE_NONE): New macros.
(supported_xim_styles): Use reasonable values. This also serves
as a better fix for bug#10867.
(best_xim_style): Restore code deleted as part of the original
fix for bug#10867.
(create_frame_xic): Add preedit callbacks.
(xic_set_preeditarea): Add preedit callbacks.
(x_xic_to_frame):
(xic_preedit_start_callback):
(xic_preedit_caret_callback):
(xic_preedit_done_callback):
(x_xim_text_to_utf8_unix):
(xic_preedit_draw_callback): New functions.
* src/xterm.c (x_detect_focus_change): Fix type of XI event.
(x_free_frame_resources): Free preedit text buffer if still
present.
* src/xterm.h (struct x_output): New fields `preedit_size',
`preedit_chars' and `preedit_active'.
Eli Zaretskii [Thu, 6 Jan 2022 12:16:53 +0000 (14:16 +0200)]
Revert "Fix selection of fonts that don't have regular weight"
This reverts commit 1b2511fa2aed460120a36765ba16c14e355eef1d.
That commit caused unintended regressions which are worse
than the problem it attempted to fix. See the discussion at
Po Lu [Thu, 6 Jan 2022 12:05:47 +0000 (12:05 +0000)]
Remove some more useless clipping stack calls on Haiku
* src/haikuterm.c (haiku_draw_box_rect):
(haiku_draw_relief_rect):
(haiku_draw_text_decoration): Get rid of calls to
BView_StartClip and BView_EndClip.
Po Lu [Thu, 6 Jan 2022 06:02:43 +0000 (14:02 +0800)]
Fix duplicate overhang display on GNUstep
* src/nsfont.m (nsfont_draw): Stop saving DPS clip and remove
workaround for bad clipping.
* src/nsterm.m (ns_draw_glyph_string): Clip to glyph string rect
when displaying overhangs.
Juri Linkov [Wed, 5 Jan 2022 18:47:20 +0000 (20:47 +0200)]
* lisp/textmodes/paragraphs.el (repunctuate-sentences): Use filter variable.
(repunctuate-sentences-filter)<defun>:
Reimplement without using match data.
(repunctuate-sentences-filter)<defvar>: New variable.
(repunctuate-sentences): Use new variable.
Remove regexp group from spaces as was before.
https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00395.html
Eli Zaretskii [Wed, 5 Jan 2022 13:11:24 +0000 (15:11 +0200)]
Fix info-lookup docs and "C-h S" in major-modes with no manuals
* lisp/info-look.el (info-lookup-alist, info-lookup-add-help)
(info-lookup-symbol, info-lookup-file, info-lookup)
(info-lookup-interactive-arguments): Clarify and expand the doc
strings.
(info-lookup-change-mode): Topic values can have their `:mode' as
a cons cell, not just a mode's symbol; support that.
Po Lu [Wed, 5 Jan 2022 12:02:32 +0000 (12:02 +0000)]
Enable subpixel antialiasing on the Cairo font driver on Haiku
* src/ftcrfont.c (ftcrfont_open): Manually enable subpixel
antialiasing on Haiku.
* src/haiku_support.cc
(get_subpixel_antialiasing): New function declaration.
(be_use_subpixel_antialising):
* src/haiku_support.h (be_use_subpixel_antialising): New
functions.
Po Lu [Wed, 5 Jan 2022 06:53:57 +0000 (14:53 +0800)]
Make sure mouse face doesn't stay on the cursor after it is cleared
cursor_in_mouse_face_p will still return true when the phys
cursor is drawn inside show_mouse_face when called by
clear_mouse_face, since that drawing happens before
hlinfo->mouse_face_window can be set to nil.
However, the row's mouse_face_p will be adjusted before the
cursor is drawn in show_mouse_face, so it can be used to
determine if the cursor is actually under mouse face.
* src/xdisp.c (fill_composite_glyph_string):
(fill_gstring_glyph_string):
(fill_glyphless_glyph_string):
(fill_glyph_string):
(fill_xwidget_glyph_string):
(fill_stretch_glyph_string): Only apply mouse face when
DRAW_CURSOR if the row is also mouse_face_p.
(set_glyph_string_background_width): Only adjust width if the
row holding the cursor is also mouse_face_p.
Dmitry Gutov [Wed, 5 Jan 2022 02:08:10 +0000 (04:08 +0200)]
Fix vc-git with old Git over Tramp and cygwin-mount.el
* lisp/vc/vc-git.el (vc-git-use-literal-pathspecs): New variable.
(vc-git-command, vc-git--call): Use it to determine whether to set
GIT_LITERAL_PATHSPECS=1 (bug#51497).
(vc-git--literal-pathspec, vc-git--literal-pathspecs): Remove.
Update all callers. This reverts the previous solution for bug#39452.
* lisp/progmodes/project.el (project--vc-list-files):
Use the new variable.
Po Lu [Wed, 5 Jan 2022 01:39:57 +0000 (09:39 +0800)]
Correctly set up XI key input mask on X Toolkit builds
* src/xfns.c (setup_xi_event_mask): Also set the key event mask
on the outer window, which might also have the input focus.
(x_window) [USE_X_TOOLKIT]: Set up XI event mask a bit later.
If a configured completion style does not exist, throw a meaningful
error. Also make completion-styles-alist a defvar, since completion
styles like orderless extend it.
* lisp/minibuffer.el (completion-styles-alist): Make it a defvar.
(completion--nth-completion): Give a more meaningful error.
Eli Zaretskii [Tue, 4 Jan 2022 13:37:16 +0000 (15:37 +0200)]
A cleaner fix for display bug#52947
* src/xdisp.c (tab_bar_height, redisplay_tab_bar): Don't call
set_iterator_to_next here...
(display_tab_bar_line): ...call it here, even if we exit the loop
because we encounter a newline.
Po Lu [Tue, 4 Jan 2022 11:30:07 +0000 (19:30 +0800)]
Stop assuming X kbd state works with GDK when forwarding events to xwidgets
* src/xwidget.c (xw_translate_x_modifiers): New function.
(Fxwidget_perform_lispy_event): Translate X modifiers to GDK
modifiers before sending them to the xwidget.
Jim Porter [Mon, 3 Jan 2022 06:08:52 +0000 (22:08 -0800)]
Prevent further cases of duplicated separators in context menus
In some cases, context menu items are added before the overall prompt
string. This could cause multiple consecutive separators to appear if
they "surround" the prompt string. (Bug#52293)
* lisp/mouse.el (context-menu-map): Improve the de-duplication logic
to ignore non-menu-items when checking for consecutive separators.
* test/lisp/mouse-tests.el
(context-menu-map-remove-consecutive-separators)
(context-menu-map-remove-separators-at-beginning-or-end): New tests.
Po Lu [Tue, 4 Jan 2022 06:48:08 +0000 (06:48 +0000)]
Make menu bar key navigation work on Haiku
* src/haiku_support.cc (menu_bar_active_p): New variable.
(DispatchMessage): Pass through key events if the menu bar is
active.
(MenusBeginning, MenusEnd): Set `menu_bar_active_p' according
to the state of the menu bar.
(BMenuBar_delete): Clear `menu_bar_active_p'.
* src/haikufns.c (haiku_free_frame_resources): Block input only
after checking that F is a window system frame.
* src/haikumenu.c (Fhaiku_menu_bar_open): Update doc string.
Po Lu [Tue, 4 Jan 2022 05:22:56 +0000 (05:22 +0000)]
Find a way to make restacking frames work on Haiku
* doc/lispref/frames.texi (Raising and Lowering): Update
documentation to reflect that restacking frames is now
supported on Haiku.
* lisp/frame.el (haiku-frame-restack): New declaration.
(frame-restack): Use `haiku-frame-restack' on Haiku.
* src/haiku_support.cc (BWindow_send_behind):
* src/haiku_support.h (BWindow_send_behind):
* src/haikufns.c (Fhaiku_frame_restack): New functions.
(syms_of_haikufns): New subr `haiku-frame-restack'.