unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.
@ 2021-11-09  6:00 tumashu
  2021-11-09  7:13 ` Po Lu
  0 siblings, 1 reply; 6+ messages in thread
From: tumashu @ 2021-11-09  6:00 UTC (permalink / raw)
  To: emacs-devel@gnu.org


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



[-- Attachment #1.2: Type: text/html, Size: 111 bytes --]

[-- Attachment #2: 0001-xwidget.el-call-set-window-buffer-after-xwidget-webk.patch --]
[-- Type: application/octet-stream, Size: 1535 bytes --]

From 49a4c0c539dff6bf957705d3aa77e23d751a880c Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Tue, 9 Nov 2021 13:53:33 +0800
Subject: [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.

* lisp/xwidget.el (xwidget-webkit-new-session)
(xwidget-webkit-import-widget): Call set-window-buffer.
---
 lisp/xwidget.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index dc1ed2dc08..9e532cad4c 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -726,6 +726,9 @@ xwidget-webkit-new-session
                 nil current-session)))
     (xwidget-put xw 'callback callback)
     (xwidget-webkit-mode)
+    ;; Make sure some buffer variables in `xwidget-webkit-mode-hook'
+    ;; function take effect, for example: `left-fringe-width'.
+    (set-window-buffer (selected-window) (current-buffer))
     (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))
 
 (defun xwidget-webkit-import-widget (xwidget)
@@ -751,7 +754,10 @@ xwidget-webkit-import-widget
                            'display (list 'xwidget :xwidget xwidget)))
       (xwidget-put xwidget 'callback callback)
       (set-xwidget-buffer xwidget buffer)
-      (xwidget-webkit-mode))
+      (xwidget-webkit-mode)
+      ;; Make sure some buffer variables in `xwidget-webkit-mode-hook'
+      ;; function take effect, for example: `left-fringe-width'.
+      (set-window-buffer (selected-window) buffer))
     buffer))
 
 (defun xwidget-webkit-display-event (event)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.
  2021-11-09  6:00 [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode tumashu
@ 2021-11-09  7:13 ` Po Lu
  2021-11-09  7:25   ` tumashu
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu @ 2021-11-09  7:13 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel@gnu.org

tumashu <tumashu@163.com> writes:

> +    ;; Make sure some buffer variables in `xwidget-webkit-mode-hook'
> +    ;; function take effect, for example: `left-fringe-width'.
> +    (set-window-buffer (selected-window) (current-buffer))
>      (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))

I don't think this is quite right: we don't change `left-fringe-width'
or any such variable in xwidget-webkit-mode.

Can you give a concrete reason as to why this is necessary?

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:Re: [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.
  2021-11-09  7:13 ` Po Lu
@ 2021-11-09  7:25   ` tumashu
  2021-11-09  7:29     ` Po Lu
  0 siblings, 1 reply; 6+ messages in thread
From: tumashu @ 2021-11-09  7:25 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel@gnu.org

















At 2021-11-09 15:13:20, "Po Lu" <luangruo@yahoo.com> wrote:
>tumashu <tumashu@163.com> writes:
>
>> +    ;; Make sure some buffer variables in `xwidget-webkit-mode-hook'
>> +    ;; function take effect, for example: `left-fringe-width'.
>> +    (set-window-buffer (selected-window) (current-buffer))
>>      (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))
>
>I don't think this is quite right: we don't change `left-fringe-width'
>or any such variable in xwidget-webkit-mode.
>
>Can you give a concrete reason as to why this is necessary?

I just want to the below setting work :-)

(defun eh-xwidget-webkit-mode-hook ()
  (setq-local left-fringe-width 1)
  (setq-local right-fringe-width 1)
  (setq-local header-line-format nil)
  (setq-local mode-line-format '("★★★ " mode-line-buffer-identification)))

(add-hook 'xwidget-webkit-mode-hook #'eh-xwidget-webkit-mode-hook)




>
>Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.
  2021-11-09  7:25   ` tumashu
@ 2021-11-09  7:29     ` Po Lu
  2021-11-09  7:44       ` tumashu
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu @ 2021-11-09  7:29 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel@gnu.org

tumashu  <tumashu@163.com> writes:

> I just want to the below setting work :-)
>
> (defun eh-xwidget-webkit-mode-hook ()
>   (setq-local left-fringe-width 1)
>   (setq-local right-fringe-width 1)
>   (setq-local header-line-format nil)
>   (setq-local mode-line-format '("★★★ " mode-line-buffer-identification)))
>
> (add-hook 'xwidget-webkit-mode-hook #'eh-xwidget-webkit-mode-hook)

Can't you call `set-window-buffer' inside the hook function?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:Re: [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.
  2021-11-09  7:29     ` Po Lu
@ 2021-11-09  7:44       ` tumashu
  2021-11-09  7:48         ` Po Lu
  0 siblings, 1 reply; 6+ messages in thread
From: tumashu @ 2021-11-09  7:44 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel@gnu.org

>> I just want to the below setting work :-)

>>
>> (defun eh-xwidget-webkit-mode-hook ()
>>   (setq-local left-fringe-width 1)
>>   (setq-local right-fringe-width 1)
>>   (setq-local header-line-format nil)
>>   (setq-local mode-line-format '("★★★ " mode-line-buffer-identification)))
>>
>> (add-hook 'xwidget-webkit-mode-hook #'eh-xwidget-webkit-mode-hook)
>
>Can't you call `set-window-buffer' inside the hook function?

Sure,  this patch just let user configure easier :-), if it is not a good idea, just ignore it.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode.
  2021-11-09  7:44       ` tumashu
@ 2021-11-09  7:48         ` Po Lu
  0 siblings, 0 replies; 6+ messages in thread
From: Po Lu @ 2021-11-09  7:48 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel@gnu.org

tumashu  <tumashu@163.com> writes:

> Sure, this patch just let user configure easier :-), if it is not a
> good idea, just ignore it.

Thanks, but I think it would be best to have the user do the work inside
hooks.

Otherwise, it would set a (bad) precedent for every other editing mode
in Emacs, all of which don't call set-window-buffer at present.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-09  7:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09  6:00 [PATCH] xwidget.el: call set-window-buffer after xwidget-webkit-mode tumashu
2021-11-09  7:13 ` Po Lu
2021-11-09  7:25   ` tumashu
2021-11-09  7:29     ` Po Lu
2021-11-09  7:44       ` tumashu
2021-11-09  7:48         ` Po Lu

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).