Juri Linkov [Mon, 10 Jan 2022 18:20:09 +0000 (20:20 +0200)]
* lisp/outline.el: Don't set outline-minor font-lock text property 'keymap'.
Instead of adding font-lock text property 'keymap' with
outline-minor-mode-cycle on headings in outline-minor-mode,
check for outline-minor-mode-cycle and outline-on-heading-p
in :filter on keys from the keymap of outline-minor-mode.
https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00180.html
(outline-minor-mode-cycle--bind): Add a condition on outline-minor-mode-cycle
and outline-on-heading-p in :filter.
(outline-font-lock-keywords): Remove if-branches for outline-minor-mode-cycle
that added keymap.
(outline-minor-mode-highlight-buffer): Don't put keymap on overlays.
(outline-minor-mode): Rewrite :keymap setting to rely on
easy-mmode-define-keymap, and add :inherit outline-minor-mode-cycle-map.
Don't check for outline-minor-mode-cycle to add font-lock keywords.
(outline--insert-open-button, outline--insert-close-button):
Remove :parent outline-minor-mode-cycle-map.
Po Lu [Mon, 10 Jan 2022 11:26:46 +0000 (19:26 +0800)]
Allow controlling the underline position of faces
* doc/lispref/display.texi (Face Attributes): Document new
`:position' property of the `:underline' attribute.
* etc/NEWS: Announce new property.
* lisp/cus-face.el (custom-face-attributes): Implement
customization for new face attribute.
* src/dispextern.h (struct face): New fields
`underline_pixels_above_descent_line' and
`underline_at_descent_line_p'.
* src/haikuterm.c (haiku_draw_text_decoration):
* src/nsterm.m (ns_draw_text_decoration):
* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string): Respect new face fields.
* src/xfaces.c (realize_gui_face): Handle new `:position'
keyword.
(syms_of_xfaces): New symbol `:position'.
Po Lu [Mon, 10 Jan 2022 09:59:17 +0000 (09:59 +0000)]
Load X resources from a settings file like other programs on Haiku
* doc/emacs/haiku.texi (Haiku Basics): Document how X resources
are discovered on Haiku.
* src/haiku_support.cc (class Emacs): Load settings file.
(be_find_setting): New function.
* src/haiku_support.h (be_find_setting): New prototype.
* src/haikuterm.c (get_string_resource): Look in the settings
file if there's nothing in the in-memory resource database.
Po Lu [Mon, 10 Jan 2022 02:32:01 +0000 (02:32 +0000)]
Don't hard code key codes on Haiku
* src/haiku_support.cc (keysym_from_raw_char): New function.
(DispatchMessage): Map raw character to keysym if applicable.
(be_map_key): Delete function.
* src/haiku_support.h (struct haiku_key_event): Update fields
to hold keysym and character instead.
* src/haikuterm.c (haiku_read_socket): Don't call be_map_key,
and use keysym field if provided instead.
Po Lu [Sun, 9 Jan 2022 12:43:17 +0000 (20:43 +0800)]
Pass through caret position from native GTK input methods
* src/gtkutil.c (xg_im_context_preedit_changed): Set caret
position appropriately.
* src/xfns.c (xg_widget_key_press_event_cb): Ignore modifier
keys.
(xic_preedit_caret_callback, xic_preedit_draw_callback):
Constrain caret position to the string length as well.
Po Lu [Sun, 9 Jan 2022 11:46:14 +0000 (19:46 +0800)]
Display caret in preedit text where the input method asked
* src/xfns.c (xic_preedit_start_callback): Clear caret position.
(xic_preedit_caret_callback): Record new caret position and
announce it.
(xic_preedit_done_callback): Clear caret position.
(xic_preedit_draw_callback): Set caret position appropriately.
Po Lu [Sun, 9 Jan 2022 10:14:26 +0000 (18:14 +0800)]
Fix native GTK input for cyrillic input methods
* src/gtkutil.c (xg_widget_key_press_cb): Get unicode mapping of
keyval if string doesn't exist.
* src/xterm.c (handle_one_xevent): Fix build without
HAVE_X_I18N.
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.