all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: 조성빈 <pcr910303@icloud.com>
Cc: alan@idiocy.org, emacs-devel@gnu.org
Subject: Re: [PATCH v5] Enable xwidgets on macOS
Date: Sat, 27 Jul 2019 13:41:01 +0300	[thread overview]
Message-ID: <831rybn4jm.fsf@gnu.org> (raw)
In-Reply-To: <D56E4A0A-B607-49E4-B284-FFA088F0656F@icloud.com> (message from 조성빈 on Fri, 26 Jul 2019 03:51:11 +0900)

> From: 조성빈 <pcr910303@icloud.com>
> Date: Fri, 26 Jul 2019 03:51:11 +0900
> Cc: alan@idiocy.org,
>  emacs-devel@gnu.org
> 
> Hello, I have prepared three patches to apply on master.

Thanks.  Alan, could you please review the NS specific parts?

> diff --git a/etc/NEWS b/etc/NEWS
> index 5313270411..52b49bab75 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -2440,6 +2440,18 @@ was able to 'set' modifiers without the knowledge of the user.
>  ** On NS multicolor font display is enabled again since it is also
>  implemented in Emacs on free operating systems via Cairo drawing.
>  
> +** On macOS, Xwidget is now supported.
> +If Emacs was built with xwidget support, you can access the embedded
> +webkit browser with 'M-x xwidget-webkit-browse-url'.  Viewing two
> +instances of xwidget webkit is not supported.
> +
> +*** New functions for xwidget-webkit mode
> +'xwidget-webkit-clone-and-split-below',
> +'xwidget-webkit-clone-and-split-right'.
> +
> +*** New variable 'xwidget-webkit-enable-plugins'.

The last two entries are not specific to macOS, are they?  If so, they
should be in the general sections of NEWS.

> diff --git a/etc/TODO b/etc/TODO
> index a065763933..bda1cf8f9e 100644
> --- a/etc/TODO
> +++ b/etc/TODO
> @@ -640,15 +640,6 @@ from the emacsclient process.
>  
>  This sections contains features found in other official Emacs ports.
>  
> -**** Support for xwidgets
> -
> -Emacs 25 has support for xwidgets, a system to include operating
> -system components into an Emacs buffer.  The components range from
> -simple buttons to webkit (effectively, a web browser).
> -
> -Currently, xwidgets works only for the gtk+ framework but it is
> -designed to be compatible with multiple Emacs ports.

The MS-Windows and non-GTK builds of Emacs on X still don't support
xwidgets, so I think this entry should not be deleted in its entirety,
it should still say that some configurations don't support xwidgets.

