GNU bug report logs - #43397
28.0.50; Adding tool bar items: update tool bar

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Caio Henrique <caiohcs0@HIDDEN>; dated Mon, 14 Sep 2020 14:31:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 43397 <at> debbugs.gnu.org:


Received: (at 43397) by debbugs.gnu.org; 15 Sep 2020 15:27:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 11:27:19 2020
Received: from localhost ([127.0.0.1]:60227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kICrX-0001Cb-Jy
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 11:27:19 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38774)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kICrW-0001CP-BS
 for 43397 <at> debbugs.gnu.org; Tue, 15 Sep 2020 11:27:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47315)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kICrQ-0002sd-Pr; Tue, 15 Sep 2020 11:27:12 -0400
Received: from [176.228.60.248] (port=4733 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kICrP-0002Xn-P7; Tue, 15 Sep 2020 11:27:12 -0400
Date: Tue, 15 Sep 2020 18:27:17 +0300
Message-Id: <83lfhb83hm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Caio Henrique <caiohcs0@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <87h7s0jurl.fsf@HIDDEN> (message from Caio Henrique on Mon, 14
 Sep 2020 11:30:22 -0300)
Subject: Re: bug#43397: 28.0.50; Adding tool bar items: update tool bar
References: <87h7s0jurl.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43397
Cc: 43397 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Caio Henrique <caiohcs0@HIDDEN>
> Date: Mon, 14 Sep 2020 11:30:22 -0300
> 
> 1. emacs -Q
> 2. paste and eval this:
> (progn
>   (tool-bar-add-item-from-menu 'undo-redo
> 			       "redo" nil :vert-only t)
>   (redraw-display)
>   (force-mode-line-update))
> 
> I'm using both redraw-display and force-mode-line-update to try to force
> the tool-bar to draw the icon (I know that I should'nt do this, I'm just
> trying to figure if this is a bug)

(Calling force-mode-line-update won't help, because
tool-bar-add-item-from-menu does it internally.)

> but the icon only appears when I
> click one or two times with the mouse anywhere in the buffer. 

I've now looked into this, and I'm quite sure it is not a redisplay
bug.  The display engine faithfully inspects the tool-bar items each
time it is invoked after the above code runs, and each time it finds
that the tool-bar items haven't changed -- until they do.

Based on what I see, and on the modified recipe below, it looks like
we stick to the old value of the tool-bar items, like if we cached
them somewhere.  Since I don't understand where is that "cache", I
don't really have a clear idea of what triggers the flushing of that
"cache", but one trigger I found is -- surprise! -- GC.  To see this,
perform the following greatly simplified recipe:

  emacs -Q
  M-x blink-cursor-mode RET
  M-x global-eldoc-mode RET

(The last two commands are to make sure there are no redisplay cycles
except due to changes in buffers or strings.)

Then evaluate:

  (defun myfun ()
    (interactive)
    (tool-bar-add-item "redo" 'undo-redo 'undo-redo)
    (garbage-collect))

  (global-set-key [f5] 'myfun)

Finally, press F5: you should see the "redo" icon appear immediately.

Now repeat the same, in a fresh Emacs session, but this time remove
the call to garbage-collect from myfun, and instead do this before
evaluating the function and the global-set-key form:

  M-x set-variable RET garbage-collection-messages RET t RET

Then evaluate the forms and press F5.  The tool bar won't change.  Now
do some random clicks, watching the echo area: you will see that the
tool bar is updated with the "redo" icon precisely when the "Garbage
collecting..." message appears in the echo area.

Maybe Stefan (CC'ed) can help us understand why this happens and how
GC is involved in this...




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43397; Package emacs. Full text available.

Message received at 43397 <at> debbugs.gnu.org:


Received: (at 43397) by debbugs.gnu.org; 14 Sep 2020 21:44:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 14 17:44:21 2020
Received: from localhost ([127.0.0.1]:56554 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kHwGr-0002WT-85
	for submit <at> debbugs.gnu.org; Mon, 14 Sep 2020 17:44:21 -0400
Received: from mail-qt1-f196.google.com ([209.85.160.196]:39058)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <caiohcs0@HIDDEN>) id 1kHwGo-0002W3-94
 for 43397 <at> debbugs.gnu.org; Mon, 14 Sep 2020 17:44:19 -0400
Received: by mail-qt1-f196.google.com with SMTP id h6so1462583qtd.6
 for <43397 <at> debbugs.gnu.org>; Mon, 14 Sep 2020 14:44:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=cwDiKj3Ugv2cGFuTGHYX+3NXQW/wn9Ngi1S0djmjEE0=;
 b=GkTiWkqS/OT+i7abZbVa1uTQCOVxaR8WfM7Rg7hZFNFF9QDglC8Qe/ubF4rHfzTQsz
 8IYCF6L8T0+qrPfrYIhsMiHVB8iQBi9DXV0djU1+WbgYA3AFU8pgesz9pC+9cwJ3zuhp
 SrUAIRNA9VBeRcFFyCaDhuWF/r4VQS2rSNJBUwUiJihHjL2QnColuTBeGP9BfzYxshzv
 GPssf1EWb1mqawEB+qNIuid30WWNABNB4JRUgaoSyj1urdCowgEHnoPScEI1yDc6SSO3
 V7BCilP1XPAKhTytzo9LpmxL1OSU3a5YmzzPN42zV6Stf8DlP02ET1tUqDs8lwaKeOMP
 ehIg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=cwDiKj3Ugv2cGFuTGHYX+3NXQW/wn9Ngi1S0djmjEE0=;
 b=srMGAO2FIGV/KqqCQnKjRZp4kTOTA6MdXeA6Zm4JAhlVqGCGCSgroT45yr/jKPfkwT
 nUpg/9YtcV5C4mZ2YMnRiLrWAkjPO4JurX8jMvZ1EMuIN5worouxtZpWyz+NVZK7DAX3
 HMy1Wim1ubZhMAw7KBHYIaooEXo2+pf253SXK7ZVV0MtpMWnrCsp/vbhaayZB4VIHrw4
 d6s2UR8QDaFqND9FtElu1GfnjtYJalKhdWwwxQn98zCiesDR8whaZxUShVn6kimRCUNW
 cur9xraUAxOqTibXb6ugIcJCJ8xWiu05XPilFnHY6GLgPcJKT9HrsIjjiFd4+ktjIQXJ
 qrzg==
X-Gm-Message-State: AOAM533YU7EJk8Xw304P+9qHSYJC/Hsr7oW9W4hdtwUuR6ZKUDbag496
 gHHq+YQNU1tRhf8nGMb6AHhF+zoInF4=
X-Google-Smtp-Source: ABdhPJwtVkB/jBqLnk2lsHprsiBVdYBENeSX99dS12MgSLTauaI9n1UWdZp6pGONgKZ9rxWE2S5c9Q==
X-Received: by 2002:ac8:4f4e:: with SMTP id i14mr14262981qtw.213.1600119852524; 
 Mon, 14 Sep 2020 14:44:12 -0700 (PDT)
Received: from localhost.localdomain ([181.223.151.236])
 by smtp.gmail.com with ESMTPSA id z3sm14602590qkf.92.2020.09.14.14.44.10
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2020 14:44:12 -0700 (PDT)
From: Caio Henrique <caiohcs0@HIDDEN>
To: Caio Henrique <caiohcs0@HIDDEN>
Subject: Re: bug#43397: 28.0.50; Adding tool bar items: update tool bar
References: <87h7s0jurl.fsf@HIDDEN>
Date: Mon, 14 Sep 2020 18:44:03 -0300
In-Reply-To: <87h7s0jurl.fsf@HIDDEN> (Caio Henrique's message of "Mon, 14
 Sep 2020 11:30:22 -0300")
Message-ID: <877dswm3to.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 43397
Cc: 43397 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Gnus has a function called gnus-tool-bar-update. I tried using it but
got the same result, i.e. the icon is only displayed when I click with
the mouse on the buffer. 

1. emacs -Q
2. eval this:
(progn
  (defvar tool-bar-mode)

  (defun gnus-tool-bar-update (&rest ignore)
    "Update the tool bar."
    (when (and (boundp 'tool-bar-mode)
	       tool-bar-mode)
      (let* ((args nil)
	     (func (cond ((fboundp 'tool-bar-update)
			  'tool-bar-update)
			 ((fboundp 'force-window-update)
			  'force-window-update)
			 ((fboundp 'redraw-frame)
			  (setq args (list (selected-frame)))
			  'redraw-frame)
			 (t 'ignore))))
	(apply func args))))

  (tool-bar-add-item-from-menu 'undo-redo
			       "redo" nil :vert-only t)

  (gnus-tool-bar-update))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43397; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Sep 2020 14:30:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 14 10:30:37 2020
Received: from localhost ([127.0.0.1]:55703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kHpV6-0007hy-Qp
	for submit <at> debbugs.gnu.org; Mon, 14 Sep 2020 10:30:37 -0400
Received: from lists.gnu.org ([209.51.188.17]:34084)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <caiohcs0@HIDDEN>) id 1kHpV3-0007hp-Ja
 for submit <at> debbugs.gnu.org; Mon, 14 Sep 2020 10:30:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53906)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <caiohcs0@HIDDEN>)
 id 1kHpV3-00080F-DD
 for bug-gnu-emacs@HIDDEN; Mon, 14 Sep 2020 10:30:33 -0400
Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:44586)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <caiohcs0@HIDDEN>)
 id 1kHpV0-0002bN-Mu
 for bug-gnu-emacs@HIDDEN; Mon, 14 Sep 2020 10:30:33 -0400
Received: by mail-qk1-x741.google.com with SMTP id n133so216178qkn.11
 for <bug-gnu-emacs@HIDDEN>; Mon, 14 Sep 2020 07:30:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=n0r57nXeeIaMMD5L8BM5mIcXHj60ajVvTpuSccxtNwQ=;
 b=UTl53y+Pv1nB3HCKnf/jQmVB1sYSJcJL8M3PymTM1l8wJE8yJwMiWFoR+NEI60VrEQ
 nE0PDUPNsTzJ3jHU/v2NyYfoTTst0V+X6qr/lJb65Pptbablu2fK0aXrjtUTQVV1dO3B
 s7S/fAna2ZxeMWJIZbztA9vtDzKP/CbQAf7eOCDUGiusQihig0utUqFue+5WPNsQKDs+
 8dP0Yt31OoaGf+Z0gqGm3PWVD1X/4ws8cmfkxTLfmCqXgzSOuPOTkoTUuxwlG85O4QuC
 f3BToCSq2eoALHm8PFo3hSNAlxVOMB/oMNmTnZ+AVjnU5LEJSqFmXuBG16cUt80irMql
 YHhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=n0r57nXeeIaMMD5L8BM5mIcXHj60ajVvTpuSccxtNwQ=;
 b=F1QDrT7haUGCUzZTW761Kb7xslYBav0v14WslxMq0ipx0ci7CJMxXbbU2TjUJMeM0i
 BjIvFmpmSnkrDvMaSvciCbZOHnQ9xe9FniGzF4+m1NfdJCa04rfl3ylxIYQqMcAwMBx6
 u3n21qqPuS+OXbx9zXczyO0mTY3wrZ7TwTHNWzbYnypoOZuwNlNZJU/IeWpMbpG62n99
 i39ZZwFrCnjFLy9qyOc4RHy1hwS8SUQGkEx9KD37Xu3Hk21eo9KEThSt+Z55+bwFhXFA
 9PVhIQI2rt4TzPh+jmw9gmagm+nKWR1aZtYCaNUDnBwVGlt8VAIRWxBzmEQH0yVB14Se
 7rHA==
X-Gm-Message-State: AOAM533pqhpBvuDAJ0q8drUicvqo52FF4P/FKlpycLlwey1oOMZ6odk7
 HW1uo+JFF4v3p6bRL5TDzSAkepN4Kng=
X-Google-Smtp-Source: ABdhPJzb/oy8id7OkfciLWZjY++pdkXAzGxCkzma4nLbXsbLh31+V87UGV/DgmlAU+fCzWLVoISEiw==
X-Received: by 2002:a37:6848:: with SMTP id d69mr12351724qkc.80.1600093828697; 
 Mon, 14 Sep 2020 07:30:28 -0700 (PDT)
Received: from localhost.localdomain ([181.223.151.236])
 by smtp.gmail.com with ESMTPSA id t1sm14594889qtj.12.2020.09.14.07.30.27
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Sep 2020 07:30:28 -0700 (PDT)
From: Caio Henrique <caiohcs0@HIDDEN>
X-Google-Original-From: Caio Henrique <caio.hcs0@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; Adding tool bar items: update tool bar
Date: Mon, 14 Sep 2020 11:30:22 -0300
Message-ID: <87h7s0jurl.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::741;
 envelope-from=caiohcs0@HIDDEN; helo=mail-qk1-x741.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Hi all,

I don't know if this is a bug or the expected behavior of the function
tool-bar-add-item-from-menu: 

1. emacs -Q
2. paste and eval this:
(progn
  (tool-bar-add-item-from-menu 'undo-redo
			       "redo" nil :vert-only t)
  (redraw-display)
  (force-mode-line-update))

I'm using both redraw-display and force-mode-line-update to try to force
the tool-bar to draw the icon (I know that I should'nt do this, I'm just
trying to figure if this is a bug); but the icon only appears when I
click one or two times with the mouse anywhere in the buffer. 

If there is a bug, this is possibly related to it:
https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00603.html
https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00726.html
https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00780.html

And also this:
https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg01089.html
https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg01101.html
> Eli: Here, the above displays nothing at all on the tool bar.
(If I click with the mouse anywhere in the buffer, that icon also gets
displayed for me) 

Thanks!

____
In GNU Emacs 28.0.50 (build 19, x86_64-pc-linux-gnu, GTK+ Version
3.24.13, cairo version 1.16.0)

Configured features:
XPM JPEG TIFF GIF PNG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 XDBE XIM MODULES THREADS JSON PDUMPER




Acknowledgement sent to Caio Henrique <caiohcs0@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#43397; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 15 Sep 2020 15:30:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.