From unknown Sat Sep 20 04:47:09 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#79473 <79473@debbugs.gnu.org> To: bug#79473 <79473@debbugs.gnu.org> Subject: Status: 14.1.0; [PATCH] Save ini preview files inside TeX-output-dir Reply-To: bug#79473 <79473@debbugs.gnu.org> Date: Sat, 20 Sep 2025 11:47:09 +0000 retitle 79473 14.1.0; [PATCH] Save ini preview files inside TeX-output-dir reassign 79473 auctex submitter 79473 Al Haji-Ali severity 79473 normal tag 79473 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 19 14:10:25 2025 Received: (at submit) by debbugs.gnu.org; 19 Sep 2025 18:10:25 +0000 Received: from localhost ([127.0.0.1]:40988 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uzfYu-0003sP-Rr for submit@debbugs.gnu.org; Fri, 19 Sep 2025 14:10:25 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60422) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uzfYq-0003rZ-Op for submit@debbugs.gnu.org; Fri, 19 Sep 2025 14:10:21 -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 1uzfYk-0003a8-2o for bug-auctex@gnu.org; Fri, 19 Sep 2025 14:10:14 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uzfYb-0007hG-CO for bug-auctex@gnu.org; Fri, 19 Sep 2025 14:10:11 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-62f4273a404so6440686a12.0 for ; Fri, 19 Sep 2025 11:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758305403; x=1758910203; darn=gnu.org; h=mime-version:message-id:date:cc:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Ijr3Rgmy6g57lO0blVUBtzEHvD3aJTgFYbhE6rxBjMk=; b=IrVQQVAnHHpjnbKKy8Bty4/VgW1s4KCC7ZdY5URsB7as7XkJ/dHArJkB6pFH61AQfD q9vpSS2rNrvcyHVPK6ytTBKAISFBM6Awn7ZCYZmRbtp7ToQpHAFWMJv7eVTVU9cmNYOm C/w5d3NK72jCY6QjqdlkCkGCqEZ6tk9VYJY0rJtnBpkWgYsxwObZ5jkp5wJQo6LJ9Esc XrGOnvfWGDo1657M5in7SrZID/MXlrA0UbxaSig9fH/IyQPLDlD6ZKMvchotmbrWwdMk PuGNIJ/96T7O5816ZHD78AxW9XEFX3asa2Qpznz7GLkSHMsEFt1DpTH7ghky378fW1H2 qO9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758305403; x=1758910203; h=mime-version:message-id:date:cc:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ijr3Rgmy6g57lO0blVUBtzEHvD3aJTgFYbhE6rxBjMk=; b=d+w1u+k0KNRScqN+9kXUbHwh0SxQ6B+Y+BErLHHJJAtdOyDfrgVBVzWbJaHZ6BqvVT YsDplMBfkRHe8riVRTbafzSjmCxdeHfemjZ+VSvlVJlHwmpTMqXC3sI2m3JHQAavQauJ iY7sl9/qdowsli6qV1E+73tz4y5y9ZJDfMTuauCKEsFY8xnvN58t1wpxk9Yjoa5A8a41 vwFDuof4ZHxyZz7dGHW5Adc9SUpHNJHN4VMR2cDaYAHBllwLTFfmiy5MfTo0Kcq/JEg4 ksvbSJ21yEDW+arxUKy3W7fn8rl/As7JYs7rokPzYeBXUZo/KLdwyAUW8xwO7ruwUp1g gObw== X-Gm-Message-State: AOJu0YzmFIhVdkH9X4Flr6ec44ta1225nA66H5OfvnfIFKwBiD3t4sL1 +39l22KQ5ZWDCkIM80qQleQLsT55pNJyMn/jtEecARhHugvz9WRoZTbMARErtzAc X-Gm-Gg: ASbGncuTh3cAvwv6V+LE4s0V11AEx9FIUfrEQHjxZuS3R1e9GQYXCWoUyJQClY4a/DU koEYN8ajFsT0jkhyPf+keIin7QdS/SkrILz5y3SvClMONWvCzP5QAxWQwSnxnL7sL0/vh+i4tio Tl1Ooh6lCMTGv/oK03hfo/b8rxcBjvBcjjmzh8PsT2Rq1v6sc536JZtuRTa30/q2xFDINkT4bil M+tqp+KifBYi4G0M8e1ClY2rLuheLuLkiHNyXAA9AH3F9Hqzwx6i5pZx8lRJpnA66n/3ByNOOb4 1Qn3mN3Pxp7rXtUmAnXJDsii/sHBnmBbv1U7EfV/EB4FjMdkIy9ZvdUH50ix20Di4bSMn/TrugD kJdSmmK++vofImhWwoiy+v/mo1w5ru0RS6cpVQbbmxZc= X-Google-Smtp-Source: AGHT+IEFd5393Rgcn4BUNTy5sVT5zyb5Ql0S6fb6x8ucGIBL83U/OwMLhpCg7EjvaFfzrVslQHIJ+Q== X-Received: by 2002:a05:6402:2086:b0:62e:d3b4:4d8 with SMTP id 4fb4d7f45d1cf-62fbe458cb4mr4364889a12.10.1758305402378; Fri, 19 Sep 2025 11:10:02 -0700 (PDT) Received: from localhost ([2a02:908:1087:8480:451e:4e86:2073:681]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-62fa5d4175bsm3874223a12.20.2025.09.19.11.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Sep 2025 11:10:01 -0700 (PDT) From: Al Haji-Ali To: bug-auctex@gnu.org Subject: 14.1.0; [PATCH] Save ini preview files inside TeX-output-dir Date: Fri, 19 Sep 2025 20:00:01 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=abdo.haji.ali@gmail.com; helo=mail-ed1-x529.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=unavailable autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: Ikumi Keita , Arash Esbati 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 [Re-sending to correct mailing-list] Hello, This is another follow-up bug-report/patch from: https://lists.gnu.org/archive/html/auctex-devel/2025-08/msg00026.html When caching the preamble while previewing files, an ini file is created.. The attached places this ini file inside TeX-output-dir when that is non-nil. A change to the format of the variable `preview-dumped-alist` was required to save the name of the output file. Best regards, -- Al --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=save-ini-files-inside-TeX-output-dir.patch >From 61d952df797957dc66e2f065a24bd691a832b855 Mon Sep 17 00:00:00 2001 From: Al Haji-Ali Date: Wed, 3 Sep 2025 21:56:08 +0100 Subject: [PATCH] Save ini preview files inside TeX-output-dir * preview.el (preview-dumped-alist): Change format to include output file. (preview-watch-preamble): Accept output file as argument to save in format-cons. (preview-unwatch-preamble, preview-mode-setup): Accommodate changes of format-cons above. (preview-format-kill): Delete output file. (preview-cache-preamble): Use TeX-master-output-file instead of TeX-master-output for ini file. --- preview.el | 71 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/preview.el b/preview.el index bb0f8ee9..e86b0035 100644 --- a/preview.el +++ b/preview.el @@ -1898,7 +1898,7 @@ definition of OV, AFTER-CHANGE, BEG, END and LENGTH." (preview-format-kill format-cons) (setcdr format-cons t))) -(defun preview-watch-preamble (file command format-cons) +(defun preview-watch-preamble (file out-file command format-cons) "Set up a watch on master file FILE. FILE can be an associated buffer instead of a filename. COMMAND is the command that generated the format. @@ -1906,32 +1906,35 @@ FORMAT-CONS contains the format info for the main format dump handler." (let ((buffer (if (bufferp file) file - (find-buffer-visiting file))) ov) + (find-buffer-visiting file))) + ov) (setcdr format-cons - (cons command - (when buffer - (with-current-buffer buffer - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (unless (re-search-forward preview-dump-threshold nil t) - (error "Can't find preamble of `%s'" file)) - (setq ov (make-overlay (point-min) (point))) - (overlay-put ov 'format-cons format-cons) - (overlay-put ov 'insert-in-front-hooks - '(preview-preamble-changed-function)) - (overlay-put ov 'modification-hooks - '(preview-preamble-changed-function)) - ov)))))))) + (cl-list* + out-file + command + (when buffer + (with-current-buffer buffer + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (unless (re-search-forward preview-dump-threshold nil t) + (error "Can't find preamble of `%s'" file)) + (setq ov (make-overlay (point-min) (point))) + (overlay-put ov 'format-cons format-cons) + (overlay-put ov 'insert-in-front-hooks + '(preview-preamble-changed-function)) + (overlay-put ov 'modification-hooks + '(preview-preamble-changed-function)) + ov)))))))) (defun preview-unwatch-preamble (format-cons) "Stop watching a format on FORMAT-CONS. The watch has been set up by `preview-watch-preamble'." (when (consp (cdr format-cons)) - (when (cddr format-cons) - (delete-overlay (cddr format-cons))) + (when (cdddr format-cons) + (delete-overlay (cdddr format-cons))) (setcdr (cdr format-cons) nil))) (defun preview-register-change (ov) @@ -2498,10 +2501,10 @@ The elements are (NAME . ASSOC). NAME is the master file name format. Possible values: nil means no format is available and none should be generated. t means no format is available, it should be generated on demand. If the value is a cons cell, -the CAR of the cons cell is the command with which the format -has been generated, and the CDR is some Emacs-flavor specific -value used for maintaining a watch on possible changes of the -preamble.") +the CAR of the cons cell is the name of output master file, the CADR of +the cons cell is the command with which the format has been generated, +and the CDDR is some Emacs-flavor specific value used for maintaining a +watch on possible changes of the preamble.") (defun preview-cleanout-tempfiles () "Clean out all directories and files with non-persistent data. @@ -3157,6 +3160,7 @@ pp") (preview-unwatch-preamble format-cons) (preview-watch-preamble (current-buffer) (cadr format-cons) + (caddr format-cons) format-cons))))) ;;;###autoload @@ -3996,10 +4000,11 @@ Those are just needed for cleanup." "Kill a cached format. FORMAT-CONS is intended to be an element of `preview-dumped-alist'. Tries through `preview-format-extensions'." - (dolist (ext preview-format-extensions) - (condition-case nil - (delete-file (preview-dump-file-name (concat (car format-cons) ext))) - (file-error nil)))) + (when (consp (cdr format-cons)) + (dolist (ext preview-format-extensions) + (condition-case nil + (delete-file (preview-dump-file-name (concat (cadr format-cons) ext))) + (file-error nil))))) (defun preview-dump-file-name (file) "Make a file name suitable for dumping from FILE." @@ -4101,20 +4106,21 @@ If FORMAT-CONS is non-nil, a previous format may get reused." (interactive) (setq TeX-current-process-region-p nil) (let* ((dump-file - (expand-file-name (preview-dump-file-name (TeX-master-file "ini")))) + (expand-file-name (preview-dump-file-name (TeX-master-output-file "ini")))) (master (TeX-master-file)) (format-name (expand-file-name master)) (preview-format-name (shell-quote-argument - (preview-dump-file-name (file-name-nondirectory - master)))) + (preview-dump-file-name + (TeX-master-output-file nil)))) (master-file (expand-file-name (TeX-master-file t))) + (master-output-file (expand-file-name (TeX-master-output-file nil))) (command (preview-do-replacements (TeX-command-expand (preview-string-expand preview-LaTeX-command)) preview-dump-replacements)) (preview-auto-cache-preamble nil)) (unless (and (consp (cdr format-cons)) - (string= command (cadr format-cons))) + (string= command (caddr format-cons))) (unless format-cons (setq format-cons (assoc format-name preview-dumped-alist))) (if format-cons @@ -4161,6 +4167,7 @@ If FORMAT-CONS is non-nil, a previous format may get reused." (zerop (process-exit-status process))) (preview-watch-preamble master-file + master-output-file command format-cons) (preview-format-kill format-cons)) -- 2.39.5 (Apple Git-154) --=-=-=--