Received: (at 79559) by debbugs.gnu.org; 20 Oct 2025 09:44:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 20 05:44:07 2025 Received: from localhost ([127.0.0.1]:43807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vAmQx-0002CR-8h for submit <at> debbugs.gnu.org; Mon, 20 Oct 2025 05:44:07 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:36332) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ikumi@HIDDEN>) id 1vAmQu-0002Bi-1q for 79559 <at> debbugs.gnu.org; Mon, 20 Oct 2025 05:44:04 -0400 Received: from localhost (42-144-37-8.rev.home.ne.jp [42.144.37.8]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id 3B0615C; Mon, 20 Oct 2025 18:44:00 +0900 (JST) From: Ikumi Keita <ikumi@HIDDEN> To: Al Haji-Ali <abdo.haji.ali@HIDDEN> Subject: Re: [PATCH] Refactor preview code In-reply-to: <m0h5vzdkta.fsf@HIDDEN> References: <m0seg1z3yp.fsf@HIDDEN> <m0a51wr5nc.fsf@HIDDEN> <52560.1760620251@localhost> <m0h5vzdkta.fsf@HIDDEN> Comments: In-reply-to Al Haji-Ali <abdo.haji.ali@HIDDEN> message dated "Thu, 16 Oct 2025 15:42:57 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <57397.1760953438.1@localhost> Date: Mon, 20 Oct 2025 18:43:58 +0900 Message-ID: <57400.1760953438@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79559 Cc: Arash Esbati <arash@HIDDEN>, 79559 <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: -1.0 (-) Hi Al, >>>>> Al Haji-Ali <abdo.haji.ali@HIDDEN> writes: > I agree that dvisvgm being a variant of dvipng is weird, that is why I > proposed in the second patch I attached to rename all symbols to > `preview-dvi*-process-setup`, `preview-start-dvi*` etc so that they > include both dvipng and dvisvgm as two customization of a common > interface (the obsolete aliases would ensure code is still backward > compatible). > The other option, as you said, is to introduce new functions which call > helper functions with TYPE and COMMAND arguments fixed to those > compatible with dvipng or dvisvgm. > This is what I did first (I can probably recover it from my > preview-point branch), but I found it to be too cumbersome as I had to > pass TYPE and COMMAND from function to functions to sentinels (and had > to change the interface of existing functions to accept those > arguments). It also required some code duplication. > Overall, it felt more natural to treat the dvi conversion as the key > feature, rather than the output file which can be customized. > Let me know if you disagree, and what you think about the second path > renaming functions. OK, your second patch approach seems reasonable to me. I'm still busy catching up on various things that piled up while I was sick, so I haven't been able to get to it yet, but I'll take care of it eventually. >> -(defun preview-dvipng-process-setup () >> - "Set up dvipng process for conversion." >> +(defun preview-dvi*-process-setup-1 (img-type start sentinel) >> + "Setup process of a DVI converter to IMG-TYPE. >> +START is the function that actually starts the process and SENTINEL is >> +the used `TeX-sentinel-function'." >> >> The last sentence seems to lack a word between "the" and "used" (and >> possibly "by" is also missing?) > It's my awkward phrasing. > Perhaps simply: "START is the function that actually starts the process > with `TeX-sentinel-function' set to SENTINEL." Looks good. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopGenocide #CeasefireNOW
bug-auctex@HIDDEN:bug#79559; Package auctex.
Full text available.Received: (at 79559) by debbugs.gnu.org; 16 Oct 2025 13:50:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 16 09:50:23 2025 Received: from localhost ([127.0.0.1]:35160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1v9ON5-00007Y-3w for submit <at> debbugs.gnu.org; Thu, 16 Oct 2025 09:50:23 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:47452) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <abdo.haji.ali@HIDDEN>) id 1v9OMr-0008SV-S5 for 79559 <at> debbugs.gnu.org; Thu, 16 Oct 2025 09:50:13 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-46e47cca387so9682275e9.3 for <79559 <at> debbugs.gnu.org>; Thu, 16 Oct 2025 06:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760622603; x=1761227403; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=q8NWCSj2sQa9JDoJk91aksrncaGFdgMHc5QjfVp/rig=; b=Psnhpy25a866wgvzJfaY0g1i5UTuRsx2JdP6Ygu+oiJdvu9gWrQxti97dCbAKZOoIl 3r8p7WnfzNQ5Qs4m3H6ohhwYmuI2+EE8KyOLfYDmiE8eACJfazEkC1wxxWF9rOsNnjT+ vSn6tqIHjbusENSiQWCZE9LYomuwHUE6A8a4HrHYQSlgeH96APPqXi/nJ0sk755ZoVmH GWRw4sJtnzsQqIPAKq76axf3hyAe00EeTl/YRLw8N64QqhxOi9E0xR3IdLXQCDouVy6R Hja8s6tC0Zcyt+3MlGeuEHzq30LqEXJHreDrLy8RTX8NcYmHB4WGqnPX93vO91C3OjqY yYPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760622603; x=1761227403; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q8NWCSj2sQa9JDoJk91aksrncaGFdgMHc5QjfVp/rig=; b=M4dqSeF83CIt3KnOZU6BlPPg0ORJWYeN+9WH1RuckiqxL6wBI5yn6A0MQelkpDSfLi nfUVzDdzcO0ciSZRMRT1IoKYd044huPKctBC1Brmlr1enMlYIYWrxZD3rz9Yk2HAAivP 4LS5HTr+mb+4glAsJ00NOi49f2xsvPA81MWq9MKh24hsM6XzBvFzUOvDuCgC99y3hVvp rsnjeju2PqfhMFJuvRa4wSzRTCCq4VTRaHYFSPqk8ZbkRPTVLQJorlMxGkUll/vU/WoS WU7XM4LtGvFAiTGynov92SjBOl2At88XCi1UVSjbGLNeNXeDr6ED708j4rAhadptCEV6 5gqQ== X-Gm-Message-State: AOJu0YwnbDWuejmN71rbVu41eGZN6r3Go5kMO3ceWWZPHwrUQDgg0Cr9 ouq2fjb3D7u4I2sNB+a86yeQalcrn8sExbVsWrRkMJbSnLXx2hA1DJF/u6sMFLfu X-Gm-Gg: ASbGnctbFEiTfMsLGnNxSbyQs8KhzaJGX/ryd+3sgiq0HZ+E4SxFD5TYkLydb7VAjQa fMjvitXnCkppQzJaEqoQBjwM1PoI6KZoxf90g+tGoN6RxC2nGfQjS/7muPNIc/c0qbqEy2djjtd RNQzKnIGngHifAPW/5WtBZVsgYAorDXMOMXvTDtFiOeRoGHO0uWfMNlfzT92xLhGoq5NNH2y8FL +mrSsK9TOwoipDN5g9tFb8HiYyLOj9GucuvxDX6joWcNVjL7Es0I7C+TkO8f5mpSD8vWqBzy4L5 tN5wLafmxwoZegnViprl+3xdlNQSfMBirvmHMbwCuiTA/JX5E/Q9hZf+4cYjWknY+uobAoJGn5x /0Vqubcwmu7Zx/dfN76KI2uJI87bgcYr8oYDcEbP/1W/b5zJYIvnr5vM0unS7QfL0GxJ1lrod+o yL77yA0Q== X-Google-Smtp-Source: AGHT+IHI1hvHXTY4DEjUY+H/CrpKD/NxfFK3HCG7apXaXJWoyzwvZDXzEzYU1MkeaAI1pRMydR4WPA== X-Received: by 2002:a05:600c:548c:b0:46d:5189:3583 with SMTP id 5b1f17b1804b1-471177bad0dmr591655e9.0.1760622602264; Thu, 16 Oct 2025 06:50:02 -0700 (PDT) Received: from localhost ([2a00:8a60:e000:101:fc6a:7396:cd6a:eb5e]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-471144b5c91sm26253505e9.11.2025.10.16.06.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Oct 2025 06:50:01 -0700 (PDT) From: Al Haji-Ali <abdo.haji.ali@HIDDEN> To: Ikumi Keita <ikumi@HIDDEN> Subject: Re: [PATCH] Refactor preview code In-Reply-To: <52560.1760620251@localhost> References: <m0seg1z3yp.fsf@HIDDEN> <m0a51wr5nc.fsf@HIDDEN> <52560.1760620251@localhost> Date: Thu, 16 Oct 2025 15:42:57 +0200 Message-ID: <m0h5vzdkta.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79559 Cc: Arash Esbati <arash@HIDDEN>, 79559 <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: -1.0 (-) Hello Ikumi, On 16/10/2025, Ikumi Keita wrote: > Sorry for further delay, I've been laid up with a terrible cold since > Sunday night, and I've finally managed to get back to reviewing. No worries, I hope you are feeling better! > Your proposal basically looks good to me and I think we can accept it. > There is one minor concern: why do you treat dvisvgm as if it were a > variant of dvipng? It seems more intuitive to introduce > `preview-dvisvgm-process-setup', `preview-start-dvisvgm' etc. The point is that the dvipng functions are exactly the same as the dvisvgm functions, at least in the refactored code where everything is controlled with `preview-dvipng-image-type` and `preview-dvipng-command`. I agree that dvisvgm being a variant of dvipng is weird, that is why I proposed in the second patch I attached to rename all symbols to `preview-dvi*-process-setup`, `preview-start-dvi*` etc so that they include both dvipng and dvisvgm as two customization of a common interface (the obsolete aliases would ensure code is still backward compatible). The other option, as you said, is to introduce new functions which call helper functions with TYPE and COMMAND arguments fixed to those compatible with dvipng or dvisvgm. This is what I did first (I can probably recover it from my preview-point branch), but I found it to be too cumbersome as I had to pass TYPE and COMMAND from function to functions to sentinels (and had to change the interface of existing functions to accept those arguments). It also required some code duplication. Overall, it felt more natural to treat the dvi conversion as the key feature, rather than the output file which can be customized. Let me know if you disagree, and what you think about the second path renaming functions. > -(defun preview-dvipng-process-setup () > - "Set up dvipng process for conversion." > +(defun preview-dvi*-process-setup-1 (img-type start sentinel) > + "Setup process of a DVI converter to IMG-TYPE. > +START is the function that actually starts the process and SENTINEL is > +the used `TeX-sentinel-function'." > > The last sentence seems to lack a word between "the" and "used" (and > possibly "by" is also missing?) It's my awkward phrasing. Perhaps simply: "START is the function that actually starts the process with `TeX-sentinel-function' set to SENTINEL." -- Al
bug-auctex@HIDDEN:bug#79559; Package auctex.
Full text available.Received: (at 79559) by debbugs.gnu.org; 16 Oct 2025 13:11:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 16 09:11:11 2025 Received: from localhost ([127.0.0.1]:34856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1v9Nl7-0006HX-UY for submit <at> debbugs.gnu.org; Thu, 16 Oct 2025 09:11:11 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:56292) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ikumi@HIDDEN>) id 1v9Nky-0006Go-SE for 79559 <at> debbugs.gnu.org; Thu, 16 Oct 2025 09:11:05 -0400 Received: from localhost (42-144-37-8.rev.home.ne.jp [42.144.37.8]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id 22F5560; Thu, 16 Oct 2025 22:10:51 +0900 (JST) From: Ikumi Keita <ikumi@HIDDEN> To: Al Haji-Ali <abdo.haji.ali@HIDDEN> Subject: Re: [PATCH] Refactor preview code In-reply-to: <m0a51wr5nc.fsf@HIDDEN> References: <m0seg1z3yp.fsf@HIDDEN> <m0a51wr5nc.fsf@HIDDEN> Comments: In-reply-to Al Haji-Ali <abdo.haji.ali@HIDDEN> message dated "Sun, 12 Oct 2025 08:33:11 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <52559.1760620251.1@localhost> Date: Thu, 16 Oct 2025 22:10:51 +0900 Message-ID: <52560.1760620251@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79559 Cc: Arash Esbati <arash@HIDDEN>, 79559 <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: -1.0 (-) Hi Al, >>>>> Al Haji-Ali <abdo.haji.ali@HIDDEN> writes: > On 02/10/2025, Al Haji-Ali wrote: >> This patch (last one before preview-point implementation) refactors >> code for creating and starting preview processes. > @Arash, @Ikumi, please let me know if there's anything I can do to > make reviewing this patch easier (like splitting or joining changes). Sorry for further delay, I've been laid up with a terrible cold since Sunday night, and I've finally managed to get back to reviewing. Your proposal basically looks good to me and I think we can accept it. There is one minor concern: why do you treat dvisvgm as if it were a variant of dvipng? It seems more intuitive to introduce `preview-dvisvgm-process-setup', `preview-start-dvisvgm' etc. -(defun preview-dvipng-process-setup () - "Set up dvipng process for conversion." +(defun preview-dvi*-process-setup-1 (img-type start sentinel) + "Setup process of a DVI converter to IMG-TYPE. +START is the function that actually starts the process and SENTINEL is +the used `TeX-sentinel-function'." The last sentence seems to lack a word between "the" and "used" (and possibly "by" is also missing?) Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopGenocide #CeasefireNOW
bug-auctex@HIDDEN:bug#79559; Package auctex.
Full text available.Received: (at 79559) by debbugs.gnu.org; 12 Oct 2025 06:37:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 12 02:37:59 2025 Received: from localhost ([127.0.0.1]:47575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1v7piR-0005wd-7t for submit <at> debbugs.gnu.org; Sun, 12 Oct 2025 02:37:59 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:48482) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <abdo.haji.ali@HIDDEN>) id 1v7piO-0005wJ-QC for 79559 <at> debbugs.gnu.org; Sun, 12 Oct 2025 02:37:57 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-639e1e8c8c8so6361772a12.1 for <79559 <at> debbugs.gnu.org>; Sat, 11 Oct 2025 23:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760251070; x=1760855870; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=P3yOq9KOfYDWsXoKBxOhOOOf8mKBPRmcxfc4QopL0oc=; b=ea1zsWLh8UYpjzuVy3VSP8eR2L4DKBOln34kBhjti8pxiuiJVADBcXgWADteltIp1y RfX7/zPpZI5hHhmeBXbSwSnAxboVflfB84Av474YhzhlAVcEUeC7m/AVg5kteNUkm3FD L17i4rVLgiR+GbaKjBnPJSgte4VOysBQCk6VTiYCS520cBrUqcb0srv3rTidxKZN2MYg D6hHUvWQmuxB4rSmvgETnXWJyH5JfWMgc1uF9ZUGuSEizkswsJ1QaDe5GxMEbVDBT/JT 728uF9J91rr9+E7y6Y8GD20EkAw3+SU9YLZ6Al9PpYNKqUoeUGDwRj4VnOz+lAsFSzp8 uimA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760251070; x=1760855870; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P3yOq9KOfYDWsXoKBxOhOOOf8mKBPRmcxfc4QopL0oc=; b=N073eegztNfGTIvXnJBAWbsY1WjgzQ2fhZE0iF2KRzE1CFoVI5F5phktQUJrjKUHmd PvhNZP0N8Eg4aeY28zzC3svEDphCbrSaDb1QQicNHgZxsFj0SMiUWHnv/JouGcvQ7IYV P6B4HErAQwESoMxB2Tm985vxCLg27cOB3aDohWz9+X7lPY+7TT5atmnaE7lnlX8mh+Za BdSTL07C78L1moA/LASUhzRsjYvwivJLchYFeMMicizA+5BwSACzLwaiQbceqmNTVmSu GCD1tvRFiy8BzOj2jKvo7FLkvBI+8g/RZ3YPuqsXuRePhidCfxVS3adKkRZtl8pDoOMZ C1OA== X-Gm-Message-State: AOJu0Yw3TDRjP2H2F8s+vXE8v0ryJ+DB9zZ8Aa3HCtNnhBNqBNX/qOgi b+f6rpH+26N+YxBiYOyIn01S7JkCe5bgjOFL5J387fZoFjiUJKkrfuXJzA8RLjafGEk= X-Gm-Gg: ASbGnctfSweTssBcKyFU2teITKg+5J2AYEJy0i9PPrjGVBFa0nOshxzYQ4ch66xeSQ3 uRkjU23hXuCNuDzyKDlBz0HxqxFU+EXPMOI9ABb7zpCQXwJxTCLaO41JM/beVPX0ok/TMXaPvV0 /TsR2i0DryJ66kRGLQz60SISn0bI1ieC3cqKbJLk6g8dpNLlEBeiXmeiTupnWeTNZ683wDeG8Kp 18IUQEBz7WPn3NFgXr06OKVvFTihNa6mDESV5ecr3Sv2JK+BfS0JCjG/0Sn/6oufaI3m+QuWY/5 hJeogBUCuBdWp8yBlqylolP9YEsIvaUh3ssz0loMDiAFHy6ajXrTxmfi1nbIIQn242y3EyUH4zI Kbtk0K6Q9V+OgSJJryOpI4rtrQv7zodyVzIzIKUXQ4cU/yMZzrK672TKjukCWB0Y= X-Google-Smtp-Source: AGHT+IHE1NJch42F7qR4pNuiGJweBsGBTQK+Gu2FDuLtLlTZz9rau90h22hcDUICMA7kGvlltjZ3zw== X-Received: by 2002:a17:907:9628:b0:b46:abad:430f with SMTP id a640c23a62f3a-b50ac5d0873mr1432283866b.52.1760251070162; Sat, 11 Oct 2025 23:37:50 -0700 (PDT) Received: from localhost ([2a02:908:1087:8480:d07c:3b4d:eea0:bb34]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-b55d5cadb18sm660504166b.3.2025.10.11.23.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Oct 2025 23:37:49 -0700 (PDT) From: Al Haji-Ali <abdo.haji.ali@HIDDEN> To: 79559 <at> debbugs.gnu.org Subject: Re: [PATCH] Refactor preview code In-Reply-To: <m0seg1z3yp.fsf@HIDDEN> References: <m0seg1z3yp.fsf@HIDDEN> Date: Sun, 12 Oct 2025 08:33:11 +0200 Message-ID: <m0a51wr5nc.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79559 Cc: Ikumi Keita <ikumi@HIDDEN>, Arash Esbati <arash@HIDDEN> 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: -1.0 (-) On 02/10/2025, Al Haji-Ali wrote: > This patch (last one before preview-point implementation) refactors code for creating and starting preview processes. @Arash, @Ikumi, please let me know if there's anything I can do to make reviewing this patch easier (like splitting or joining changes). Thanks, -- Al
bug-auctex@HIDDEN:bug#79559; Package auctex.
Full text available.
Received: (at submit) by debbugs.gnu.org; 2 Oct 2025 16:08:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 02 12:08:25 2025
Received: from localhost ([127.0.0.1]:40992 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1v4Lqx-0007pw-M9
for submit <at> debbugs.gnu.org; Thu, 02 Oct 2025 12:08:25 -0400
Received: from lists.gnu.org ([2001:470:142::17]:42498)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <abdo.haji.ali@HIDDEN>)
id 1v4Lqp-0007pU-Qh
for submit <at> debbugs.gnu.org; Thu, 02 Oct 2025 12:08:18 -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 <abdo.haji.ali@HIDDEN>)
id 1v4Lqe-0006zd-CQ
for bug-auctex@HIDDEN; Thu, 02 Oct 2025 12:08:04 -0400
Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <abdo.haji.ali@HIDDEN>)
id 1v4LqL-0007YQ-IJ
for bug-auctex@HIDDEN; Thu, 02 Oct 2025 12:08:01 -0400
Received: by mail-wm1-x329.google.com with SMTP id
5b1f17b1804b1-46e6a6a5e42so5342315e9.0
for <bug-auctex@HIDDEN>; Thu, 02 Oct 2025 09:07:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1759421260; x=1760026060; darn=gnu.org;
h=mime-version:message-id:date:cc:subject:to:from:from:to:cc:subject
:date:message-id:reply-to;
bh=DxYitvPuCU7bl7kFvD47mjdIHRh9xIjybjDvCLFeR8w=;
b=m69HMeNS7EFnw2MT10bi0+IFzxf4nPBOIY/yuMPnMt32yHw1uJOurTZXp3jKGVklq7
3oQQVtXfKV+Q/zypT8V7MLGX5E+be7YPv+G4ayGlrox+3Euxyig7xb4ATNaUuvXXhGAQ
9zBV76NjgOt6ftaZnp4tXtTYE9aV2i5EoYUCCqqVmyiYlr+xcTJEl0pf3ja1ZEOCpptZ
XIvXSX4kVLbyfkAQNUUgMdamPBUy+QnOFvdND1VHwWY8NJXophPZCT12gXy2ZlMQQ2KZ
UYXzF+spY+/JX7H6UDkbMiOxg3yWbdt3ijeTmte8R95YmYUEP8cxMf49SZXbJUaSOclH
NePA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1759421260; x=1760026060;
h=mime-version:message-id:date:cc:subject:to:from:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=DxYitvPuCU7bl7kFvD47mjdIHRh9xIjybjDvCLFeR8w=;
b=J9rX5of7aFOKNeu/J7eyU3kfqCfB9nvtMq/OUb7Ynn4vjRfDDH1WtjqfI/qCbAkIVI
WQ2iaAwI3Li/yZUe5mZ3Hb1NliVmvXqTeQt/54YePpVzdlkzAT+Vpw7hOj6tw3owTlyQ
iKtHi+T14UNkVzbgwIifXwQO5J4y8NPcnel7+3zsJzb6TzGhIM+PF+bb9bpXALd5qXLy
mmrr9g4lFPUjZdhnoiYLQx8Zf/WTo5PkRnQKYE7y5+CY5ji9BYvlRw1nwrk4U/mg+hiV
oMMq4yM2ZetqB8ZYtnpoy2zelfPqaoRfSOfinAWbYsZzY9XHbga5EkpV7rHahiOlmZlb
MSIw==
X-Gm-Message-State: AOJu0YywqjduApuPAwD6eWPnWQAgl8+7I1Eg63ZqYgKuyycOiyJrkOaV
26cfuhb3u8JEx3R4YRsnt+wt23Az9eUzW7EiLvfLXTDOBf3V6gNXUmAcpGp4jPaNBcc=
X-Gm-Gg: ASbGnct4zatC57Z9VooVu3toSwWOfTlJhqA9/z9Lo4blRd1C97M/NGAqxNhBhD1s+iO
ZcUi2h/cxAJS3ft7IdO5q0CTwOjhOgEX1t0GPUj0Tew/B9kJep0F9Wz87R+39573jchhdvT2VRV
gJrMfmcusAt6MG2a01y8DOISwoLcs8acCadXCtdfYjxJy8h5/x1LuGLi0T6kKEuvBHoDEh3YiRW
EhaGLVoQdQ5xk8e99GO9N1iC8KejnqrdEH+q3ZUHO4L1TuEfnt2t4ibeHhy/pr/0aC4oS9vvbeV
WeeQ3S8Wciz9EFxaDoqep3smjQvOJ6wHr1kPxRJWZc03BCHXfcW3azbsqumn7F2qy7XqYDcODcH
qPoYCYBEnIQ1IfEWo
X-Google-Smtp-Source: AGHT+IF91Ge5CSDmkzLmBhkFuqeNPP5zTitwnN516QbgNa8ls2b7MVoIEH0uMLiEAKOsMPeDBvqxtA==
X-Received: by 2002:a05:600c:474e:b0:46e:4004:a296 with SMTP id
5b1f17b1804b1-46e6127a1admr60781545e9.9.1759421259760;
Thu, 02 Oct 2025 09:07:39 -0700 (PDT)
Received: from localhost ([80.149.170.8]) by smtp.gmail.com with ESMTPSA id
5b1f17b1804b1-46e61a16e13sm89901765e9.15.2025.10.02.09.07.35
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 02 Oct 2025 09:07:38 -0700 (PDT)
From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
To: bug-auctex@HIDDEN
Subject: [PATCH] Refactor preview code
Date: Thu, 02 Oct 2025 19:02:54 +0300
Message-ID: <m0seg1z3yp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::329;
envelope-from=abdo.haji.ali@HIDDEN; helo=mail-wm1-x329.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,
T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Ikumi Keita <ikumi@HIDDEN>, Arash Esbati <arash@HIDDEN>
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.0 (/)
--=-=-=
Content-Type: text/plain
Hello,
This is another follow-up bug-report/patch from:
https://lists.gnu.org/archive/html/auctex-devel/2025-08/msg00026.html
This patch (last one before preview-point implementation) refactors code for creating and starting preview processes. It also changes how the variable `preview-dvipng-command` is interpreted. If the value of this variable is a function symbol, it is called to get the command string. This is done for two reasons:
1. Cleaner code. Previously, some parts of the actual command were stitched on in `preview-start-dvipng`.
2. It allows using other processes and dynamics commands. For example (as documented in `preview-dvisvgm-command`) one can do
(setq preview-dvipng-command #'preview-dvisvgm-command
preview-dvipng-image-type 'svg)
to generate svg images instead of png ones.
I also attach a second patch (which can also be merged with the first) which renames all `dvipng` symbols in the refactored code to `dvi*` symbols. This is purely cosmetic (to avoid legacy-looking-code), so I wasn't sure if it should be done/included at all. However, it feels more natural since the actual refactored code is not specific to png (the process/image type are controlled via the previous two variables). I included obsolete aliases for old symbols for backward compatibility, but these can alternatively be made simple aliases if the patch is deemed appropriate.
Best regards,
-- Al
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=Refactor-code-and-generalize-dvi-conversion.patch
From f16f50863891f9f2f4b051ddcc74d9919d6d9e74 Mon Sep 17 00:00:00 2001
From: Al Haji-Ali <a.hajiali@HIDDEN>
Date: Thu, 4 Sep 2025 23:07:33 +0100
Subject: [PATCH] Refactor code and generalize dvi* conversion.
* preview.el (preview-dvipng-command): Update variable doc to allow its
value to be a function returning the command.
(preview-dvipng-command): New function to return command for dvipng.
(preview-dvisvgm-command): New function to return command for dvisvgm.
(preview-start-process): New function with refactored code
(preview-start-dvipng, preview-start-dvips, preview-start-pdf2dsc): Use
refactored code above.
(preview-dvi*-process-setup-1): New function with refactored code.
(preview-dvipng-process-setup, preview-gs-dvips-process-setup): Use
refactored code above.
---
preview.el | 215 +++++++++++++++++++++++++----------------------------
1 file changed, 100 insertions(+), 115 deletions(-)
diff --git a/preview.el b/preview.el
index b23bf41b..74b92342 100644
--- a/preview.el
+++ b/preview.el
@@ -512,10 +512,13 @@ be consulted recursively.")
"dvipng -picky -noghostscript %d -o %m/prev%%03d.png"
"Command used for converting to separate PNG images.
+If it is a string, it is used as the command. Otherwise, the value is
+expected to be a function that returns the command as a string.
+
You might specify options for converting to other image types,
but then you'll need to adapt `preview-dvipng-image-type'."
:group 'preview-latex
- :type 'string)
+ :type '(choice string function))
(defcustom preview-dvipng-image-type
'png
@@ -528,6 +531,39 @@ if you customize this."
(const gif)
(symbol :tag "Other" :value png)))
+(defun preview-dvipng-command (&optional cmd)
+ "Return a shell command for running dvipng.
+CMD can be used to override the command line which is used as a basis."
+ (let* ((res (/ (* (car preview-resolution)
+ (preview-hook-enquiry preview-scale))
+ (preview-get-magnification)))
+ (resolution (format " -D%d " res))
+ (colors (preview-dvipng-color-string preview-colors res)))
+ (with-current-buffer TeX-command-buffer
+ (concat (TeX-command-expand
+ (or cmd "dvipng -picky -noghostscript %d -o %m/prev%%03d.png"))
+ " " colors resolution))))
+
+(defun preview-dvisvgm-command (&optional cmd)
+ "Return a shell command for running dvisvgm.
+CMD can be used to override the command line which is used as a basis.
+
+You may set the variable `preview-dvipng-command' to
+`'preview-dvisvgm-command' and set `preview-dvipng-image-type' to
+`'svg' to produce svg images instead of png ones."
+ (let* ((scale (* (/ (preview-hook-enquiry preview-scale)
+ (preview-get-magnification))
+ (with-current-buffer TeX-command-buffer
+ (if (bound-and-true-p text-scale-mode)
+ (expt text-scale-mode-step text-scale-mode-amount)
+ 1.0)))))
+ (with-current-buffer TeX-command-buffer
+ (concat
+ (TeX-command-expand
+ (or cmd
+ "dvisvgm --no-fonts %d --page=- --output=\"%m/prev%%3p.svg\""))
+ (format " --scale=%g " scale)))))
+
(defcustom preview-dvips-command
"dvips -Pwww -i -E %d -o %m/preview.000"
"Command used for converting to separate EPS images."
@@ -880,26 +916,10 @@ Pure borderless black-on-white will return an empty string."
"Check if IMAGETYPE is supported."
(image-type-available-p imagetype))
-(defun preview-gs-dvips-process-setup ()
- "Set up Dvips process for conversions via gs."
- (unless (preview-supports-image-type preview-gs-image-type)
- (error "preview-image-type setting '%s unsupported by this Emacs"
- preview-gs-image-type))
- (setq preview-gs-command-line (append
- preview-gs-command-line
- (list (preview-gs-resolution
- (preview-hook-enquiry preview-scale)
- (car preview-resolution)
- (cdr preview-resolution)))))
- (if preview-parsed-pdfoutput
- (preview-pdf2dsc-process-setup)
- (setq TeX-sentinel-function #'preview-gs-dvips-sentinel)
- (list (preview-start-dvips preview-fast-conversion) (current-buffer)
- TeX-active-tempdir preview-ps-file
- preview-gs-image-type)))
-
-(defun preview-dvipng-process-setup ()
- "Set up dvipng process for conversion."
+(defun preview-dvi*-process-setup-1 (img-type start sentinel)
+ "Setup process of a DVI converter to IMG-TYPE.
+START is the function that actually starts the process and SENTINEL is
+the used `TeX-sentinel-function'."
(setq preview-gs-command-line (append
preview-gs-command-line
(list (preview-gs-resolution
@@ -909,18 +929,33 @@ Pure borderless black-on-white will return an empty string."
(if preview-parsed-pdfoutput
(if (preview-supports-image-type preview-gs-image-type)
(preview-pdf2dsc-process-setup)
- (error "preview-image-type setting '%s unsupported by this Emacs"
+ (error "preview-gs-image-type setting '%s unsupported by this Emacs"
preview-gs-image-type))
- (unless (preview-supports-image-type preview-dvipng-image-type)
- (error "preview-dvipng-image-type setting '%s unsupported by this Emacs"
- preview-dvipng-image-type))
- (setq TeX-sentinel-function #'preview-dvipng-sentinel)
- (list (preview-start-dvipng) (current-buffer) TeX-active-tempdir t
- preview-dvipng-image-type)))
+ (unless (preview-supports-image-type img-type)
+ (error "Image type setting '%s unsupported by this Emacs" img-type))
+ (setq TeX-sentinel-function sentinel)
+ (list (funcall start)
+ (current-buffer)
+ TeX-active-tempdir t
+ img-type)))
+(defun preview-gs-dvips-process-setup ()
+ "Set up Dvips process for conversions via gs."
+ (preview-dvi*-process-setup-1
+ preview-gs-image-type
+ (lambda ()
+ (preview-start-dvips preview-fast-conversion))
+ #'preview-gs-dvips-sentinel))
+
+(defun preview-dvipng-process-setup ()
+ "Set up dvipng process for conversion."
+ (preview-dvi*-process-setup-1
+ preview-dvipng-image-type
+ #'preview-start-dvipng
+ #'preview-dvipng-sentinel))
(defun preview-pdf2dsc-process-setup ()
- (setq TeX-sentinel-function #'preview-pdf2dsc-sentinel)
+ (setq TeX-sentinel-function #'preview-pdf2dsc-sentinel)
(list (preview-start-pdf2dsc) (current-buffer) TeX-active-tempdir
preview-ps-file preview-gs-image-type))
@@ -1036,7 +1071,7 @@ The usual PROCESS and COMMAND arguments for
(funcall fun process command t)))))
(TeX-synchronous-sentinel "Preview-DviPS" (cdr preview-gs-file)
process))
- ;; pathological case: no previews although we sure thought so.
+ ;; pathological case: no previews although we sure thought so.
(delete-process process)
(unless (eq (process-status process) 'signal)
(preview-dvips-abort)))))
@@ -3839,83 +3874,55 @@ The fourth value is the transparent border thickness."
(setq mask nil))
(vector bg fg mask preview-transparent-border)))
+(defun preview-start-process (name command)
+ (setq TeX-active-tempdir (buffer-local-value 'TeX-active-tempdir
+ TeX-command-buffer))
+ (goto-char (point-max))
+ (insert-before-markers "Running `" name "' with ``" command "''\n")
+ (setq mode-name name)
+ (if TeX-process-asynchronous
+ (let ((process (start-process name (current-buffer) TeX-shell
+ TeX-shell-command-option
+ command)))
+ (if TeX-after-start-process-function
+ (funcall TeX-after-start-process-function process))
+ (TeX-command-mode-line process)
+ (set-process-filter process #'TeX-command-filter)
+ (set-process-sentinel process #'TeX-command-sentinel)
+ (set-marker (process-mark process) (point-max))
+ (push process compilation-in-progress)
+ (sit-for 0)
+ process)
+ (setq mode-line-process ": run")
+ (force-mode-line-update)
+ (call-process TeX-shell nil (current-buffer) nil
+ TeX-shell-command-option
+ command)))
+
(defun preview-start-dvipng ()
"Start a DviPNG process.."
- (let* (;; (file preview-gs-file)
- tempdir
- (res (/ (* (car preview-resolution)
- (preview-hook-enquiry preview-scale))
- (preview-get-magnification)))
- (resolution (format " -D%d " res))
- (colors (preview-dvipng-color-string preview-colors res))
- (command (with-current-buffer TeX-command-buffer
- (prog1
- (concat (TeX-command-expand preview-dvipng-command)
- " " colors resolution)
- (setq tempdir TeX-active-tempdir))))
- (name "Preview-DviPNG"))
- (setq TeX-active-tempdir tempdir)
- (goto-char (point-max))
- (insert-before-markers "Running `" name "' with ``" command "''\n")
- (setq mode-name name)
- (if TeX-process-asynchronous
- (let ((process (start-process name (current-buffer) TeX-shell
- TeX-shell-command-option
- command)))
- (if TeX-after-start-process-function
- (funcall TeX-after-start-process-function process))
- (TeX-command-mode-line process)
- (set-process-filter process #'TeX-command-filter)
- (set-process-sentinel process #'TeX-command-sentinel)
- (set-marker (process-mark process) (point-max))
- (push process compilation-in-progress)
- (sit-for 0)
- process)
- (setq mode-line-process ": run")
- (force-mode-line-update)
- (call-process TeX-shell nil (current-buffer) nil
- TeX-shell-command-option
- command))))
+ (preview-start-process
+ "Preview-DviPNG"
+ (if (stringp preview-dvipng-command)
+ (preview-dvipng-command preview-dvipng-command)
+ (funcall preview-dvipng-command))))
(defun preview-start-dvips (&optional fast)
"Start a DviPS process.
If FAST is set, do a fast conversion."
- (let* (;; (file preview-gs-file)
- tempdir
+ (let* (tempdir
(command (with-current-buffer TeX-command-buffer
(prog1
(TeX-command-expand (if fast
preview-fast-dvips-command
preview-dvips-command))
- (setq tempdir TeX-active-tempdir))))
- (name "Preview-DviPS"))
- (setq TeX-active-tempdir tempdir)
+ (setq tempdir TeX-active-tempdir)))))
(setq preview-ps-file (and fast
(preview-make-filename
(preview-make-filename
"preview.ps" tempdir)
tempdir)))
- (goto-char (point-max))
- (insert-before-markers "Running `" name "' with ``" command "''\n")
- (setq mode-name name)
- (if TeX-process-asynchronous
- (let ((process (start-process name (current-buffer) TeX-shell
- TeX-shell-command-option
- command)))
- (if TeX-after-start-process-function
- (funcall TeX-after-start-process-function process))
- (TeX-command-mode-line process)
- (set-process-filter process #'TeX-command-filter)
- (set-process-sentinel process #'TeX-command-sentinel)
- (set-marker (process-mark process) (point-max))
- (push process compilation-in-progress)
- (sit-for 0)
- process)
- (setq mode-line-process ": run")
- (force-mode-line-update)
- (call-process TeX-shell nil (current-buffer) nil
- TeX-shell-command-option
- command))))
+ (preview-start-process "Preview-DviPS" command)))
(defun preview-start-pdf2dsc ()
"Start a PDF2DSC process."
@@ -3926,36 +3933,14 @@ If FAST is set, do a fast conversion."
(prog1
(TeX-command-expand preview-pdf2dsc-command)
(setq tempdir TeX-active-tempdir
- pdfsource (funcall (car file) "pdf" t)))))
- (name "Preview-PDF2DSC"))
- (setq TeX-active-tempdir tempdir)
+ pdfsource (funcall (car file) "pdf" t))))))
(setq preview-ps-file (preview-attach-filename
pdfsource
(preview-make-filename
(preview-make-filename
"preview.dsc" tempdir)
tempdir)))
- (goto-char (point-max))
- (insert-before-markers "Running `" name "' with ``" command "''\n")
- (setq mode-name name)
- (if TeX-process-asynchronous
- (let ((process (start-process name (current-buffer) TeX-shell
- TeX-shell-command-option
- command)))
- (if TeX-after-start-process-function
- (funcall TeX-after-start-process-function process))
- (TeX-command-mode-line process)
- (set-process-filter process #'TeX-command-filter)
- (set-process-sentinel process #'TeX-command-sentinel)
- (set-marker (process-mark process) (point-max))
- (push process compilation-in-progress)
- (sit-for 0)
- process)
- (setq mode-line-process ": run")
- (force-mode-line-update)
- (call-process TeX-shell nil (current-buffer) nil
- TeX-shell-command-option
- command))))
+ (preview-start-process "Preview-PDF2DSC" command)))
(defvar-local preview-abort-flag nil
"Cause ongoing preview generation to abort.
--
2.50.1 (Apple Git-155)
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=Rename-dvipng-symbols-to-dvi.patch
From 1618f947a02f72fe1aba496c0557bd1ad0e351a3 Mon Sep 17 00:00:00 2001
From: Al Haji-Ali <a.hajiali@HIDDEN>
Date: Tue, 30 Sep 2025 08:17:36 +0300
Subject: [PATCH] Rename dvipng symbols to dvi*
* preview.el (preview-image-creators): Rename `dvipng' to `dvi*'
(preview-gs-image-type-alist): Rename `dvipng' to `dvi*'
(preview-call-hook): Add warning when using obsolete `dvipng'
(preview-dvi*-command): was preview-dvipng-command.
(preview-dvi*-image-type): was preview-dvipng-image-type.
(preview-dvisvgm-command): Update doc.
(preview-dvi*-process-setup): was `preview-dvipng-process-setup'
(preview-dvi*-abort): was `preview-dvipng-abort'
(preview-dvi*-sentinel): was `preview-dvipng-sentinel'.
(preview-dvi*-close): was preview-dvipng-close
(preview-dvi*-place-all): was `preview-dvipng-place-all'.
(preview-start-dvi*): was preview-start-dvipng.
(preview-report-bug): Update to new names.
Also added obsolete aliases to maintain backward compatibility.
---
preview.el | 106 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 64 insertions(+), 42 deletions(-)
diff --git a/preview.el b/preview.el
index 74b92342..1930bc23 100644
--- a/preview.el
+++ b/preview.el
@@ -167,10 +167,10 @@ Suitable spec is chosen from `preview-icon-specs'.")
:prefix "preview-")
(defcustom preview-image-creators
- '((dvipng
- (open preview-gs-open preview-dvipng-process-setup)
+ '((dvi*
+ (open preview-gs-open preview-dvi*-process-setup)
(place preview-gs-place)
- (close preview-dvipng-close))
+ (close preview-dvi*-close))
(png (open preview-gs-open)
(place preview-gs-place)
(close preview-gs-close))
@@ -209,12 +209,12 @@ function args" :inline t sexp))
(defcustom preview-gs-image-type-alist
'((png png "-sDEVICE=png16m")
- (dvipng png "-sDEVICE=png16m")
+ (dvi* png "-sDEVICE=png16m")
(jpeg jpeg "-sDEVICE=jpeg")
(pnm pbm "-sDEVICE=pnmraw")
(tiff tiff "-sDEVICE=tiff12nc"))
"Alist of image types and corresponding Ghostscript options.
-The `dvipng' and `postscript' (don't use) entries really specify
+The `dvi*' and `postscript' (don't use) entries really specify
a fallback device when images can't be processed by the requested
method, like when PDFTeX was used."
:group 'preview-gs
@@ -237,6 +237,11 @@ for the image type `preview-image-type' and calls the
hook function given there with the arguments specified there
followed by REST. If such a function is specified in there,
that is."
+ (when (eq preview-image-type 'dvipng)
+ (message "Using `dvipng' for `preview-image-type' is obsolete. Use `dvi*' \
+and set `preview-dvi*-image-type' instead.")
+ (setq preview-image-type 'dvi*))
+
(let ((hook (cdr (assq symbol
(cdr (assq preview-image-type
preview-image-creators))))))
@@ -508,7 +513,9 @@ cons cell with a separator string in the CAR, and either
an explicit list of elements in the CDR, or a symbol to
be consulted recursively.")
-(defcustom preview-dvipng-command
+(define-obsolete-variable-alias
+ 'preview-dvipng-command 'preview-dvi*-command "14.2")
+(defcustom preview-dvi*-command
"dvipng -picky -noghostscript %d -o %m/prev%%03d.png"
"Command used for converting to separate PNG images.
@@ -516,21 +523,24 @@ If it is a string, it is used as the command. Otherwise, the value is
expected to be a function that returns the command as a string.
You might specify options for converting to other image types,
-but then you'll need to adapt `preview-dvipng-image-type'."
+but then you'll need to adapt `preview-dvi*-image-type'."
:group 'preview-latex
:type '(choice string function))
-(defcustom preview-dvipng-image-type
+(define-obsolete-variable-alias
+ 'preview-dvipng-image-type 'preview-dvi*-image-type "14.2")
+(defcustom preview-dvi*-image-type
'png
- "Image type that dvipng produces.
+ "Image type that dvi conversion produces.
-You'll need to change `preview-dvipng-command' too,
-if you customize this."
+You'll need to change the variable `preview-dvi*-command' too, if you
+customize this."
:group 'preview-latex
:type '(choice (const png)
(const gif)
(symbol :tag "Other" :value png)))
+
(defun preview-dvipng-command (&optional cmd)
"Return a shell command for running dvipng.
CMD can be used to override the command line which is used as a basis."
@@ -548,8 +558,8 @@ CMD can be used to override the command line which is used as a basis."
"Return a shell command for running dvisvgm.
CMD can be used to override the command line which is used as a basis.
-You may set the variable `preview-dvipng-command' to
-`'preview-dvisvgm-command' and set `preview-dvipng-image-type' to
+You may set the variable `preview-dvi*-command' to
+`'preview-dvisvgm-command' and set `preview-dvi*-image-type' to
`'svg' to produce svg images instead of png ones."
(let* ((scale (* (/ (preview-hook-enquiry preview-scale)
(preview-get-magnification))
@@ -947,12 +957,14 @@ the used `TeX-sentinel-function'."
(preview-start-dvips preview-fast-conversion))
#'preview-gs-dvips-sentinel))
-(defun preview-dvipng-process-setup ()
- "Set up dvipng process for conversion."
+(defun preview-dvi*-process-setup ()
+ "Set up dvi conversion process."
(preview-dvi*-process-setup-1
- preview-dvipng-image-type
- #'preview-start-dvipng
- #'preview-dvipng-sentinel))
+ preview-dvi*-image-type
+ #'preview-start-dvi*
+ #'preview-dvi*-sentinel))
+(define-obsolete-function-alias
+ #'preview-dvipng-process-setup #'preview-dvi*-process-setup "14.2")
(defun preview-pdf2dsc-process-setup ()
(setq TeX-sentinel-function #'preview-pdf2dsc-sentinel)
@@ -982,8 +994,10 @@ the used `TeX-sentinel-function'."
(unless (>= (nth 2 TeX-active-tempdir) 1)
(delete-directory (nth 0 TeX-active-tempdir)))))
-(defalias 'preview-dvipng-abort #'preview-dvips-abort)
-; "Abort a DviPNG run.")
+(defalias 'preview-dvi*-abort #'preview-dvips-abort)
+; "Abort a dvi conversion run.")
+(define-obsolete-function-alias
+ #'preview-dvipng-abort #'preview-dvi*-abort "14.2")
(defun preview-gs-dvips-sentinel (process _command &optional gsstart)
"Sentinel function for indirect rendering DviPS process.
@@ -1076,8 +1090,8 @@ The usual PROCESS and COMMAND arguments for
(unless (eq (process-status process) 'signal)
(preview-dvips-abort)))))
-(defun preview-dvipng-sentinel (process _command &optional placeall)
- "Sentinel function for indirect rendering DviPNG process.
+(defun preview-dvi*-sentinel (process _command &optional placeall)
+ "Sentinel function for indirect rendering Dvi conversing process.
The usual PROCESS and COMMAND arguments for
`TeX-sentinel-function' apply. Places all snippets if PLACEALL is set."
(condition-case err
@@ -1086,14 +1100,16 @@ The usual PROCESS and COMMAND arguments for
(delete-process process)
(setq TeX-sentinel-function nil)
(when placeall
- (preview-dvipng-place-all)))
+ (preview-dvi*-place-all)))
((eq status 'signal)
(delete-process process)
- (preview-dvipng-abort))))
- (error (preview-log-error err "DviPNG sentinel" process)))
+ (preview-dvi*-abort))))
+ (error (preview-log-error err "Dvi conversion sentinel" process)))
(preview-reraise-error process))
+(define-obsolete-function-alias
+ #'preview-dvipng-sentinel #'preview-dvi*-sentinel "14.2")
-(defun preview-dvipng-close (process closedata)
+(defun preview-dvi*-close (process closedata)
"Clean up after PROCESS and set up queue accumulated in CLOSEDATA."
(if preview-parsed-pdfoutput
(preview-gs-close process closedata)
@@ -1104,18 +1120,20 @@ The usual PROCESS and COMMAND arguments for
(if (and (eq (process-status process) 'exit)
(null TeX-sentinel-function))
;; Process has already finished and run sentinel
- (preview-dvipng-place-all)
+ (preview-dvi*-place-all)
(setq TeX-sentinel-function (lambda (process command)
- (preview-dvipng-sentinel
+ (preview-dvi*-sentinel
process
command
t))))
- (TeX-synchronous-sentinel "Preview-DviPNG" (cdr preview-gs-file)
+ (TeX-synchronous-sentinel "Preview-Dvi*" (cdr preview-gs-file)
process))
;; pathological case: no previews although we sure thought so.
(delete-process process)
(unless (eq (process-status process) 'signal)
- (preview-dvipng-abort))))))
+ (preview-dvi*-abort))))))
+(define-obsolete-function-alias
+ #'preview-dvipng-close #'preview-dvi*-close "14.2")
(defun preview-dsc-parse (file)
"Parse DSC comments of FILE.
@@ -2567,8 +2585,8 @@ is already selected and unnarrowed."
(goto-char (overlay-start ov))
(if (bolp) "\n" ""))))))
-(defun preview-dvipng-place-all ()
- "Place all images dvipng has created, if any.
+(defun preview-dvi*-place-all ()
+ "Place all images that the dvi convertion process has created, if any.
Deletes the dvi file when finished."
(let (filename queued oldfiles snippet)
(dolist (ov (prog1 preview-gs-queue (setq preview-gs-queue nil)))
@@ -2576,7 +2594,7 @@ Deletes the dvi file when finished."
(setq snippet (aref (overlay-get ov 'queued) 2))
(setq filename (preview-make-filename
(format "prev%03d.%s"
- snippet preview-dvipng-image-type)
+ snippet preview-dvi*-image-type)
TeX-active-tempdir)))
(if (file-exists-p (car filename))
(progn
@@ -2587,7 +2605,7 @@ Deletes the dvi file when finished."
(preview-replace-active-icon
ov
(preview-create-icon (car filename)
- preview-dvipng-image-type
+ preview-dvi*-image-type
(preview-ascent-from-bb
(aref queued 0))
(aref preview-colors 2)))
@@ -2635,6 +2653,8 @@ Deletes the dvi file when finished."
(condition-case nil
(preview-delete-file filename)
(file-error nil)))))
+(define-obsolete-function-alias
+ #'preview-dvipng-place-all #'preview-dvi*-place-all "14.2")
(defun preview-active-string (ov)
"Generate before-string for active image overlay OV."
@@ -3899,13 +3919,15 @@ The fourth value is the transparent border thickness."
TeX-shell-command-option
command)))
-(defun preview-start-dvipng ()
- "Start a DviPNG process.."
+(defun preview-start-dvi* ()
+ "Start a Dvi conversion process.."
(preview-start-process
- "Preview-DviPNG"
- (if (stringp preview-dvipng-command)
- (preview-dvipng-command preview-dvipng-command)
- (funcall preview-dvipng-command))))
+ "Preview-Dvi*"
+ (if (stringp preview-dvi*-command) ;; Assume it's dvipng
+ (preview-dvipng-command preview-dvi*-command)
+ (funcall preview-dvi*-command))))
+(define-obsolete-function-alias
+ #'preview-start-dvipng #'preview-start-dvi* "14.2")
(defun preview-start-dvips (&optional fast)
"Start a DviPS process.
@@ -4407,8 +4429,8 @@ If not a regular release, the date of the last change.")
image-types
preview-image-type
preview-image-creators
- preview-dvipng-image-type
- preview-dvipng-command
+ preview-dvi*-image-type
+ preview-dvi*-command
preview-pdf2dsc-command
preview-gs-command
preview-gs-options
--
2.50.1 (Apple Git-155)
--=-=-=--
Al Haji-Ali <abdo.haji.ali@HIDDEN>:bug-auctex@HIDDEN.
Full text available.bug-auctex@HIDDEN:bug#79559; Package auctex.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.