unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 69837@debbugs.gnu.org
Subject: bug#69837: 29.2; vtable-update-object only works in visible windows
Date: Sun, 17 Mar 2024 21:05:56 -0500	[thread overview]
Message-ID: <525dbe6a-b673-4993-aace-169d09c6b8f0@alphapapa.net> (raw)
In-Reply-To: <867ci15q8l.fsf@gnu.org>

Hi Eli,

On 3/17/24 01:25, Eli Zaretskii wrote:
>> Date: Sat, 16 Mar 2024 22:41:37 -0500
>> From: Adam Porter <adam@alphapapa.net>
>>
>> I've discovered that `vtable-update-object' only works in buffers that
>> are in visible windows.  When trying to update vtables in buffers that
>> aren't, the object being updated or replaced fails to be found in the
>> cache, apparently because `vtable--cache-key' uses `window-width' in its
>> value (so maybe if, when the vtable buffer is not visible, the selected
>> window happens to have the same width as the window in which the vtable
>> buffer was previously displayed, it will work by chance).
> 
> Does using with-selected-window help to solve the issue?

Sometimes, but not reliably, because it doesn't matter whether the 
window is selected (and the buffer might not have a window, anyway). 
I'll try to give a step-by-step explanation:

1. vtable-update-object looks in the vtable's cache to find the cached 
information about the representation of the object being updated or 
replaced.

2. In the process of doing that, it calls vtable--cache-key, which 
returns a cons cell containing the frame-terminal and window-width.

3. So if the selected frame is on the same terminal, and the selected 
window has the same width, as the ones when the vtable was last 
generated, the cache key will match.  This will allow 
vtable-update-object to access the cached values and look for the object 
in them.

But if the terminal is different, or if the selected window's width is 
different, the cache key will be different, so vtable-update-object will 
fail, even when it could potentially succeed.

In my case, the vtable's buffer is (or can be) in a window that is in a 
non-current tab (using tab-bar-mode) in the same frame, so its window is 
not visible.  And so if the selected window in the current tab has the 
same width as the vtable's window, vtable-update-object may work.  But 
if the widths don't match, it will fail.

(I suppose it may also fail if the vtable's buffer's window is visible 
but has changed width since the vtable was generated, but I haven't 
tested that.)

> If not, can you show a recipe, starting from "emacs -Q", that
> reproduces the problem, so we could study it in more detail?

I had hoped to avoid writing that much code to demonstrate it.  But if 
the explanation above doesn't suffice, let me know and I will.

Thanks,
Adam





  reply	other threads:[~2024-03-18  2:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17  3:41 bug#69837: 29.2; vtable-update-object only works in visible windows Adam Porter
2024-03-17  6:25 ` Eli Zaretskii
2024-03-18  2:05   ` Adam Porter [this message]
2024-03-18 17:05     ` Eli Zaretskii
2024-03-20  1:41       ` Adam Porter
2024-03-21  8:36       ` Adam Porter
2024-04-06 11:22         ` Eli Zaretskii

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=525dbe6a-b673-4993-aace-169d09c6b8f0@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=69837@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).