> +(defun xwidget-webkit-clone-and-split-below ()
> +  "Clone current URL into a new widget place in new window below.
> +Get the URL of current session, then browse to the URL
> +in `split-window-below' with a new xwidget webkit session."

The second sentence should be reworded:

  Get the URL of current session, then browse that URL in another
  window after splitting the selected window horizontally.

> +(defun xwidget-webkit-clone-and-split-right ()
> +  "Clone current URL into a new widget place in new window right.
> +Get the URL of current session, then browse to the URL
> +in `split-window-right' with a new xwidget webkit session."

Same here (but use "vertically" instead of "horizontally").

>  (defvar bookmark-make-record-function)
> +(when (memq window-system '(mac ns))
> +  (defvar xwidget-webkit-enable-plugins nil
> +    "Enable plugins for xwidget webkit.
> +If non-nil, plugins are enabled.  Otherwise, disabled."))

It is better to have this defvar unconditionally, and tell in the doc
string that it only has effect on macOS.

> @@ -228,13 +247,14 @@ offscreen_damage_event (GtkWidget *widget, GdkEvent *event,
>    if (GTK_IS_WIDGET (xv_widget))
>      gtk_widget_queue_draw (GTK_WIDGET (xv_widget));
>    else
> -    printf ("Warning, offscreen_damage_event received invalid xv pointer:%p\n",
> -            xv_widget);
> +    message ("Warning, offscreen_damage_event received invalid xv pointer:%p\n",
> +             xv_widget);

Why replace printf by message?

> +#elif defined NS_IMPL_COCOA
> +              nsxwidget_resize_view(xv, xw->width, xw->height);
                                      ^
Space before the opening parenthesis is missing.

> +*** Functions 'xwidget-webkit-scroll-up', 'xwidget-webkit-scroll-down'
> +now supports scrolling arbitrary pixel values.  It now treats the
       ^^^^^^^^           ^^^^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^
"support" (plural) "by arbitrary pixel values".  "They now treat" (plural).

> +(defun xwidget-webkit-scroll-up-line (&optional n)
> +  "Scroll webkit up by N lines.
> +The height of line is calculated with `window-font-height'.
> +Stop if the bottom edge of the page is reached.
> +If N is omitted or nil, scroll up by one line."
> +  (interactive "p")
> +  (xwidget-webkit-scroll-up (* n (window-font-height))))
> +
> +(defun xwidget-webkit-scroll-down-line (&optional n)
> +  "Scroll webkit down by N lines.
> +The height of line is calculated with `window-font-height'.
> +Stop if the top edge of the page is reached.
> +If N is omitted or nil, scroll down by one line."
> +  (interactive "p")
> +  (xwidget-webkit-scroll-down (* n (window-font-height))))
> +
> +(defun xwidget-webkit-scroll-forward (&optional n)
> +  "Scroll webkit horizontally by N chars.
> +The width of char is calculated with `window-font-width'.
> +If N is ommited or nil, scroll forwards by one char."
> +  (interactive "p")
>    (xwidget-webkit-execute-script
>     (xwidget-webkit-current-session)
> -   "window.scrollBy(50, 0);"))
> -
> -(defun xwidget-webkit-scroll-backward ()
> -  "Scroll webkit backwards."
> -  (interactive)
> +   (format "window.scrollBy(%d, 0);"
> +           (* n (window-font-width)))))
> +
> +(defun xwidget-webkit-scroll-backward (&optional n)
> +  "Scroll webkit back by N chars.
> +The width of char is calculated with `window-font-width'.
> +If N is ommited or nil, scroll backwards by one char."
> +  (interactive "p")

These commands should say in their doc strings that interactively N is
the prefix numeric argument.

> diff --git a/etc/NEWS b/etc/NEWS
> index f9a42f73be..c7f980f212 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -2469,6 +2469,10 @@ instances of xwidget webkit is not supported.
>  
>  *** New variable 'xwidget-webkit-enable-plugins'.
>  
> +** On macOS, downloading files from xwidget-webkit is supported.
> +
> +*** New variable 'xwidget-webkit-download-dir'.

The macOS-specific part of this should be in the non-free OS part of
NEWS.

> +(defun xwidget-webkit-save-as-file (url mime-type file-name)
> +  "For XWIDGET webkit, save URL of MIME-TYPE to location specified by user.
> +FILE-NAME combined with `xwidget-webkit-download-dir' is the default file name
> +of the prompt when reading.  When the file name the user specified is a
> +directory, URL is saved at the specified directory as FILE-NAME."

The last sentence is unclear: what will be the directory where the URL
will be saved, and what will be the name of the saved file in that
directory?



  parent reply	other threads:[~2019-07-27 10:41 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 19:23 [PATCH v4] Enable xwidgets on macOS Sungbin Jo
2019-07-19  4:16 ` [PATCH v5] " Sungbin Jo
2019-07-19 19:17   ` Alan Third
2019-07-19 19:25     ` Savannah down (was: [PATCH v5] Enable xwidgets on macOS) Paul Eggert
2019-07-20  8:21   ` [PATCH v5] Enable xwidgets on macOS Eli Zaretskii
2019-07-23 18:36     ` 조성빈
2019-07-25 18:51       ` 조성빈
2019-07-26  5:55         ` Eli Zaretskii
2019-07-27  2:48           ` Richard Stallman
2019-07-27  8:38             ` Eli Zaretskii
2019-07-27 10:41         ` Eli Zaretskii [this message]
2019-07-27 12:35           ` 조성빈
2019-07-27 13:03             ` Eli Zaretskii
2019-07-29 17:08               ` 조성빈
2019-08-03 10:03                 ` Eli Zaretskii
2019-08-03 10:52                   ` 조성빈
2019-07-29 20:26         ` Alan Third
2019-07-29 21:02           ` Stefan Monnier
2019-07-30 15:35             ` 조성빈
2019-07-30 19:25               ` Stefan Monnier
2019-07-31 15:52                 ` 조성빈
2019-07-30 15:33           ` 조성빈
2019-07-30 19:12             ` Juri Linkov
2019-07-31 15:55               ` 조성빈
2019-07-31 19:56             ` Alan Third
2019-08-01  2:35               ` Eli Zaretskii
2019-08-01  4:00                 ` 조성빈
2019-08-02  0:47                   ` Richard Stallman
2019-08-02  7:02                     ` Eli Zaretskii
2019-08-03  2:23                       ` Richard Stallman
2019-08-03  6:58                         ` Eli Zaretskii
2019-08-01 21:39                 ` macOS/GCC support policy (was: [PATCH v5] Enable xwidgets on macOS) Alan Third
2019-08-02  2:22                   ` Noam Postavsky
2019-08-02  6:56                   ` macOS/GCC support policy Eli Zaretskii
2019-08-02 10:08                     ` Philipp Stephani
2019-08-02 11:51                       ` Eli Zaretskii
2019-08-02 14:55                         ` Philipp Stephani
2019-08-02 14:59                           ` Philipp Stephani
2019-08-02 15:06                             ` Philipp Stephani
2019-08-02 15:05                           ` Eli Zaretskii
2019-08-03 11:02                             ` Alan Third
2019-08-03 11:10                               ` Eli Zaretskii
2019-08-03 11:18                                 ` Alan Third
2019-08-03 11:43                                   ` Eli Zaretskii
2019-08-04  2:56                                   ` Richard Stallman
2019-08-10  9:56                                     ` 조성빈
2019-08-18 15:43                                       ` Alan Third
2019-08-18 16:40                                         ` Eli Zaretskii
2019-08-18 23:42                                         ` Richard Stallman

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=831rybn4jm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    --cc=pcr910303@icloud.com \
    /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.