Po Lu [Sat, 6 Nov 2021 12:59:08 +0000 (20:59 +0800)]
Make "open in new window" from an xwidget's context menu work
* doc/lispref/commands.texi (Xwidget Events): Document new event type.
* doc/lisprefdisplay.texi (Xwidgets): Document new argument to
make-xwidget, and new function.
* etc/NEWS: Document changes.
* lisp/xwidget.el: Bind xwidget-display-event to
xwidget-webkit-display-event.
(xwidget-webkit-import-widget): New function.
(xwidget-webkit-display-event): New command.
* src/keyboard.c (kbd_buffer_get_event): New event type.
(make_lispy_event): Handle XWIDGET_DISPLAY_EVENTs.
(syms_f_keyboard): Define new symbol.
* src/termhooks.h (enum event_kind): New enum XWIDGET_DISPLAY_EVENT.
* src/xwidget.c (webkit_create_cb)
(store_xwidget_display_event)
(webkit_ready_to_show)
(webkit_create_cb_1, webkit_create_cb)
(Fset_xwidget_buffer): New functions.
(Fmake_xwidget): Add internal argument RELATED and connect create
signal.
(syms_of_xwidget): Define now subrs.
* lisp/xwidget.el (xwidget-webkit-mode-map): Bind C-s and C-r to
webkit isearch.
(xwidget-webkit-isearch--string, xwidget-webkit-isearch--is-reverse):
New buffer-local variables.
(xwidget-webkit-isearch--update, xwidget-webkit-isearch-erasing-char)
(xwidget-webkit-isearch-printing-char, xwidget-webkit-isearch-forward)
(xwidget-webkit-isearch-backward, xwidget-webkit-isearch-exit):
New functions.
(xwidget-webkit-isearch-mode-map): New keymap.
(xwidget-webkit-isearch-mode): New minor mode.
* src/xwidget.c (Fxwidget_webkit_search)
(Fxwidget_webkit_next_result)
(Fxwidget_webkit_previous_result)
(Fxwidget_wenkit_finish_search): New functions.
(syms_of_xwidget): Define new built-ins.
(kill_buffer_xwidgets): Free search query if present.
* src/xwidget.h (struct xwidget): Add field for search query.
Po Lu [Sat, 6 Nov 2021 04:34:41 +0000 (12:34 +0800)]
Fix cursor for new widget views
* src/xwidget.c (Fmake_xwidget): Clear hit result.
(cursor_for_hit): Use integer hit result.
(define_cursors): Set hit result appropriately.
(widget_init_view): Set cursor to the existing hit result.
* src/xwidget.h (struct xwidget): Add hit result field.
Po Lu [Sat, 6 Nov 2021 02:37:25 +0000 (10:37 +0800)]
Display page titles in xwidget webkit header line
* lisp/xwidget.el (xwidget-webkit--title): New variable.
(xwidget-webkit-callback, xwidget-webkit-mode): Set header line format
and associated variables.
Po Lu [Fri, 5 Nov 2021 13:01:12 +0000 (21:01 +0800)]
Make the WebKit inspector available
* etc/NEWS: Document changes.
* src/xwidget.c (find_widget_at_pos)
(find_widget)
(find_widget_cb): New functions.
(struct widget_search_data): New structure.
(Fmake_xwidget): Enable web inspector for WebKit widgets.
(Fxwidget_perform_lispy_event): Use current focus instead of
hard-coded widget.
(xwidget_button_1, xwidget_button, xwidget_motion_or_crossing):
Use window at event position instead of the default widget.
Po Lu [Fri, 5 Nov 2021 11:32:20 +0000 (19:32 +0800)]
Add new tool-bar items to xwidget-webkit
* etc/images/README: Update copyright information for new images.
* etc/images/connect-to-url.pbm:
* etc/images/connect-to-url.xpm: Import new images from GNOME.
* lisp/xwidget.el (xwidget-webkit-tool-bar-map): New keymap variable.
(xwidget-webkit-mode): Set tool-bar-map to the appropriate map.
Po Lu [Fri, 5 Nov 2021 02:22:27 +0000 (10:22 +0800)]
Handle crossing events on xwidget windows correctly
* src/xterm.c (handle_one_xevent): Clear help and mouse face
when handling xwidget entry events.
* src/xwidget.c (xwidget_motion_or_crossing): Add device to crossing
events.
(x_draw_xwidget_glyph_string): Add EnterWindowMask and
LeaveWindowMask.
Po Lu [Fri, 29 Oct 2021 03:33:06 +0000 (11:33 +0800)]
Enable scrolling optimization for xwidgets
* src/dispextern.h (struct glyph): Store xwidget ID instead of a
reference.
* src/dispnew.c (scrolling_window): Enable scrolling optimization on
xwidget builds.
* src/xdisp.c (fill_xwidget_glyph_string, produce_xwidget_glyph):
Obtain xwidget from ID.
* src/xterm.c (x_scroll_run): Scroll xwidget windows.
* src/xwidget.c (id_to_xwidget_map, xwidget_counter): New xwidget
variables.
(Fmake_xwidget): Assign each xwidget a unique ID, and keep track of
that ID.
(xwidget_from_id): New function.
(syms_of_xwidget): Initialize id_to_xwidget_map.
(xwidget_end_redisplay): Lookup xwidgets via ID.
* src/xwidget.h (struct xwidget): Add ID field.
(xwidget_from_id): New function.
Po Lu [Thu, 28 Oct 2021 13:46:01 +0000 (21:46 +0800)]
Use an X window to display xwidgets on X11
Since Emacs draws using X11 primitives, Emacs drawing operations can
erase the GtkDrawingArea used to draw the offscreen widget, which
leads to unpleasant flickering effects, all of which can be prevented
by creating a native X window and drawing to that instead.
Stefan Kangas [Sat, 6 Nov 2021 23:41:14 +0000 (00:41 +0100)]
Ensure return value of ert-with-temp-directory
* lisp/emacs-lisp/ert-x.el (ert-with-temp-file): Ensure return
value when :directory is t is the directory name.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-x-tests-with-temp-directory): Extend test for the above.
Stefan Kangas [Sat, 6 Nov 2021 20:54:02 +0000 (21:54 +0100)]
Add generated suffix to test temp file names
* lisp/emacs-lisp/ert-x.el
(ert-with-temp-file): Add temp file name suffix based on file name of
caller. Reflow docstring.
(ert--with-temp-file-generate-suffix): New defun.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-x-tests--with-temp-file-generate-suffix): New test.
* doc/misc/eww.texi (Advanced): Document it.
* lisp/net/eww.el (eww-url-transformers): New user option.
(eww-remove-tracking): New default function.
(eww--transform-url): Helper function.
(eww-follow-link): Use it.
(eww): Ditto.
* doc/emacs/killing.texi (Clipboard): Refer to it.
* doc/lispref/frames.texi (Yanking Media): Document the mechanism.
* lisp/yank-media.el: New file.
* lisp/gnus/message.el (message-mode): Register a yank handler for
images.
(message-insert-screenshot): Factor out image code from here...
(message--yank-media-image-handler): ... to here.
Stefan Kangas [Fri, 5 Nov 2021 03:22:12 +0000 (04:22 +0100)]
New user option image-auto-resize-max-scale-percent
* lisp/image-mode.el (image-auto-resize-max-scale-percent): New
user option to limit how much 'fit-window' will scale up an image.
(image--scale-within-limits-p): New function.
(image-toggle-display-image): Respect above new user option.
Stefan Kangas [Fri, 5 Nov 2021 02:24:50 +0000 (03:24 +0100)]
New command image-transform-fit-to-window
* lisp/image-mode.el (image-auto-resize, image-transform-resize):
Add new value 'fit-window', meaning to scale the image up or down
to fit the window. (Bug#)
(image-transform-fit-to-window): New command.
(image-transform-fit-to-height, image-transform-fit-to-width):
Make obsolete in favor of above new command.
(image-mode-map): Bind "s w" to 'image-transform-fit-to-window'.
Move binding for obsolete command 'image-transform-fit-to-width'
to "s i".
(image-mode-map): Add menu entry for
'image-transform-fit-to-window'. Remove menu entries for above
obsolete commands.
* doc/emacs/files.texi (Image Mode): Update documentation.
(image-transform-fit-both): Doc fix.
* lisp/outline.el (outline-flag-region): Update buttons on most
outline toggling commands (bug#51629).
(outline--fix-up-all-buttons): Take a region as parameter.
(outline-cycle-buffer): Adjust call.
F. Jason Park [Fri, 11 Jun 2021 10:55:07 +0000 (03:55 -0700)]
Deprecate instead of redefine erc-server-reconnecting
* lisp/erc/erc-backend.el (erc-server-reconnecting,
erc--server-reconnecting): obsolete and replace the former with new
internal variant, which carries a simplified meaning.
(erc-server-reconnect-p, erc--server-reconnect-p): Obsolete and
replace the former with an internal function, and change behavior to
disregard `erc-server-reconnecting' when rendering verdict.
(erc-process-sentinel-2): ensure local var `erc--server-reconnecting'
is t when timers are scheduled or firing, and nil otherwise, including
after retries exhausted. This agrees with the straightforward way
`erc-server-reconnecting' has always been used by `erc-cmd-RECONNECT'.
(erc-server-connect): set `erc--server-reconnecting'.
* lisp/erc/erc.el (erc-cmd-RECONNECT): use `erc--server-reconnecting'
instead of `erc-server-reconnecting'.
Eli Zaretskii [Sat, 6 Nov 2021 17:14:55 +0000 (19:14 +0200)]
Improve latin-2-postfix and latin-2prefix input methods
* lisp/leim/quail/latin-pre.el ("latin-2-prefix"):
* lisp/leim/quail/latin-post.el ("latin-2-postfix"): Add variants
of "`s" and "s," for Romanian. Add key bindings for moving
between variants, when there are more than one. (Bug#51638)
Michael Albinus [Sat, 6 Nov 2021 16:27:16 +0000 (17:27 +0100)]
Merge from origin/emacs-28
5e9b4e70ab Fix dbus-test04-register-method on CentOS (Bug#51369) d96de23510 * lisp/transient.el: Update to package version v0.3.7-11-g... 7343b0d0e4 ; * etc/NEWS: Native compilation is more picky about missi... 0d6b2b0b9d ; * etc/PROBLEMS: Move entry about LLVM plugin to the righ...
Po Lu [Sat, 23 Oct 2021 11:51:31 +0000 (19:51 +0800)]
General improvements to NS port
* src/dispextern.h: Remove some !HAVE_NS conditionals around grab
related code.
* src/frame.c (gui_mouse_grabbed, gui_redo_mouse_highlight): Remove
!HAVE_NS conditionals around code.
* src/nsmenu.m (ns_update_menubar): Prevent recursive calls and enable
shallow updates on GNUstep.
(menuNeedsUpdate): Prevent recursive calls.
(ns_menu_show): Fix mysterious GC-related bug.
(update_frame_tool_bar_1): Work around mysterious toolbar sizing bug
on GNUstep.
* src/nsterm.h (struct ns_output): New field for tracking toolbar
visibility changes.
* src/nsterm.m (frame_set_mouse_pixel_position): Implement for
GNUstep.
(ns_redraw_scroll_bars): Enable for GNUstep.
(ns_clear_frame): Redraw scrollbars on GNUstep.
(ns_update_window_end): New function.
(ns_redisplay_interface): Add ns_update_window_end on GNUstep.
(- keyDown): Remove debug code that doesn't work on GNUstep.
(- mouseDown): Enable grab tracking on NS port.
(- resizeWithOldSuperviewSize): Fix build with NSTRACE.
* src/xdisp.c (note_tab_bar_highlight): Enable some code for NS port.
(struct ns_glyph_layout, enum lgstring_direction).
(enum gs_font_slant, enum gs_font_weight, enum gs_font_width)
(enum gs_specified, struct gs_font_data): New enumerators and
structures.
(ns_font_descs_match_p)
(ns_done_font_data, ns_get_font_data): New functions.
(ns_glyph_metrics): Stop escaping names.
(ns_spec_to_descriptor): Fix font descriptor creation for symbolic
font spec entires.
(ns_descriptor_to_entity): Create entries with the correct symbolic
styles.
(ns_fallback_entity): Fix fallback entity selection.
(ns_findfonts): Use our own font matcher instead of the broken GNUstep
matcher.
(ns_list_family): Remove obsolete comment.
(nsfont_open): Remove obsolete code, comments, and synthItal logic
which doesn't work on GNUstep.
(nsfont_encode_char): Use a type that can fit NSGlyph
(nsfont_draw): Chose correct font, remove obsolete mouse face logic,
obsolete comments, and switch to using glyph-based drawing instead of
character-based drawing.
(ns_font_shape, nsfont_shape): New functions.
(ns_uni_to_glyphs_1): New function.
(ns_uni_to_glyphs): Return glyphs instead of unicode codepoints.
(ns_glyph_metrics): Use NSGlyphs instead of unicode codepoints and fix
left bearing, right bearing, ascent and descent computation.
(struct nsfont_driver): Add shaping capability.
* src/nsterm.h (struct nsfont_info): Use unsigned int for glyph cache.
* src/nsterm.c (ns_focus): Set DPS clipping on GNUstep.
(ns_compute_glyph_string_overhangs): Fix overhang computation by using
xterm code.
(ns_draw_window_cursor): Simplify cursor drawing.
(ns_maybe_dumpglyphs_background): Test for cursor HL and remove
obsolete mouse face logic.
(ns_dumpglyphs_image)
(ns_dumpglyphs_box_or_relief): Rectify for new cursor logic.
(ns_dumpglyphs_stretch): Rectify for new cursor logic and rely on
ns_draw_glyph_string to set focus.
(ns_draw_glyph_string_foreground): Remove mouse face logic.
(ns_draw_glyph_strings): Implement overhangs, remove obsolete
comment, and always focus before dumping glyphs.
(ns_draw_text_decoration): Add condition for DRAW_CURSOR and simplify
color selection.
(ns_define_frame_cursor): Remove nonsensical code (define_frame_cursor
has nothing to do with the text cursor, aka caret).
* src/xdisp.c (draw_glyphs): Enable code for NS port to fix mouse face
cursor display.
* src/macfont.m (get_cgcolor_from_nscolor): New function.
(macfont_draw): Remove obsolete mouse-face code and enable cursor
display.
Eli Zaretskii [Sat, 6 Nov 2021 10:33:26 +0000 (12:33 +0200)]
Improve detection of suspicious reordering in source code
* src/bidi.c (bidi_find_first_overridden): Detect suspiciously
reordered EN types as well.
* test/src/xdisp-tests.el
(xdisp-tests--find-directional-overrides-case-1): Rename from
'xdisp-tests--find-directional-overrides'.
(xdisp-tests--find-directional-overrides-case-2): New test.
Eli Zaretskii [Sat, 6 Nov 2021 09:21:43 +0000 (11:21 +0200)]
Merge from origin/emacs-28
9bdb1d0 ; * etc/PROBLEMS: Describe a crash in xwidgets due to Bubblew... 550887c ; * etc/PROBLEMS: Rearrange and update the section about cras... c2e3cd6 Clarify "text area of a window" in the documentation 4e7e78d Improve docstring of kmacro-set-format
Eli Zaretskii [Sat, 6 Nov 2021 09:21:08 +0000 (11:21 +0200)]
; Merge from origin/emacs-28
The following commits were skipped:
b1885ac ; * etc/NEWS: slightly more careful wording 6ee929c Use current face foreground for SVG icons in customize 82529b9 ; * etc/NEWS: Improve wording of a recently changed entry. e9c7a49 ; * etc/NEWS: Improve NEWS entry for Image-Dired. 2de7be4 ; * etc/NEWS: Various fixes.
Eli Zaretskii [Sat, 6 Nov 2021 06:59:09 +0000 (08:59 +0200)]
Clarify "text area of a window" in the documentation
* src/keyboard.c (Fposn_at_x_y): Clarify that the Y coordinate
includes the header-line and the tab-line. (Bug#51590)
* doc/lispref/windows.texi (Window Sizes, Splitting Windows)
(Textual Scrolling, Coordinates and Windows): Fix/remove improper
or confusing uses of "text area" of a window.
Stefan Kangas [Sat, 6 Nov 2021 04:37:08 +0000 (05:37 +0100)]
Improve docstring of kmacro-set-format
* lisp/kmacro.el (kmacro-set-format): Improve docstring.
(kmacro-insert-counter, kmacro-display-counter)
(kmacro-set-counter, kmacro-add-counter): Add cross-references
to the info manual.