Commit graph

182 commits

Author SHA1 Message Date
Po Lu
333e95196f * lisp/xwidget.el (xwidget-webkit-edit-mode-map): Pass C-backspace. 2022-01-27 14:07:08 +08:00
Eli Zaretskii
dcd76bd48d 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.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Stephen Berman
95ee6e8b90 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.
2021-12-31 10:25:52 +01:00
Po Lu
37ad776b9e 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.
2021-12-30 15:05:39 +08:00
Po Lu
bdcf3c3504 Cancel xwidget progress timer when buffer is killed
* lisp/xwidget.el (xwidget-webkit-buffer-kill): New function.
(xwidget-webkit-mode): Add `xwidget-webkit-buffer-kill' to
`kill-buffer-hook'.  (bug#52344)
2021-12-07 13:44:52 +08:00
Po Lu
9324efac48 Make `xwidget-display-event' a special event as well
* doc/lispref/commands.texi (Xwidget Events): Document that
`xwidget-display-event' is a special event, and that it should
be handled through callbacks.

* etc/NEWS: Update NEWS entry.

* lisp/xwidget.el (xwidget-webkit-new-session)
(xwidget-webkit-import-widget): Attach display callback.
(xwidget-webkit-display-event): Call display callback instead.
(xwidget-webkit-display-callback): New function.

* src/keyboard.c (make_lispy_event): Store
source information for XWIDGET_DISPLAY_EVENT correctly.

* src/xwidget.c (store_xwidget_display_event): Store
source of the display request.
(webkit_ready_to_show): Store source if available.
(webkit_create_cb_1): Store source if available.
(kill_xwidget): Remove dead widget from internal_xwidget_list.
2021-11-22 10:47:29 +08:00
Po Lu
890fd7760c Add a user command to stop page loading in xwidget-webkit
* lisp/xwidget.el: Add `xwidget-webkit-stop' to menu.
(xwidget-webkit-stop): New command.
(xwidget-webkit-tool-bar-map): New tool bar item.
2021-11-21 13:32:03 +08:00
Po Lu
88458f7354 Make xwidget-events special and document xwidget callbacks
Users have always been supposed to use callbacks for handling
xwidget events, but for some reason this has not been
documented until now.

* doc/lispref/commands.texi (Xwidget Events): Document xwidget
callbacks and the special status of `xwidget-event's.

* doc/lispref/display.texi (Xwidgets): Add xwidget property
list functions to the concept index.

* lisp/xwidget.el: Make xwidget events special.
2021-11-20 14:57:22 +08:00
Po Lu
da508cf4bd Use xwidget-live-p' inside xwidget-at'.
It should no longer be possible for Lisp code to abuse internal
xwidget state, or cause crashes with killed xwidgets and such,
so the pedantic checking done in this function is no longer
necessary.  (In fact, it is even wrong, as it won't catch
killed xwidgets.)

* lisp/xwidget.el (xwidget-at): Use `xwidget-live-p'.
2021-11-20 14:33:47 +08:00
Po Lu
8331916c85 Remove nonsensical command in xwidget-webkit-mode-map
* lisp/xwidget.el (xwidget-webkit-mode-map): Remove nonsensical
command binding.
2021-11-20 14:33:47 +08:00
Po Lu
0a3b55aca3 Fix option type of `xwidget-webkit-cookie-file' again
* lisp/xwidget.el (xwidget-webkit-cookie-file): Revert changes
caused by rebase.
2021-11-20 14:15:46 +08:00
Po Lu
35de4774ca Clarify doc string in xwidget-webkit
* lisp/xwidget.el (xwidget-webkit-buffer-name-format): Update
doc string.
2021-11-20 14:12:44 +08:00
Glenn Morris
3817ced7ba * lisp/xwidget.el (xwidget-webkit-cookie-file): Fix type. 2021-11-19 18:36:03 -08:00
Po Lu
956f21b6b9 Make xwidget-webkit default to not storing cookies
* etc/NEWS: Update to reflect change.
* lisp/xwidget.el (xwidget-webkit-cookie-file): Set default
value to nil.
2021-11-20 08:38:04 +08:00
Eli Zaretskii
eb86c33c46 Fix documentation of last commit
* lisp/xwidget.el (xwidget-webkit-cookie-file): Don't use "path"
for file names in the doc string.  Improve wording and markup of
the doc string.

