From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mxZSBDsWbWIcFgEAbAwnHQ (envelope-from ) for ; Sat, 30 Apr 2022 12:58:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id WLxrAjsWbWI3xAAAG6o9tA (envelope-from ) for ; Sat, 30 Apr 2022 12:58:03 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 94EF030CE4 for ; Sat, 30 Apr 2022 12:58:02 +0200 (CEST) Received: from localhost ([::1]:38812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkknZ-0001w3-Ph for larch@yhetil.org; Sat, 30 Apr 2022 06:58:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkkmD-0001sl-U7; Sat, 30 Apr 2022 06:56:38 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:40954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkkmC-0006XI-3p; Sat, 30 Apr 2022 06:56:37 -0400 Received: by mail-lf1-x12a.google.com with SMTP id t25so18006974lfg.7; Sat, 30 Apr 2022 03:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Tmz4EEl9k0KBorIvPyEBynQw7OyEmQ9CDPmsyS/R7wI=; b=NobbNUwGADlr5XEihDQrSMAW9VrqLLDu++9C8QU2Gmda23JXgnnulDAej2BMACeFUL Pg17UTfiUt3WQ7x8dVtDqFVVIC944qwrqYguzqwX39/cYxV9R4SDBMP1QMGS3QSMnS+y CnbCdWGENaeoG6IL7GrpJnlqbPNnISnSHlM1op1+4PdjaL8+UPYN1HKFPzObsrB4DaFG NdEuzSQP1C/RAZ95rRPMFv3QKhNXpSBfG9mp0zeG6oqZ8gql5+6OeAkQlNB8o2sfHf1P f/BiMc5DqOKrFkmdgcJdcY85tWcV5HvfDxVKYn2ZQ9UseMClK1GOH+OOyCWO3PSzgcCR Ax0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Tmz4EEl9k0KBorIvPyEBynQw7OyEmQ9CDPmsyS/R7wI=; b=E/MLWRRail+upMhTS3uxhEbDFI4rDmTsH459QHGVAc7DRONCdd9ku/FGjeNapFUfMF 7g7UUAvnoWJrUcrn0uPEw0kT3GUk6QieJPcEmRi1Jlnooh0yQO3HLgQz6U+8luROi+mk Am+Vfex+YsbPEyTjSF7Ph9XSm2Gbi6ceWkaSL2Q9JL+DoqKu+0d/9iw/As1cKsCjrSwo otioB/Yr5n4mbl/6rUcPxM0OlKQdc8uIZlV2DanWOE2uqrai86PtTh/ZGMuPxSzmLsUU ahqNIiyVd8PJnV2MFNYxLbNrdupF4aEg0LdPzhVEqZPspIdg1rZ3naTaWhgJL7MXqjnm KrXQ== X-Gm-Message-State: AOAM530HrkorjZXf+KFL1s6Q9/V/A/x89Ww30JOrF5WKML/1mi7RJoAR IAoLx1XN4jk4xUrbqkLaV/c= X-Google-Smtp-Source: ABdhPJz1mLUblV7rEJ9F2fh8487wO7TGQgp9SN5pFmZtxAD9Hp7idsOhcNTqg/cMJ0eriKAoGPew+g== X-Received: by 2002:a05:6512:1328:b0:445:cefe:f8b7 with SMTP id x40-20020a056512132800b00445cefef8b7mr2775759lfu.34.1651316193050; Sat, 30 Apr 2022 03:56:33 -0700 (PDT) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id v21-20020ac25615000000b0047255d21133sm163827lfd.98.2022.04.30.03.56.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 30 Apr 2022 03:56:32 -0700 (PDT) Message-ID: <439411c0-7dae-9dfd-373a-c3779469003f@gmail.com> Date: Sat, 30 Apr 2022 17:56:31 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: master 4a1f69ebca 2/2: Use (TICKS . HZ) for current-time etc. Content-Language: en-US To: Paul Eggert References: <106f5128-680b-f25e-1316-f7308c49b625@gmail.com> From: Max Nikulin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=manikulin@gmail.com; helo=mail-lf1-x12a.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, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode , emacs-devel@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651316282; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Tmz4EEl9k0KBorIvPyEBynQw7OyEmQ9CDPmsyS/R7wI=; b=FULC6KLu1ljnF9aN1MVmRZlIGcnHFiY2SJSBGdFqGQ3acncKG0kJRBc6dvLjzgqKP0Z/L2 G7sBsHmhcmZ8hxxlI/Hl4Syn1dhOuzb3TEzB98GEXtYpLVYjbzUqNOcKUOAJGQX/8q1nlI jFzjVZPp9bQI/x7XjxeA5W2HAysw/z6CBNndZ70VKQgqaDxCxVGcHvh07rm+CIgCtfU9Qp 6BorrNfWl7x76WPIzAcZ7NwkLYtSLKHyXaUPoW8Px+FkPwwt00gbTKNKaB3wmuU7KpCJLo boVMO9wrdP3V5KCPVxTEOA+R0HtBlut6kz1nqNlZu3Esyj+NaXvUgYRkJJ7dxQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651316282; a=rsa-sha256; cv=none; b=r0ek/qetNPx+oerMAxXrlNdFUcbKZ2x+oQjpqc56OnwG2+a3k/d/oEgMqtWE/er9Ad9D+I wAA+LfSZc+lyXpiWP139yKyw+WaNe9CnQz6wJxrThR/s2Iy6KaMUEQ/EEtFFDTOcNLwfo6 aG5whZqAoggdDkWRVJ0NSsMMvD8tX264+dk+6IXGoj0XICsbJGLT9B8ucmNxB2VoprW+6m k+his+O6WKJmrbRcYgL0hy5706Ya70Uy9CvrG8zAO/sjH9FTo1zYnWnncx5+gKJUrVhF+C eITuzsFaai9JIzchPKxRGwT4358t59lhRrWnfWm8wVn4XoWQ/URlitZMAlX2+Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=NobbNUwG; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 7.70 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=NobbNUwG; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 94EF030CE4 X-Spam-Score: 7.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: mU2tlFHwxmmj On 30/04/2022 01:10, Paul Eggert wrote: > On 4/29/22 07:22, Max Nikulin wrote: > >>  From my point of view, it is better to rewrite `org-compile-time' to >> treat the case when there were no file prior to the call as that the >> file has been updated without comparison of timestamps > > Yes, that sounds simpler and better. How about the attached patch? Thank you, Paul. I am glad to see that you agree with my idea. > From: Paul Eggert > Date: Fri, 29 Apr 2022 11:06:00 -0700 > Subject: [PATCH] Improve org-compile-file timestamp handling > diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el > index bb0562dde0..907043580a 100644 > --- a/lisp/org/org-macs.el > +++ b/lisp/org/org-macs.el It should be committed to the "main" branch of the Org repository as well. I am unsure if all Emacs developers have commit permission however. > @@ -260,14 +260,8 @@ org-file-newer-than-p > "Non-nil if FILE is newer than TIME. > FILE is a filename, as a string, TIME is a Lisp time value, as > returned by, e.g., `current-time'." It is not true any more, it is expected that TIME is obtained using `file-attributes'. I would consider replacing docstring with something like: Non-nil if FILE modification time is greater than or equal to TIME. TIME should be obtained from the return value of the `file-attributes' function. If TIME is nil (file did not exist) then any existing FILE is considered as a newer one. This function may give false positive for file systems with coarse timestamp resolution such as 1 second for HFS+ or 2 seconds for FAT. File timestamp and system clock may have different resolution, so attempts to compare them may give unexpected results. > - (and (file-exists-p file) > - ;; Only compare times up to whole seconds as some file-systems > - ;; (e.g. HFS+) do not retain any finer granularity. As > - ;; a consequence, make sure we return non-nil when the two > - ;; times are equal. > - (not (time-less-p (org-time-convert-to-integer > - (nth 5 (file-attributes file))) > - (org-time-convert-to-integer time))))) > + (when-let ((mtime (file-attribute-modification-time (file-attributes file)))) > + (time-less-p time mtime))) org-macs.el does not contain (require 'subr-x) thus `when-let' will cause a warning on Emacs-26. `file-attribute-modification-time' makes code clearer, but it causes some complications. Formally compatibility with Emacs-25 (e.g. ubuntu-18.04 LTS bionic) is not required for the "main" branch. Emacs sources have the "bugfix" Org branch of the stable release though. The latter still supports Emacs-25, so either the Emacs source tree and the Org bugfix branch will diverge at this point or it is safer to avoid `file-attribute-modification-time' till the next major Org release. Maybe Org maintainers and developers will correct me. Likely you already guessed from the suggested docscring that I would prefer (and mtime (not (and time (time-less-p mtime time)))) to keep existing behavior on HFS+ and to allow nil for TIME. > (defun org-compile-file (source process ext &optional err-msg log-buf spec) > "Compile a SOURCE file using PROCESS. > @@ -301,7 +295,7 @@ org-compile-file > (full-name (file-truename source)) > (out-dir (or (file-name-directory source) "./")) > (output (expand-file-name (concat base-name "." ext) out-dir)) > - (time (current-time)) > + (time (file-attribute-modification-time (file-attributes output))) > (err-msg (if (stringp err-msg) (concat ". " err-msg) ""))) > (save-window-excursion > (pcase process > @@ -320,7 +314,7 @@ org-compile-file > (_ (error "No valid command to process %S%s" source err-msg)))) > ;; Check for process failure. Output file is expected to be > ;; located in the same directory as SOURCE. > - (unless (org-file-newer-than-p output time) > + (unless (or (not time) (org-file-newer-than-p output time)) > (error (format "File %S wasn't produced%s" output err-msg))) > output)) I am considering handling of (not time) case inside `org-file-newer-than-p` as a more robust approach.