From unknown Sun Jun 15 08:21:22 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#78627 <78627@debbugs.gnu.org> To: bug#78627 <78627@debbugs.gnu.org> Subject: Status: [PATCH] Flush preview images when leaving previews visible Reply-To: bug#78627 <78627@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:21:22 +0000 retitle 78627 [PATCH] Flush preview images when leaving previews visible reassign 78627 auctex submitter 78627 "Paul D. Nelson" severity 78627 normal tag 78627 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu May 29 04:58:47 2025 Received: (at submit) by debbugs.gnu.org; 29 May 2025 08:58:47 +0000 Received: from localhost ([127.0.0.1]:33776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uKZ66-0002cl-MR for submit@debbugs.gnu.org; Thu, 29 May 2025 04:58:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60142) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uKZ63-0002cO-PN for submit@debbugs.gnu.org; Thu, 29 May 2025 04:58:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKZ5w-0006ev-VQ for bug-auctex@gnu.org; Thu, 29 May 2025 04:58:37 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKZ5v-0007OC-3u for bug-auctex@gnu.org; Thu, 29 May 2025 04:58:36 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-602346b1997so1073815a12.3 for ; Thu, 29 May 2025 01:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748509112; x=1749113912; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Ti7MKCR3wN1Uz0IvM1pDCRGaFLEJZTtigHs4E35mECE=; b=QG1kOCFoHEB+F+NxhHgisflnFf7zQutG9ucdp9crqZBYnBID404pwY3qZ+zp3mNJ8q OXUng2kiyqeltcG9v3j31UNUCu/WOEoVtlTaxlRh32+b0scnR3gStq1GLxthc66ny+Da FDhd/FzWVJOMlTM5OfUQd6Jp/VG2NY2BfRNOh0ZlmCfugsKmBI0qUPqvWd/7EKO49BMN qQKoUzgDZHLw3uufT/oEQFQLLodfLR0XGUrX/i0LFmHugeFd5lTeRJegYWVNkX94p1Mj 305GebbbsMbWrB+SOuDfTSugrzJeLIuT5Bh5DC/dC6ptGvdVNo7PPMQSus4VGnISzjdy r+LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748509112; x=1749113912; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ti7MKCR3wN1Uz0IvM1pDCRGaFLEJZTtigHs4E35mECE=; b=cDG8wWTjECTgi5+opo42mbJbtxp4OprGLo+dUSyKYWWxzw0m+B6J0kJIwfekq+8HgQ bZ3L8PpsUVGTQc/gtnkT4KKbYaO0RjZd7TBDTcCkV3d2BF6T26DfD1fXW1p3cY5Jbnev Tf+EsKapYCNli+zLem2E+2kpq8DcrMu7JISGvjErOWv08IHKHyFbT3icFBFQ1ZMDCmYo 5NepzherFe8ucppXY5Wy+qn6nVNbQhtAtDdlv1OdDJSDej0xUasBxxqVvYSvMBuE3gyX w0LaU0VUMIj8ARm6WysrmssHHu6ow6TZKf8Zd3wGnu6MOtK/6Auhdoi+QCzwY34xX4/Z ijyA== X-Gm-Message-State: AOJu0YxF7cj114nUnc2CwffG+McFio7hzbSeG9IuAUBdjNxLOpGBNpQt 66u41KpAzIs1KjLRBlg8/FpOTg0ULP3B2gkvfAe5XhmmvugBsvc35qHT4n+T9WmL X-Gm-Gg: ASbGncv3DyTx7ikRWPhuOK0TiWKfWuduAnR3Tb8WFb/3fDld7ZhUp1+oHc0thxJX/ec OVfEzcR2Dg+CLYFMgD113OCnu9pjex/C/rj2mMj166QImsdafomy9y+CqzC9fPsDxES/4Icfjfx vk413DHTp+z/YUHbzXLKLSqTQPQNEQTsCtjBxLMHMdXZFq6WeVVJLg3oq0Xueyk2StAdXwotME3 RrSuuBCrWNqgnEafxax7b3iI53bz0Qx7+CXc2IIHcWqZrqGmqaSa7pBHJU9N1LEw2dTAoP+lS1N G/BMU6ixAnX9gf/+9ABhW2bWRnRcXAC/VDIwwTwOtA0ONTbD6hyprdAG X-Google-Smtp-Source: AGHT+IGGwZm5ID/lbr7v/zsFBbUYPTz19ye1hN/pLQ35HQQ/W3vPl4Tssu29g8ufSxDDK7E+Uq7fsg== X-Received: by 2002:a17:906:c10e:b0:ad8:9e80:6bb1 with SMTP id a640c23a62f3a-ad89e807aeemr577556766b.18.1748509112274; Thu, 29 May 2025 01:58:32 -0700 (PDT) Received: from localhost ([185.229.154.43]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-6051d7e7739sm2048922a12.81.2025.05.29.01.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 May 2025 01:58:31 -0700 (PDT) From: "Paul D. Nelson" To: bug-auctex@gnu.org Subject: [PATCH] Flush preview images when leaving previews visible Date: Thu, 29 May 2025 10:58:30 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=ultrono@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Hi all, This patch fixes a rare bug with the setting preview-leave-open-previews-visible that I added last year. "Recall" that with the default value nil for that setting, when the user moves the point into a previewed region, the TeX code becomes visible and a TeX icon is shown in place of the preview graphic. On the other hand, when the setting is t, the TeX icon is replaced by the old preview image, which thus remains visible. After editing the TeX code, the user can then regenerate the preview image, either manually via the preview-* commands or automatically via the ELPA package preview-auto. Some users told me that the setting did not work correctly in shared drives, such as Dropbox and OneDrive. The symptom was that the image would not update correctly after editing in the manner described above. I was never able to reproduce the issue myself, but eventually stumbled upon [1], which led to the attached patch, a variant of which yielded positive feedback from two of the users who had noted the issue. The patch is conservative in that it only affects users of the setting preview-leave-open-previews-visible. Any feedback welcome. [1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-12/msg00681.html Thanks, best, Paul --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Flush-preview-images-when-leaving-previews-visible.patch >From 34cc04d34ed6d1bd8b0d4df6f9759efb2792eab7 Mon Sep 17 00:00:00 2001 From: Paul Nelson Date: Tue, 27 May 2025 13:50:22 +0200 Subject: [PATCH] Flush preview images when leaving previews visible * preview.el (preview-replace-active-icon): When preview-leave-open-previews-visible is t, flush the current image spec before mutating it in place. Without this flush, Emacs might still show the cached previous image (see Emacs bug#59902 for related discussion). --- preview.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/preview.el b/preview.el index 7f1027dc..cbb05a1f 100644 --- a/preview.el +++ b/preview.el @@ -1205,8 +1205,11 @@ is located." (cons 'image (cdr icon))) (defsubst preview-replace-active-icon (ov replacement) - "Replace the active Icon in OV by REPLACEMENT, another icon." (let ((img (overlay-get ov 'preview-image))) + (when (and preview-leave-open-previews-visible + (consp img)) + ;; No "TeX icon" has been shown, so we flush manually. + (image-flush (car img) t)) (setcdr (car img) (cdar replacement)) (setcdr img (cdr replacement)))) -- 2.39.3 (Apple Git-145) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 29 05:02:12 2025 Received: (at 78627) by debbugs.gnu.org; 29 May 2025 09:02:12 +0000 Received: from localhost ([127.0.0.1]:33795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uKZ9P-0002xK-QU for submit@debbugs.gnu.org; Thu, 29 May 2025 05:02:12 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:60502) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uKZ9N-0002wu-0t for 78627@debbugs.gnu.org; Thu, 29 May 2025 05:02:09 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-ad5740dd20eso94046466b.0 for <78627@debbugs.gnu.org>; Thu, 29 May 2025 02:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748509322; x=1749114122; darn=debbugs.gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=LmZ5L3x0XsoCZ9HTtHOd4aRPN+5eWdcVe95CktvtKgs=; b=ZYJJVMyAewoMDysqxl8raa8BD04Kic94uPtRP58uD/SFCRO70rAlCA9BRKiMetm/8p fXofbEATAlKcidkdZPdOdtcaJULIkt/goYOlxU5AZEusqQrmf/QPDybpIioOVYiLqWw7 rhxwvYL1pNDHGg4f74oxTZamDOWe9+Pwt6apEDws1hqHYy7uUOc8iFjJ1Z6W1VAuD41+ 7me1uTsoE9hJeuVImX8Zi/eYcbm4lSLeaQqR539ao3BoZCuBjwunpmMeYYwpu0B0yyke V68TNwv3AybPm5YU3pklF9pQO3ODqSWIyCwtIKD0pXfwnAVpnlLGCjlAVA9oPhSRxPT6 VKkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748509322; x=1749114122; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LmZ5L3x0XsoCZ9HTtHOd4aRPN+5eWdcVe95CktvtKgs=; b=K/ylA34lVu91OBcDjhwxj74e9d5/EOUNDAUOP9yL9UO/dii2eDVbrCLq1IqdKL1RJM eeFGQQj5RXqT/pwHCdz5+Blati0I30N/jv1+6QdknjwtTRgkoLLvAC49ZU4D97VpkyWr NKfj49yPhgpSAnq8+K7roMxATekySjR/jkV6iLsSI4tdL4Bmq9WdvwJfIfrMGDnyzf08 gr7peNdaS2pFOi7l3q2Z+B+kBydPCMwDNE4NxKGJq5aD1EQgXqjZFG1odbWW78ZdrjCc bfxi4pYOa2UUDJdKYaf+gqRE3meLPz0di7nWHgFMJAmUqCGSSzG4aQbuSRZbLoUiDW5f tiwQ== X-Gm-Message-State: AOJu0YyjU2NIRj5ocweClB4MJ/xsBOPf4L2ZSX39n7R16VjWFRPuT9tk bpFq167QQ/fLlrTAwKwxtvjEDvv1RaiutZHOuntp27OdVI4cWCiVBWNc X-Gm-Gg: ASbGnctRKX6Cn9pjDuNJfGpb15eqlCpAtD8I0rd7aTha9zuMPfScItUH2z/sdJYFE0L YSPI8DpCNF5Mk3pgJ7ehBRAA+R3GgEkQZYV1nMh0lWQEcIIrXqbd6yDrurTs2YHrHF/obQPlt7h 2UmaHAaLDebMu1cuukypVInT1KrQF0Lo6EU4L+L3JzcAwB54rao2Dsu6J7lBUr0az8F1MtsSliS LcgODRuRT41wmUnt33gA3DSRXyTshfLnGP8NfAC64zs4r2p91LvOySNaKYfPL2xmqpP/0ii5kRw j0nyNyvrf48dTceKOeMczmgQtqaicsK7KnNPYAbgyiEwreVhf00o3P7B X-Google-Smtp-Source: AGHT+IE/llb5NRB1m5oKp1tyPfGn2iW35RP7AR7ZwW2qoiS04N4kFib5qz6icWe7yDaiqNa5M9CxHA== X-Received: by 2002:a17:907:7fa0:b0:ad8:a329:b488 with SMTP id a640c23a62f3a-ad8a329bbe6mr468800666b.13.1748509321882; Thu, 29 May 2025 02:02:01 -0700 (PDT) Received: from localhost ([185.229.154.43]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-ada6ad394dasm102869766b.130.2025.05.29.02.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 May 2025 02:02:01 -0700 (PDT) From: "Paul D. Nelson" To: "Paul D. Nelson" Subject: Re: bug#78627: [PATCH] Flush preview images when leaving previews visible In-Reply-To: (ultrono@gmail.com) Date: Thu, 29 May 2025 11:01:59 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78627 Cc: 78627@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Sorry, I didn't mean to delete the docstring -- attaching revised patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Flush-preview-images-when-leaving-previews-visible.patch >From a5c6279fee6d26e42be935d03363054bb336f694 Mon Sep 17 00:00:00 2001 From: Paul Nelson Date: Tue, 27 May 2025 13:50:22 +0200 Subject: [PATCH] Flush preview images when leaving previews visible * preview.el (preview-replace-active-icon): When preview-leave-open-previews-visible is t, flush the current image spec before mutating it in place. Without this flush, Emacs might still show the cached previous image (see Emacs bug#59902 for related discussion). --- preview.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/preview.el b/preview.el index 7f1027dc..b1da840c 100644 --- a/preview.el +++ b/preview.el @@ -1207,6 +1207,10 @@ is located." (defsubst preview-replace-active-icon (ov replacement) "Replace the active Icon in OV by REPLACEMENT, another icon." (let ((img (overlay-get ov 'preview-image))) + (when (and preview-leave-open-previews-visible + (consp img)) + ;; No "TeX icon" has been shown, so we flush manually. + (image-flush (car img) t)) (setcdr (car img) (cdar replacement)) (setcdr img (cdr replacement)))) -- 2.39.3 (Apple Git-145) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 30 11:29:53 2025 Received: (at 78627-done) by debbugs.gnu.org; 30 May 2025 15:29:53 +0000 Received: from localhost ([127.0.0.1]:49511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uL1g9-0005fe-CD for submit@debbugs.gnu.org; Fri, 30 May 2025 11:29:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56802) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uL1g6-0005fE-Q2 for 78627-done@debbugs.gnu.org; Fri, 30 May 2025 11:29:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uL1g1-0005pw-DU; Fri, 30 May 2025 11:29:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=mKGnOHN+OLtagG/YQpyHk0fpMJ/qK+dmml7hh1rqZSY=; b=Gw8AomHgDeFqP5UHehbc 9JwBOcwqJhaD9yCbGdDMoETMnWHIo6MNHjJlL7tBsBrRAYMzx/47OhVrU656RRcTxyX0odc50iFuk Y7bjqFWrNokSFNCpdndnasGCui1sxMsmzv0NxNDTo3WyJkp5B8HdzrJWglYwEGGVqS5PSntbOUPOi 3fvvCJ9dTIy9uG7QOolaQkkEaaHJkm7mwXgJVRLYwUiy8xKX/rzFFmjxHo9+epvphag00d1m+rnMY bY3zDOqGZzU1VwDb9WQ0ORA0iu9P1Hg79nUw3CaXP6fuM+V+XbIQRSrvNxajZ+RX1AEjyNVinWmQ7 0TZX99v88UR5rg==; From: Arash Esbati To: "Paul D. Nelson" Subject: Re: bug#78627: [PATCH] Flush preview images when leaving previews visible In-Reply-To: References: Date: Fri, 30 May 2025 17:29:41 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78627-done Cc: 78627-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) "Paul D. Nelson" writes: > Sorry, I didn't mean to delete the docstring -- attaching revised > patch. Thanks. I moved the definition `preview-replace-active-icon' after `preview-leave-open-previews-visible' in order to get rid of a compiler warning. Installed and closing. Best, Arash