* src/xwidget.c (Fxwidget_webkit_set_cookie_storage_file):
* doc/lispref/display.texi (Xwidgets): Don't use "path" for file
names.

* etc/NEWS: Improve the wording of the entry about
'xwidget-webkit-cookie-file'.
2021-11-19 15:41:48 +02:00
Po Lu
b4f0c4c694 Allow controlling where xwidget-webkit stores cookies
* doc/lispref/display.texi (Xwidgets): Document new function.
* etc/NEWS: Announce `xwidget-webkit-cookie-file' and
`xwidget-webkit-set-cookie-storage-file'.

* lisp/xwidget.el (xwidget-webkit-cookie-file): New user
option.
(xwidget-webkit-new-session): Set cookie storage file.

* src/xwidget.c (Fmake_xwidget): Create new context for
each unrelated widget.
(Fxwidget_webkit_set_cookie_storage_file): New function.
(syms_of_xwidget): Define new subr.
2021-11-19 20:04:08 +08:00
Po Lu
a5e1f8bbdd Display page loading progress in xwidget webkit
* lisp/xwidget.el (xwidget-webkit--title): Remove internal
variable.
(xwidget-webkit--loading-p)
(xwidget-webkit--progress-update-timer): New variables.
(xwidget-webkit--update-progress-timer-function): New function.
(xwidget-webkit-callback): Set up progress update timer during
page loads.
(xwidget-webkit-mode): Add page load progress to header line
format.
2021-11-19 18:43:25 +08:00
Po Lu
2a99138f17 Update xwidget webkit history buffer more eagerly
* lisp/xwidget.el (xwidget-webkit-callback): Update history
buffer on each load-changed event.
2021-11-17 09:10:10 +08:00
Po Lu
1657e0fb17 Add command to browse xwidget history
* doc/emacs/misc.texi (Embedded WebKit Widgets)
* etc/NEWS: Document `xwidget-webkit-browse-history'.

* lisp/xwidget.el (xwidget-webkit-mode-map): Bind "H" to
xwidget-webkit-browse-history.
(xwidget-webkit-import-widget): Set last session buffer correctly.
(xwidget-webkit-browse-history): New command.
(xwidget-webkit-history--session): New variable.

(xwidget-webkit-history--insert-item)
(xwidget-webkit-history-select-item)
(xwidget-webkit-history-reload): New functions.

(xwidget-webkit-history-mode): New major mode.
2021-11-16 17:39:46 +08:00
Po Lu
a17e3976a8 Fix xwidget isearch for queries that look like format strings
* lisp/xwidget.el (xwidget-webkit-isearch--update): Give special
treatment to messages.
2021-11-16 09:32:37 +08:00
Po Lu
3ea70eea98 Prevent xwidget webkit isearch messages from entering log buffer
* lisp/xwidget.el (xwidget-webkit-isearch--update): Prevent
logging when displaying search contents message.
2021-11-13 08:30:43 +08:00
Po Lu
2803cabe89 Add support for input methods to xwidget-webkit-edit-mode
* lisp/xwidget.el (xwidget-webkit--input-method-events): New
variable.
(xwidget-webkit-pass-command-event-with-input-method): New
function.
(xwidget-webkit-pass-command-event): Consult input method about
key events if input method is enabled.
2021-11-12 17:50:20 +08:00
Po Lu
ea54498f3a Add input method support for xwidget webkit isearch
* lisp/xwidget.el (xwidget-webkit-isearch--read-string-buffer):
New variable.
(xwidget-webkit-isearch-printing-char-with-input-method)
(xwidget-webkit-isearch-with-input-method): New function.

(xwidget-webkit-isearch-printing-char): Add support for Emacs
input methods.  (bug#51781)
2021-11-12 14:06:51 +08:00
Po Lu
9a59d9017b Add URI as a valid spec for xwidget-webkit-buffer-name-format
* lisp/xwidget.el (xwidget-webkit-buffer-name-format): Update
doc string.
(xwidget-webkit-callback): Add a format spec %U, which stands
for the current URI of the widget.
2021-11-11 18:45:52 +08:00
Feng Shu
f69a808ddc xwidget: Add xwidget-webkit-buffer-name-format.
* lisp/xwidget.el (xwidget-webkit-buffer-name-prefix):
Remove variable.
(xwidget-webkit-buffer-name-format): New variable.
(xwidget-webkit-callback): Use
xwidget-webkit-buffer-name-format instead.
(format-spec): required.

* etc/NEWS: Note xwidget-webkit-buffer-name-format.
2021-11-11 18:26:05 +08:00
Po Lu
f96380eb80 Fix documentation in xwidget.el
* src/xwidget.el (xwidget-webkit-isearch-mode): Reword
documentation.
2021-11-11 15:40:57 +08:00
Po Lu
195f5a0dfa Switch to xwidget webkit buffer even if a session already exists
* lisp/xwidget.el (xwidget-webkit-goto-url): Make behavior
when there is an existing session consistent.
2021-11-11 15:40:57 +08:00
Po Lu
4ab7a22abe Add `xwidget-webkit-isearch-yank-kill'
* lisp/xwidget.el: Bind C-y to xwidget-webkit-yank-kill in incremental
search.
(xwidget-webkit-isearch-mode): Update doc string.
(xwidget-webkit-yank-kill): New function.
2021-11-10 19:43:53 +08:00
Po Lu
b1de4a2ede Prevent skipping results while changing search direction
* lisp/xwidget.el (xwidget-webkit-isearch-forward)
(xwidget-webkit-isearch-backward): Avoid moving to the next result one
too many times.
2021-11-10 17:53:13 +08:00
Po Lu
c9fd83e303 Always set xwidget title if the event was "load-finished"
* lisp/xwidget.el (xwidget-webkit-callback): Always set title upon
load completion.  This prevents loading pages such as "about:blank"
from not setting the buffer name (bug#51702).
2021-11-09 07:47:17 +01:00
Po Lu
3808cb89c3 Make xwidget-tests pass again
* lisp/xwidget.el (xwidget-webkit-buffer-name-prefix): Remove extra
space.
(xwidget-webkit-callback): Add trailing "*" to buffer name.
(xwidget-webkit-new-session, xwidget-webkit-import-widget): Always use
existing buffer name (bug#51700).
2021-11-09 06:49:15 +01:00
Lars Ingebrigtsen
272693c6fd Make xwidget-event-handler more resilient
* lisp/xwidget.el (xwidget-event-handler): Don't try to call the
callback if it hasn't been defined.
2021-11-09 05:48:28 +01:00
Feng Shu
06fb81922d xwidget.el: limit buffer-name flicker in mode-line
* lisp/xwidget.el (xwidget-webkit): New customization group.
(xwidget-webkit-buffer-name-prefix): New user option.
(xwidget-webkit-callback): with-current-buffer only after get title,
which can limit buffer-name change in mode-line.
(xwidget-webkit-new-session, xwidget-webkit-import-widget): Use
current buffer to generate a temp xwidget-webkit buffer.
2021-11-09 04:52:59 +01:00
Po Lu
397bee1dc3 Fix C-r inside xwidget isearch
* lisp/xwidget.el (xwidget-webkit-isearch-backward): Ask for previous
result.
2021-11-07 15:16:29 +01:00
Eli Zaretskii
d5bb053809 Fix documentation and coding style in recent xwidget commits
* src/xwidget.c (Fmake_xwidget, find_widget)
(xwidget_motion_or_crossing, xwidget_button_1, xwidget_button):
Fix style in comments.
(Fxwidget_perform_lispy_event): Doc fix.
* src/xwidget.c (set_widget_if_text_view, kill_frame_xwidget_views):
* src/keyboard.c (make_lispy_event): Fix style of braces.

* lisp/xwidget.el (xwidget-webkit-isearch-mode): Fix keys in doc
string.

* doc/lispref/commands.texi (Xwidget Events): Fix markup and
wording.
* doc/lispref/display.texi (Xwidgets): Fix wording and markup.
* doc/emacs/misc.texi (Embedded WebKit Widgets): Fix wording.

* etc/NEWS: Fix wording and punctuation.
2021-11-07 11:50:06 +02:00
Po Lu
e20c27c770 Fix backspace in xwidget webkit isearch
* lisp/xwidget.el: Set backspace to
xwidget-webkit-isearch-erasing-char (bug#51647).
2021-11-07 04:32:20 +01:00
Po Lu
969ce9d201 Improve xwidget isearch visuals
* lisp/xwidget.el (xwidget-webkit-isearch--update): New argument
ONLY-MESSAGE.
(xwidget-webkit-isearch-forward)
(xwidget-webkit-isearch-backward): Always refresh message.
(xwidget-webkit-isearch-mode): Update message when enabling.
2021-11-07 02:59:42 +01:00
Po Lu
eabd735e6c Default to creating new related sessions
* doc/lispref/display.texi:
* etc/NEWS: Document changes.

* lisp/xwidget.el (xwidget-insert): Accept an extra RELATED argument.
(xwidget-webkit-new-session): Pass current session as RELATED if
present.

* src/xwidget.c (Fmake_xwidget): Make RELATED argument public.
2021-11-07 02:59:42 +01:00
Po Lu
0be966f97e 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.
2021-11-07 02:59:42 +01:00
Po Lu
1a84537f79 Add xwidget-webkit-isearch to the menu bar and tool bar
* lisp/xwidget.el: Add isearch to tool bar and menu bar.

(xwidget-webkit-mode-map)
(xwidget-webkit-isearch-mode-map): Reorder key definitions so the
equivalent key shows up as `C-s' in the menu bar.
2021-11-07 02:59:42 +01:00
Po Lu
e7503291d3 Add xwidget-webkit-isearch-mode
* etc/NEWS:
* doc/emacs/misc.texi: Document changes

* 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.
2021-11-07 02:59:41 +01:00
Po Lu
74711c0298 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.
2021-11-07 02:59:41 +01:00
Po Lu
8729ae29d8 Add xwidget-webkit-copy-selection-as-kill to the menu bar
* lisp/xwidget.el: New menu item
`xwidget-webkit-copy-selection-as-kill'.
2021-11-07 02:59:41 +01:00
Po Lu
cd7158edd3 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.
2021-11-07 02:59:41 +01:00
Po Lu
d97718c87c Add a menu to xwidget-webkit
* lisp/xwidget.el: Add a menu to xwidget-webkit-mode-map.
2021-11-07 02:59:41 +01:00
Po Lu
8ddeebbe0c Allow enabling xwidget-webkit-edit-mode via a binding
* doc/emacs/misc.texi: Document changes.
* lisp/xwidget.el (xwidget-webkit-mode-map): Add shortcut for
xwidget-webkit-edit-mode.
2021-11-07 02:59:40 +01:00
Po Lu
6ed7454f17 Add xwidget-webkit-edit-mode to make using the WebKit browser easier
* doc/emacs/misc.texi: Document changes.
* etc/NEWS: Document recent changes.
* lisp/xwidget.el (xwidget-webkit-pass-command-event): New variable.
* lisp/xwidget.el (xwidget-perform-lispy-event): New function
declaration.
* lisp/xwidget.el (xwidget-webkit-edit-mode): New minor mode.
2021-11-07 02:59:40 +01:00
Lars Ingebrigtsen
bd6dca038e Do some xwidget NEWS markup (and adjust doc string)
* lisp/xwidget.el (xwidget-webkit-bookmark-make-record): Mention
`xwidget-webkit-bookmark-jump-new-session' in the doc string.
2021-09-18 18:18:13 +02:00
Lars Ingebrigtsen
5d32630f79 Do command mode markup in xwidget.el 2021-08-23 01:52:16 +02:00