unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 51702@debbugs.gnu.org
Subject: bug#51702: 29.0.50; [PATCH] Fix xwidget buffer name being stuck on something nonsensical
Date: Tue, 09 Nov 2021 14:39:32 +0800	[thread overview]
Message-ID: <87k0hhal3v.fsf@yahoo.com> (raw)
In-Reply-To: 87k0hhal3v.fsf.ref@yahoo.com

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

Thanks.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Always-set-xwidget-title-if-the-event-was-load-finis.patch --]
[-- Type: text/x-patch, Size: 1453 bytes --]

From a943d9b995d701d4ae7029f6f6f3ae91ceb3a29b Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Tue, 9 Nov 2021 14:37:47 +0800
Subject: [PATCH] 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.
---
 lisp/xwidget.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index fc37798322..905327083b 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -360,9 +360,11 @@ xwidget-webkit-callback
     (cond ((eq xwidget-event-type 'load-changed)
            (let ((title (xwidget-webkit-title xwidget)))
              ;; This funciton will be called multi times, so only
-             ;; change buffer name when get a valid title. this can
-             ;; limit buffer-name flicker in mode-line.
-             (when (> (length title) 0)
+             ;; change buffer name when the load actually completes
+             ;; this can limit buffer-name flicker in mode-line.
+             (when (or (string-equal (nth 3 last-input-event)
+                                     "load-finished")
+                       (> (length title) 0))
                (with-current-buffer (xwidget-buffer xwidget)
                  (setq xwidget-webkit--title title)
                  (force-mode-line-update)
-- 
2.31.1


       reply	other threads:[~2021-11-09  6:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87k0hhal3v.fsf.ref@yahoo.com>
2021-11-09  6:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-11-09  6:46   ` bug#51702: 29.0.50; [PATCH] Fix xwidget buffer name being stuck on something nonsensical Lars Ingebrigtsen
2021-11-09  6:54     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 12:50   ` Eli Zaretskii
2021-11-09 12:58     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 13:35       ` Eli Zaretskii
2021-11-09 13:51         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-09 17:33       ` Benjamin Riefenstahl

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87k0hhal3v.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=51702@debbugs.gnu.org \
    --cc=luangruo@yahoo.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 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).