From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cOyjE2G4Y2JudwEAbAwnHQ (envelope-from ) for ; Sat, 23 Apr 2022 10:27:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oDvaEmG4Y2L3BwAAG6o9tA (envelope-from ) for ; Sat, 23 Apr 2022 10:27:13 +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 E271C4216 for ; Sat, 23 Apr 2022 10:27:12 +0200 (CEST) Received: from localhost ([::1]:59742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niB6m-0002ir-3i for larch@yhetil.org; Sat, 23 Apr 2022 04:27:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niB3y-0001N9-JI for emacs-orgmode@gnu.org; Sat, 23 Apr 2022 04:24:18 -0400 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:40683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1niB3p-00086A-Nw for emacs-orgmode@gnu.org; Sat, 23 Apr 2022 04:24:11 -0400 Received: by mail-qk1-x72b.google.com with SMTP id e128so7419588qkd.7 for ; Sat, 23 Apr 2022 01:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=omk428NvvYPJCc1ppN0AFvXHb2UqkFmnT7AIPhZaZmE=; b=RA1WU1DTYdhZKOoIFSx/9eoS2FEARkjyzguxWgSgl8NG7MG6+FQPqzXSX+vZvs9Uc7 j6W7SpaLg7VLGQnnXLkvCLF9Y0Lh7PaGn9LJWdWsbmpzHrXwtl64ip/+8JubjGfp5XFn DMj3KmZ2+MZsCDVJUAjqukyYICN5Io1ISnqYpJjwbOjHtHmbCRcIB3UfYv7/S+j8k7L/ pUK1vQry/wszGZ+EX525/2B1n2iIkJJxGgb97vZMIGRHRIoh75RA0OnyB6p0qFVNK0gh fKoCdrztKTaw4Hg9Yw28wmy4N0wDaUEU6Qg6NDZX4WxdhMSQfF3aIrk9jfaFC5w/lbnJ ++gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=omk428NvvYPJCc1ppN0AFvXHb2UqkFmnT7AIPhZaZmE=; b=1BdXh3/wGvHQFkVzAc6Ud5Hlt1iM2eacKDia/GjnacruSs0ak27NqBQhWFcV80xhzJ NxieHiE0faX77kzeR8aWIl8vqxlo6MIRKxNASOc//6rss2/bpZwZVdsopoSY117/z0BS 6BBXCjXa5V23/5pxSD/z6VVP/N+Eh+xnj7SxK6FSvsPdvSE6UlBKRCqleC+U4qy6okm+ dbldw9GYzVvqZ6Wp3oAt3aYZDhzE/0JM15TqjE8XHL8KIjYOrmAHUsMzbbgieI4Ixrop Xn1JnX4/57lsXi60pgPD7My/auURWNqccDhEY8sdiM+yDQWGgJcIYkGNFS3L8tYxS4qw ea8g== X-Gm-Message-State: AOAM5314P4JiGT5OVqOt3bzre/ToIPsBIpYjcDPac+10qWMUXMAeup3Y Sh7taMD8HyJFN4eZvM7ogJQ= X-Google-Smtp-Source: ABdhPJw8euqXDXBt2ErEuo3B13j8i4fCGrAsV+iJgdTtfTYEjeSsZ51bS3MpI6tzW8zSoYMu2XNOAg== X-Received: by 2002:a05:620a:45a9:b0:69e:d4dc:4861 with SMTP id bp41-20020a05620a45a900b0069ed4dc4861mr5021613qkb.297.1650702248647; Sat, 23 Apr 2022 01:24:08 -0700 (PDT) Received: from localhost ([66.150.196.58]) by smtp.gmail.com with ESMTPSA id y6-20020a05622a004600b002f33ba280cbsm2696588qtw.8.2022.04.23.01.24.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Apr 2022 01:24:07 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Subject: Re: [DRAFT][PATCH] org-encode-time compatibility and convenience helper In-Reply-To: <7f4ea652-7d22-fb61-f873-5e92f078c9e6@gmail.com> References: <7f4ea652-7d22-fb61-f873-5e92f078c9e6@gmail.com> Date: Sat, 23 Apr 2022 16:25:00 +0800 Message-ID: <87mtgcmckj.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=yantar92@gmail.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=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: Paul Eggert , org-mode-email 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=1650702432; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=omk428NvvYPJCc1ppN0AFvXHb2UqkFmnT7AIPhZaZmE=; b=NyYCv9w5jtQMJjWlUIcQqMcB4pfqEAHefnFckBqzZtboYBfkDhXtZER/b7X+2HFRFvOXl+ yixaNsbKHRv0Ga1PStudVPaKr0KUaLygEG/u5ZXQrVH0akLPCK4/v0XMN0JMong91mDKpz SIQgKHs+tpQhTr6J4lQbpLiaY0P90Fb4XyOVxCz8xI8v1DtmwiW+kEQqQkA4u9UckOnTSi seBq6sX92yUczoNv1pcFj+kDkiqlWDyEa6JptlBXXyHIzLR6uMc07Tf/TERrew+0jYSlWa AsTSpDnR6O0xAOrRHjAhFNElG+Lsa+V2AWphQYfVlwu8EWw1SH/R6X8fhwBITA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650702432; a=rsa-sha256; cv=none; b=ln9wx5PjFpL47iAfYoHjIi9wWW2J6xFdcasjp/Od0DHEEo2w7gKaU9kxMR1zPmTp6eJ3jG DWY4ZBC+FCQCCbtxwDZ0/+cIorT712iUsIRbMA3tnKS9OA7n3hqcaM46109FGa8NZOoGw0 xbXlrbfXlcRyi3wTqnjOyXWXsM0X5TSlFG8MlYng8MckyBDvqh8CUXd81F2Bf8SZnY4pXk G7KNCWujtaMYrdjewxohP0RvoAprKSBMin6RzvHxIuqsj+RLJIbQ7Sj11Dj5Z4ZYkuORFH qkyc+qp133l97zPNIFqL0uLMG61nCSMm8zY6+m7zhQ6/fWBx7oieTLf57pNaUQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=RA1WU1DT; 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: 6.38 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=RA1WU1DT; 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: E271C4216 X-Spam-Score: 6.38 X-Migadu-Scanner: scn0.migadu.com X-TUID: XV5u7nCbQK84 Max Nikulin writes: > I tried to create a compatibility helper that will use currently > recommended way to call `encode-time' with single list argument for > Emacs-27 and newer, but use the only available call style as separated > arguments for older Emacs versions. Thanks for this work! > From my point of view > - it should work at the compile or load time to minimize runtime > performance impact, > - since both ways to call `encode-time' are necessary (in a half of > cases a list returned by `decode-time' is available, in other cases > timestamps are assembled from scratch, none is preferred), it should be > convenient in both cases, > - it should allow Org to work even if support of multiple `encode-time' > arguments will be removed from Emacs. Agree. > My patch requires more changes since the macro is just defined but not > actually used. It does not fix the problem with "no DST" flag returned > by some function in Org. I can prepare next patches, but I think it > should be decided at first which approach should be accepted by Org Mode: > - org-encode-time accepting both list or separate arguments > - mix of `encode-time' with multiple arguments and org-encode-time-1 for > lists. This whole timezone staff is complex. I got lost in the emacs devel discussion half-way through. From point of view of API, I would prefer a single function with docstring explaining the necessary caveats. > + (if (cdr time) > + `(encode-time ,@time) > + `(apply #'encode-time ,(car time)))) Do I miss something or can you instead just do `(encode-time ,@time) without if? > + (should (string-equal > + "2022-03-24 23:30:01" > + (format-time-string > + "%F %T" > + (org-encode-time '(01 30 23 24 03 2022 nil -1 nil))))) > ... These tests will be executed using system value of TZ. I am not sure if tests are not going to break, say, in southern hemisphere or at some other bizzare values of TZ. > + ;; daylight saving time > + (let ((tz (getenv "TZ"))) > + (unwind-protect > + (progn > + (setenv "TZ" "Europe/Madrid") > + (should (string-equal > + "2022-03-31 23:30:06" > + (format-time-string > + "%F %T" > + (org-encode-time 06 30 23 31 03 2022))))) > + (setenv "TZ" tz)))) Best, Ihor