Commit graph

194 commits

Author SHA1 Message Date
Andrew De Angelis
a137f71c67 Improvements to xwidget on macOS (bug#60703)
* src/nsxwidget.m ()
([XwWebView initWithFrame:configuration:xwidget:])
(nsxwidget_init):  Fixed memory leaks: when sending an alloc
message to an object, send an autorelease message to any objects
we won't explictly release.
([XwWebView webView:didFinishNavigation:]): Second string to
store in 'store_xwidget_event_string' is "load finished" rather
than empty string.
([XwWebView webView:didStartProvisionalNavigation:])
([XwWebView webView:didReceiveServerRedirectForProvisionalNavigation:])
([XwWebView webView:didCommitNavigation:]): New functions.
(nsxwidget_webkit_estimated_load_progress): New function.
(nsxwidget_webkit_stop_loading): New function.
* src/xwidget.c (Fxwidget_webkit_estimated_load_progress): Call
'nsxwidget_webkit_estimated_load_progress' if we're on MacOS.
(Fxwidget_webkit_stop_loading): Call 'nsxwidget_webkit_stop_loading'
if we're on MacOS.
(syms_of_xwidget): Define symbol for function.
'xwidget_webkit_estimated_load_progress' if we're on MacOS.
* src/nsxwidget.h: Signature for functions
'nsxwidget_webkit_estimated_load_progress' and
'nsxwidget_webkit_stop_loading'.
* lisp/xwidget.el (xwidget-webkit-current-url): Message URL rather
than return value of 'kill-new' (which is always nil).
2023-03-02 12:53:35 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Po Lu
0aea7da80b * lisp/xwidget.el: Improve Commentary. 2022-11-12 07:06:53 +01:00
Stefan Kangas
014176f283 ; * lisp/xwidget.el: Improve Commentary. 2022-11-11 15:27:13 +01:00
Basil L. Contovounesios
38bcad5451 Pacify recent unused/ignored lexvar warnings
Lexvars with special names like 'ignored' or 'unused' are no longer
treated specially.

* lisp/ansi-color.el (ansi-color-process-output):
* lisp/cus-edit.el (customize-apropos-options):
* lisp/cus-theme.el (customize-create-theme):
* lisp/dired-aux.el (dired-hide-all):
* lisp/emacs-lisp/crm.el (crm--choose-completion-string):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-revert):
* lisp/ido.el (ido-choose-completion-string):
* lisp/international/mule-diag.el (describe-font-internal):
* lisp/mail/sendmail.el (sendmail-user-agent-compose):
* lisp/progmodes/fortran.el (fortran-uncomment-region):
* lisp/progmodes/prolog.el (prolog-inferior-guess-flavor):
* lisp/progmodes/ruby-mode.el (ruby-indent-line, ruby-indent-exp):
* lisp/url/url.el (url-mm-callback):
* lisp/xwidget.el (xwidget-webkit-history-reload): Prepend an
underscore to unused function parameter names.
* lisp/emacs-lisp/cconv.el (cconv--dummy-var): Remove unused
constant.
* lisp/files.el (hack-local-variables-filter): Remove unused lexvar.
2022-10-26 16:35:59 +03:00
Po Lu
500a4286ca Revert "Prefer defvar-keymap in xwidget.el"
This reverts commit daf2c3e23a.
2022-07-21 09:19:14 +08:00
Stefan Kangas
329ec11b0f ; Normalize some "Author" headers 2022-07-20 22:38:01 +02:00
Stefan Kangas
daf2c3e23a Prefer defvar-keymap in xwidget.el
* lisp/xwidget.el (xwidget-webkit-mode-map)
(xwidget-webkit-edit-mode-map): Prefer defvar-keymap.
2022-07-20 22:38:01 +02:00
Stefan Kangas
32db168290 Prefer defvar-keymap in some trivial cases
* lisp/calendar/diary-lib.el (diary-fancy-overriding-map):
* lisp/emacs-lisp/chart.el (chart-mode-map):
* lisp/emulation/cua-base.el (cua-global-keymap)
(cua--cua-keys-keymap, cua--prefix-override-keymap)
(cua--prefix-repeat-keymap, cua--global-mark-keymap)
(cua--rectangle-keymap, cua--region-keymap):
* lisp/emulation/viper-keym.el (viper-vi-intercept-map)
(viper-insert-intercept-map, viper-emacs-intercept-map)
(viper-vi-global-user-map, viper-vi-basic-map, viper-vi-kbd-map)
(viper-vi-diehard-map, viper-insert-global-user-map)
(viper-insert-basic-map, viper-insert-diehard-map)
(viper-insert-kbd-map, viper-replace-map)
(viper-emacs-global-user-map, viper-emacs-kbd-map)
(viper-empty-keymap, viper-mode-map, viper-minibuffer-map)
(viper-ex-cmd-map, ex-read-filename-map)
(viper-slash-and-colon-map, viper-comint-mode-modifier-map)
(viper-dired-modifier-map, viper-gnus-modifier-map):
* lisp/gnus/gnus-sum.el (gnus-summary-generic-mark-map):
* lisp/menu-bar.el (global-buffers-menu-map)
(menu-bar-preferences-menu):
* lisp/mh-e/mh-e.el (mh-folder-mode-map, mh-inc-spool-map)
(mh-search-mode-map, mh-show-mode-map):
* lisp/play/dunnet.el (dungeon-batch-map):
* lisp/progmodes/autoconf.el (autoconf-mode-map):
* lisp/tool-bar.el (tool-bar-map):
* lisp/vc/ediff-help.el (ediff-help-region-map):
* lisp/vc/ediff-hook.el (menu-bar-epatch-menu)
(menu-bar-ediff-merge-menu, menu-bar-ediff-menu):
* lisp/windmove.el (windmove-mode-map):
* lisp/xwidget.el (xwidget-webkit-isearch-mode-map)
(xwidget-webkit-edit-mode-map): Prefer defvar-keymap.
2022-07-20 09:27:30 +02:00
Po Lu
2b869237cc ; * lisp/xwidget.el (xwidget-webkit-browse-url): Mark as internal browser. 2022-07-14 19:51:27 +08:00
Stefan Kangas
09674074b5 ; Fix typos 2022-05-15 11:15:06 +02:00
Eli Zaretskii
640e52d8fa ; Fix mistakes in 'declare function' forms
* lisp/progmodes/gdb-mi.el (tooltip-show):
* lisp/vc/vc-git.el (grep-expand-template):
* lisp/cedet/semantic/imenu.el (pulse-momentary-highlight-one-line):
* lisp/mail/feedmail.el (smtpmail-via-smtp):
* lisp/mail/rmail.el (rmail-mime-entity-truncated):
* lisp/mail/rmailsum.el (rmail-cease-edit):
* lisp/progmodes/gud.el (speedbar-toggle-line-expansion)
(speedbar-edit-line):
* lisp/autoinsert.el (sgml-tag):
* lisp/comint.el (url-host, url-type, url-filename):
* lisp/progmodes/elisp-mode.el (xref-make, xref-item-location):
* lisp/vc/vc-hooks.el (vc-responsible-backend):
* lisp/cedet/semantic/complete.el (tooltip-show):
* lisp/doc-view.el (tooltip-show):
* lisp/follow.el (mwheel-scroll):
* lisp/term/pgtk-win.el (pgtk-set-resource):
* lisp/progmodes/cperl-mode.el (Info-find-node):
* lisp/lpr.el (print-region-function):
* lisp/w32-fns.el (w32-version, w32-read-registry):
* lisp/emacs-lisp/checkdoc.el (ispell-correct-p, checkdoc-dired):
* lisp/progmodes/xref.el (apropos-parse-pattern):
* lisp/cus-edit.el (apropos-parse-pattern):
* lisp/obsolete/gs.el (x-change-window-property):
* lisp/x-dnd.el (x-change-window-property):
* lisp/xwidget.el (make-xwidget):
* lisp/transient.el (info, Man-find-section, Man-next-section)
(Man-getpage-in-background):
* lisp/frame.el (x-device-class, pgtk-device-class):
* lisp/textmodes/texinfo.el (flymake--log-1):
* lisp/term/x-win.el (x-internal-focus-input-context): Fix
'declare function' errors uncovered by 'check-declare'.
2022-05-14 16:19:12 +03:00
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