From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8BX2Os9SfmJRxQAAbAwnHQ (envelope-from ) for ; Fri, 13 May 2022 14:45:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id gFAYOs9SfmLOyAAAG6o9tA (envelope-from ) for ; Fri, 13 May 2022 14:45: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 88E61399DE for ; Fri, 13 May 2022 14:45:03 +0200 (CEST) Received: from localhost ([::1]:44076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npUfG-0003zt-Av for larch@yhetil.org; Fri, 13 May 2022 08:45:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npUPG-00029B-N5 for emacs-orgmode@gnu.org; Fri, 13 May 2022 08:28:31 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:39794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npUPF-0007BN-4g for emacs-orgmode@gnu.org; Fri, 13 May 2022 08:28:30 -0400 Received: by mail-lj1-x22f.google.com with SMTP id t25so10105170ljd.6 for ; Fri, 13 May 2022 05:28:27 -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=5/IV+OmY/lOIx77QtdtHR+NtPQFbfZZ16xlQ6NnthzQ=; b=WwR7ySTGviSghIr1jUt73yFmDx/SDWZ29Ny4Uebazlasuff4iJbzB7J3wY7CHfFjjn +vYhdZz03+0IDFlc9C2xD5CqAwBOjPkmNtW0ZC+/T8ywD00HKoiye5aBneUKbMVX9t7c fjsklTCFoqe4TUOAfbmbFz6BL8bqjgz7wmA/0tr8mqOqM5oJbVxpKebQLoEDk0bWNOqY vGuOSJ9/K9sqkt3iGl56Z4yrX2rpUnmXhHSuC/++TmHBtJUIhk818srg6HvaygWzJhIP zs9Mv/OfLBAG7f59WnvzBpIoujCFPLVo4JutA05IHcQoXZijmTkVjJrXmbE1hrZRnU2J USCg== 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=5/IV+OmY/lOIx77QtdtHR+NtPQFbfZZ16xlQ6NnthzQ=; b=iBuFdsfFpV8AHBnhC97PZcAb001RfJQy/ryfzfnWeFPh+8xQC8XGdRo+YCOOutuak1 ic4nbxVUXLZPPhGNndDMvWIjl4bgZAOGbTsBUP74PB/9tsCKta9fecxL+irN0vRkApqz 87x3Nj7SJua7GpjfjNEyJ0oKqwJqMy6gr74KM7kNlVLZWdworp2+k/LQdotYG9BGvJmx gtA35C7SNsZz55iI1d1MT+DSC7qHC0wTZqCYpKD+6Ofx4z8DRuJU9a8W8kkMsFSu1B7c U5hSSwD9JwgbQt+LeUCqLPfso/gS/olzoy6UORCj/KJjiq5Gks8JQMGmE9WBrJ5z6JX0 MPtQ== X-Gm-Message-State: AOAM533YAG0BKtgMJks0/GCg/WzzONmGxYlkyd+B/9mHeKuPrmvju+pa dUY2Gc982Ipk2HgsHm8uHto= X-Google-Smtp-Source: ABdhPJwMDM3MWZ3kv86A8jl6nrzF2f/pFP2mIJZF+pjjhKgc2nSv5QPcAiuJJFHgdc1G1XAAE6QgwQ== X-Received: by 2002:a2e:5149:0:b0:24f:1a3b:b774 with SMTP id b9-20020a2e5149000000b0024f1a3bb774mr2995118lje.279.1652444905688; Fri, 13 May 2022 05:28:25 -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 a1-20020a056512374100b0047255d210dcsm366894lfs.11.2022.05.13.05.28.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 May 2022 05:28:25 -0700 (PDT) Message-ID: <4518ff60-3d55-8727-e948-fc6131245931@gmail.com> Date: Fri, 13 May 2022 19:28:16 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] org-macs.el: Do not compare wall time and file modification time Content-Language: en-US To: Paul Eggert Cc: emacs-orgmode References: <106f5128-680b-f25e-1316-f7308c49b625@gmail.com> <439411c0-7dae-9dfd-373a-c3779469003f@gmail.com> <2db7387c-4cbc-a7d2-9fa0-74f4d62d8a59@gmail.com> <0fbf0584-5565-7f6d-c889-43158143f292@gmail.com> <1b78bf4b-386a-b240-2f2f-585064ce3ba4@cs.ucla.edu> From: Max Nikulin In-Reply-To: <1b78bf4b-386a-b240-2f2f-585064ce3ba4@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=manikulin@gmail.com; helo=mail-lj1-x22f.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: , 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=1652445903; 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=5/IV+OmY/lOIx77QtdtHR+NtPQFbfZZ16xlQ6NnthzQ=; b=gOpFa3IY4lJEizryppsZsFZEZWX+G2ekC27thElzwtl2Nidtpo7/RxrDz681pOaY8Vbt1m MVYps9JAQs2Hy2ouEgZzQwiAp/5IC0b36Uk2FlUTkdqYtKyLvba/C8C/B6xRNvSVy+Hx32 JBBflXqFDDb3+RZ39XLNdiKP2xs7i7Uv2+3Ah1i5E+Pa1Gv6AIwuEUhF4brHtGOC21u64/ kMkRLKE79OYqbnUTCwSe0G1Jz8ZLQPENOZGb1y0vpW3Edf+MBpd1tVjXp5bff3E9MtL+Eu ikDCYNjES67eChH4AJIBXNsuLgKqDatvbrvbNtHgTy9Q3UQtRRaZ5jN4mzV+EA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652445903; a=rsa-sha256; cv=none; b=NvDRXOqhF9jyPkHkqPhT9SzN8b01H4J4wYIpkq9asPuvWEo1t7ny1WjfTC4+0HprbEYrVS OtxblmPN+JlepA7zLejZo+AxSxDootutRym2/W/WQXG7w8Bb+Vmo1sQmbWGDtkjU/U5gp9 lsulPgcBN4c0svEy5LVGvEKaGH6/l3sAb5KZkv9ydrAiT3jr8mbDSBD142QlndL8HRX5Pv KNnS20L5OBJiNkEEkKoCHlhXCSadaxdvhGWBGGRlHWwWQlQVfCU6qZOnvh9hLZKHNPM1yM JZad5yNlXoJcMG7/VJmnA+OUVMI6b5YQ98yzS9+t6++FkxLJw/ND884qDNyfWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=WwR7ySTG; 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: 5.08 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=WwR7ySTG; 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: 88E61399DE X-Spam-Score: 5.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: XeSXfDxjnMGc On 13/05/2022 05:52, Paul Eggert wrote: > On 5/12/22 09:55, Max Nikulin wrote: > >> +    (unless (file-exists-p file) >> +      (error "File to tangle does not exist: %s" file)) >> +    (when (file-newer-than-file-p file tangled-file) >>        (org-babel-tangle-file file ... > > file-newer-than-file-p succeeds only if FILE exists, so in that case > it'd be a bit more efficient to avoid testing FILE's existence again, e.g.: > >    (cond >      ((file-newer-than-file-p file tangled-file) >       (org-bable-tangle-file file ...)) >      ((not (file-exists-p file)) >       (error "File to tangle does not exist: %s" file))) My opinion is that performance improvement is negligible while negative impact related to code readability is noticeable. Maybe it is just because elisp is not my favorite language. Feel free to commit your variant though, I will not object, but I am not going to update my patch in this way as well. P.S. Since I believe it should be fixed in the bugfix branch, I tried to keep changes as minimal as possible. I am not sure which kind of code I would prefer to see. I do not like `cond' with 2 branches. Even nested ifs are a bit better while still to "heavy" (if (not (file-newer-than-file-p file tangled-file)) (unless (file-exists-p file) (error ...)) (org-babel-tangle-file ...)) ; intentionally put below to the else branch Maybe I would prefer something like file-target-is-up-to-date-p predicate that returns nil if target does not exist. For some reason `org-babel-tangle-file' silently ignores missed file neither signalling a error nor returning a special value. Delegating error handling to `org-babel-tangle-file' would allow to get consistent error messages. In the previous version of the patch (with inline implementation of file modification time comparison) the suggested optimization was quite natural, with `file-newer-than-file-p' it is trade off with code readability.