From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51712: 29.0.50; [PATCH] New function `xwidget-webkit-load-html' Date: Tue, 09 Nov 2021 15:21:59 +0200 Message-ID: <83h7cl5urs.fsf@gnu.org> References: <878rxx8w1i.fsf.ref@yahoo.com> <878rxx8w1i.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7219"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51712@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 09 14:23:18 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkR5p-0001i8-Pn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 14:23:17 +0100 Original-Received: from localhost ([::1]:48676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkR5o-0005Lx-Ft for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 08:23:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkR5f-0005L7-Sh for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 08:23:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49638) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkR5a-0000MD-IT for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 08:23:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mkR5a-00082R-EC for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 08:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Nov 2021 13:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51712 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51712-submit@debbugs.gnu.org id=B51712.163646413530827 (code B ref 51712); Tue, 09 Nov 2021 13:23:02 +0000 Original-Received: (at 51712) by debbugs.gnu.org; 9 Nov 2021 13:22:15 +0000 Original-Received: from localhost ([127.0.0.1]:32951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkR4o-000819-K7 for submit@debbugs.gnu.org; Tue, 09 Nov 2021 08:22:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56170) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkR4m-00080x-VD for 51712@debbugs.gnu.org; Tue, 09 Nov 2021 08:22:13 -0500 Original-Received: from [2001:470:142:3::e] (port=38066 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkR4h-0000H5-PC; Tue, 09 Nov 2021 08:22:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=7G0v7nsBp+/vbKNEPlKkIMYI5vchyadoveCepwnpTeM=; b=IUq6kD7/2STr kWosN1wGEfnkgNpcVmFuTWQulLSS9L4+q2LiFuZDS2wJMzJWbKGG6Gl5R1Z+hOEQWUSiDXzYtHtFl E+MGwrdLd++uy1UMjSc6v4yiVMUQvyUqBJcfch0d+L8DlNzDUtiL5bnVIgARtToo2GIwAhy7kcuu7 UqV9JPURPa84HzElK6/S9htnowkR1cUsCj34f44sMLAguvYKrjJ0pOy2vft3XGDZwQLars34ZUDnu Bfy0OJJ3GVWI2juoJj1w1S3S7LOgkXx0u1InCeNN5Dlzff7nrxK1M1qSGV+sAqKNTSc/fESHoRk+X c4brIUysw+vMi8zfXT6EbQ==; Original-Received: from [87.69.77.57] (port=1409 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkR4h-0003kx-1G; Tue, 09 Nov 2021 08:22:07 -0500 In-Reply-To: <878rxx8w1i.fsf@yahoo.com> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:219449 Archived-At: > Date: Tue, 09 Nov 2021 18:26:17 +0800 > From: Po Lu via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > +@defun xwidget-webkit-load-html xwidget text base-uri > +Load @var{text} into @var{xwidget}, which should be a WebKit xwidget. > +@var{text} will be treated as HTML markup, and rendered by > +@var{xwidget}. can you rephrase the last sentence not to use passive tense, please? > +For the purpose of controlling the location where web resources will > +be found, you can optionally specify a base URI as a string in > +@var{base-uri}, which defaults to @samp{about:blank}. But BASE-URI is not an &optional argument above. And also, this sentence is unnecessarily complex because you state the reason before the goal. It is much better to do it the other way around, and while at that, make 2 simple sentences out of one complex one: Optional argument @var{base-uri}, which should be a string, specifies the location of the web resource. It defaults to @samp{about:blank}. (Of course, now this begs the question: what does it mean "web resource" for HTML text? How about answering that in the text?) > ++++ > +*** New function 'xwidget-webkit-load-html'. > +This function is used to load HTML text into WebKit xwidgets, without > +having to create a temporary file or URL. The second part is either unnecessary or too terse. if it is important to explain that, please elaborate how temporary files are relevant here. > +DEFUN ("xwidget-webkit-load-html", Fxwidget_webkit_load_html, > + Sxwidget_webkit_load_html, 2, 3, 0, > + doc: /* Make XWIDGET's WebKit widget render text. > +XWIDGET should be a WebKit xwidget, that will receive TEXT. TEXT > +should be a string that will be displayed by XWIDGET as plain text. The "plain text" part seems to contradict the text in the manual, which says it will be rendered as HTML markup? > +BASE_URI will be a URI that is used to fetch resources, and if not > +specified, is treated as equivalent to `about:blank'. */) "will be" is confusing: why the future tense? Also, what kind of Lisp type is that? And I think explaining the importance of "fetching resources" would be beneficiary here. And finally, "is treated as equivalent" is better reworded as "and defaults to ...", which is our style in these cases. > + if (NILP (base_uri)) > + base_uri = build_string ("about:blank"); > + CHECK_STRING (base_uri); That last line should better be under 'else', right? > + base_uri = ENCODE_UTF_8 (base_uri); Is it a good idea to produce non-ASCII URIs? > + text = ENCODE_UTF_8 (text); > + xw = XXWIDGET (xwidget); > + > +#ifdef USE_GTK > + data = SSDATA (text); > + uri = SSDATA (base_uri); > + webview = WEBKIT_WEB_VIEW (xw->widget_osr); > + > + block_input (); > + webkit_web_view_load_html (webview, data, uri); > + unblock_input (); > +#endif Hmm... if we only use TEXT and BASE-URI in the GTK build, why do we encode them in the other builds? Isn't that a waste of cycles? IOW, what does this function do if USE_GTK is not defined? Thanks.