all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: 52856@debbugs.gnu.org
Subject: bug#52856: 29.0.50; Problematic handling of webkit xwidget bookmarks
Date: Tue, 28 Dec 2021 20:19:25 +0100	[thread overview]
Message-ID: <875yr8wn9e.fsf@gmx.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

If you make a bookmark to a webkit xwidget (i.e. to a URL displayed by
the xwidget) and then use `bookmark-jump-other-window' or
`bookmark-jump-other-frame' to jump to the bookmarked URL, the xwidget
is displayed in both the original window and the other window or other
frame.  Also, if you try to jump to the bookmark in an Emacs session
before loading xwidget.el, it fails with an unknown symbol error.  The
patch below fixes these issues for me.

2021-12-28  Stephen Berman  <stephen.berman@gmx.net>

	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.  Also
	make jumping to the bookmarked xwidget possible before explicitly
	loading xwidget.el (bug#xxxx).

	* lisp/xwidget.el (xwidget-webkit-bookmark-jump-handler): New
	autoloaded function.
	(xwidget-webkit-bookmark-make-record): Use it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xwidget.el patch --]
[-- Type: text/x-patch, Size: 1542 bytes --]

diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index ce9839ebd3..eed35b7312 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -540,15 +540,26 @@ xwidget-webkit-bookmark-jump-new-session
   :type 'boolean)

 (defun xwidget-webkit-bookmark-make-record ()
-  "Create bookmark record in webkit xwidget.
-See `xwidget-webkit-bookmark-jump-new-session' for whether this
-should create a new session or not."
+  "Create a bookmark record for a webkit xwidget."
   (nconc (bookmark-make-record-default t t)
          `((page . ,(xwidget-webkit-uri (xwidget-webkit-current-session)))
-           (handler  . (lambda (bmk)
-                         (xwidget-webkit-browse-url
-                          (bookmark-prop-get bmk 'page)
-                          xwidget-webkit-bookmark-jump-new-session))))))
+           (handler . xwidget-webkit-bookmark-jump-handler))))
+
+;;;###autoload
+(defun xwidget-webkit-bookmark-jump-handler (bmk)
+  "Function for jumping to the webkit xwidget bookmarked by BMK.
+If `xwidget-webkit-bookmark-jump-new-session' is non-nil, create
+a new xwidget-webkit session, otherwise use an existing session."
+  (let* ((curbuf (current-buffer))
+	 (url (bookmark-prop-get bmk 'page))
+	 (xwbuf (if xwidget-webkit-bookmark-jump-new-session
+		    (with-temp-buffer
+		      (xwidget-webkit-new-session url)
+		      (current-buffer))
+		  (xwidget-webkit-goto-url url)
+		  (current-buffer))))
+    (switch-to-buffer curbuf)
+    (set-buffer xwbuf)))

 ;;; xwidget webkit session


[-- Attachment #3: Type: text/plain, Size: 729 bytes --]



In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4)
 of 2021-12-23 built on strobelfs
Repository revision: 2fa7feca336dd16c57ffef072e0f0da6fffe4c5f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Linux From Scratch 10.2-rc1

Configured using:
 'configure --with-xwidgets 'CFLAGS=-Og -g3'
 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/qt5/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM
XWIDGETS GTK3 ZLIB

             reply	other threads:[~2021-12-28 19:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28 19:19 Stephen Berman [this message]
2021-12-29  7:26 ` bug#52856: 29.0.50; Problematic handling of webkit xwidget bookmarks Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-29 10:50   ` Stephen Berman
2021-12-29 11:25     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-30 10:52       ` Stephen Berman
2021-12-30 11:18         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-30 15:00           ` Stephen Berman
2021-12-31  0:56             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-31  9:29               ` Stephen Berman
2021-12-31  9:45                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yr8wn9e.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=52856@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.