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 eAAUCn3AbmI7nwAAbAwnHQ (envelope-from ) for ; Sun, 01 May 2022 19:16:45 +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 MOIgCX3AbmI7WgAAG6o9tA (envelope-from ) for ; Sun, 01 May 2022 19:16:45 +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 C58ADE366 for ; Sun, 1 May 2022 19:16:44 +0200 (CEST) Received: from localhost ([::1]:45426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlDBb-0007dY-42 for larch@yhetil.org; Sun, 01 May 2022 13:16:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlDAJ-0007dA-Tv for emacs-orgmode@gnu.org; Sun, 01 May 2022 13:15:26 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:45590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlDAI-0001cy-C5 for emacs-orgmode@gnu.org; Sun, 01 May 2022 13:15:23 -0400 Received: by mail-lf1-x131.google.com with SMTP id p10so21891950lfa.12 for ; Sun, 01 May 2022 10:15:21 -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=TFbigjrsNWr/BE84VWvf/gtBnvU3HB0CjOn53uuyZDY=; b=eY6MZ3Odi9s5EmufUScWs84G1y7CsZpOo9rTdbd0fctgfDY0rxqszGEhbEk+GIFsC4 t/McsCFSlX3tuj4HBiSutu63yyNrtlYttijjcFJF9JWMVIyv8IIO/PmTXpzBc5+C5+sN 1DwzsX0k5zTgEXhqcD5sSG56k50GPjjh1yBrDppnWEqL+4HRuMop9Czb9ROQYuiBGb8F m9CAPLsTN5s6rXWwou/iPwRdcrD2ZPZEjR8CcWRmkuxAlOJX7m3N33dQySPs34qwTjqz bb98nQdjpEJPSc37ar9YEpuvkZrjingsgoEItizebQAaHqDS+lB+i7pq32Qco8p8jnF0 rA1g== 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=TFbigjrsNWr/BE84VWvf/gtBnvU3HB0CjOn53uuyZDY=; b=gEJu68F8jbhNssAh1nTFyYsQSSQHt3I504VZM8DZrAaGOl5q0T47vUzkAoAmwbGwKW eeRjIzhARzU3EWvnNOjpsWjvjIyJ5QeUkZSyM/e5r6IYWF6TGpROq1a2GHX/XOE6Es6i ylXiZzeaB2B1b2ow4Vl2+rB3iiAQ2BIWpvQhG3RAmdED+es5E6niSZj1w9f4nwBNwHm4 Gj9QFR+/rmTgH27GNg7XXSGTzmQA3AY7dkAs4Pfhkj94gaPKR2qfsul9qj9knJTSyHRG /nPuCZ+vf/tiQ3LvMqzKCIVj+PhkpstHk7xZEfl5czyRessx3yWdXJWOwFwZRDTSES/K y32w== X-Gm-Message-State: AOAM5304y5wmfGmPUmd1ljw7VHrdJ9hEvomcTlc3Oi6fWqmC4uQy9NQ8 +EI9grah8VZnD2gqAchBoGc= X-Google-Smtp-Source: ABdhPJz8GcZjx4APQrgNYRsv+OoxOm2op3nw4HRl39dvhPBcPuS+Uk4VfhCgG8PiLw9uIH3XWfsnGg== X-Received: by 2002:ac2:5ecc:0:b0:472:3c01:9a2e with SMTP id d12-20020ac25ecc000000b004723c019a2emr6427298lfq.245.1651425319529; Sun, 01 May 2022 10:15:19 -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 n3-20020ac24903000000b0047255d2119asm484758lfi.201.2022.05.01.10.15.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 May 2022 10:15:18 -0700 (PDT) Message-ID: <3bad9506-40ef-9cd7-6f2c-5e3921d4c98c@gmail.com> Date: Mon, 2 May 2022 00:15:17 +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: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones Content-Language: en-US To: Paul Eggert References: <5ed963b2-3fa8-48d8-627e-bc0571d15b43@gmail.com> <149de00f-115b-5367-414f-c7700ef8966b@cs.ucla.edu> <2dd15844-01b3-0144-740c-185ec8488a81@cs.ucla.edu> <4a23f3a4-fe8f-d396-49d8-10034803be63@gmail.com> <52fb10fb-892a-f273-3be8-28793f27e204@cs.ucla.edu> <5cd820d4-ae67-43d4-9e63-c284d51ff1e4@gmail.com> <25d90a4b-f47d-01b4-2bfe-9951e97fe676@gmail.com> <355c422f-6945-e670-4610-70e67035e193@gmail.com> <4bd57f21-0660-fce0-d796-08c534402340@cs.ucla.edu> <42fc4072-4f8f-c6d3-ca39-2308f4597523@cs.ucla.edu> <3c017c45-c82a-cb0e-6352-fabb21e7ac37@gmail.com> <7ba6b2ae-bbf6-4e90-169b-78ae6916e0b1@cs.ucla.edu> From: Max Nikulin In-Reply-To: <7ba6b2ae-bbf6-4e90-169b-78ae6916e0b1@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=manikulin@gmail.com; helo=mail-lf1-x131.google.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 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_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: orgmode , 54764@debbugs.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=1651425405; 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=TFbigjrsNWr/BE84VWvf/gtBnvU3HB0CjOn53uuyZDY=; b=CLfOypdYB4jHiZxbr6y/8ZuqrirqrvNlMR0Yj4yVeY8r/6narkwuEwnmOixu2eOXvmNmWV fy1WpkzTZZZ6GRpmkfCHC2DX6eUkASenAqOkwgxKVrnoM/9/ZYfwu6cTsovkXPD4xkSDN9 LNQcxyBC04tz5W0EUgwlDu3jVbaXmLLCdaP6r+m9sLXBCHMeXRadTqPLceXbGxFgq2ATKk Kcjcq6p3tWvfdn3tJLVZEBheEOYj4hYpzwkeIVe2yWHRM5/Sve6K7R5ZyO7Cum9Q2wU5VH O3E7T7PHu8YgRZKEj1OMqxhfiNpIsmyZplIz7xASl/IxDCCBlwVecWGquwXKZA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651425405; a=rsa-sha256; cv=none; b=HjMZd+CDhqFBPL/UQslMUJEY74JVMW3FnfcWnzZpuQRCqlJ0jT6/Heew7HIOuF2zSYDAOM y4Ea0BYSR7BY7mGDZYiCUBpqUb4vqQmLrvwiad/5avyTlHSBGFWQohS7dAM+DGJgFxnr/z yeSikq/mehqQiFy9wksmg07uf/cYspR9zb+WR/uZmmQhS16cbqhoTnh3IUS9nAqkrhlHz6 2CUdN+wiATmKLfkrB7CGNGKxClweO3EYqHvZCfGmjksn4c/GSU23tO3AcKsgrdC8vLMAnT VG6pyX01bidzIpDYj6lDCQJsXiS1SEtNPZ1KEQcZsZlQtg1VPpYne7sT9HQICg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=eY6MZ3Od; 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.21 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=eY6MZ3Od; 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: C58ADE366 X-Spam-Score: 6.21 X-Migadu-Scanner: scn1.migadu.com X-TUID: lFvn4yycZsAc On 01/05/2022 09:32, Paul Eggert wrote: > On 4/30/22 04:22, Max Nikulin wrote: >> >> I posted a corrected version of my `org-encode-time' macro, but I did >> not add you to Cc (I sent reply through news.gmane.io), and it has no >> special case to check whether `encode-time' supports 6 elements list >> argument: > As I understand it, org-encode-time is intended to be a compatibility > function like org-newline-and-indent and org-string-distance. Those are > in org-compat.el, so I assumed org-encode-time would be there too. Maybe you are right. I believe that it should do a bit more than just ensure compatibility. An additional goal is to avoid pitfall with list vs. separate arguments result discrepancy: (format-time-string "%F %T %z %Z" (encode-time 0 30 23 31 3 2022 nil nil "Europe/Madrid") "Europe/Madrid") "2022-03-31 23:30:00 +0200 CEST" (format-time-string "%F %T %z %Z" (encode-time '(0 30 23 31 3 2022 nil nil "Europe/Madrid")) "Europe/Madrid") "2022-04-01 00:30:00 +0200 CEST" > Also, if the intent is to emulate Emacs 29 encode-time, can't we do > something like the attached instead? The idea is to implement Emacs 29 > encode-time both on pre-29 Emacs (that don't support lists of length 6) > and post-29 Emacs (which might drop support for the obsolescent form). > +(if (ignore-errors (encode-time '(0 0 0 1 1 1971))) > + (if (ignore-errors (encode-time 0 0 0 1 1 1971)) > + (defalias 'org-encode-time #'encode-time) > + (defun org-encode-time (time &rest args) > + (encode-time (if args (cons time args) time)))) > + (defun org-encode-time (time &rest args) > + (if args > + (apply #'encode-time time args) > + (apply #'encode-time time)))) 1. I would prefer macro since it works at compile or load time, so runtime impact is minimal. 2. Your variant may be fixed, but currently I do not like behavior for Emacs-27. Compare encode-time and org-encode-time with new calling style: (format-time-string "%F %T %z %Z" (encode-time '(0 30 23 31 3 2022 nil nil "Europe/Madrid")) "Europe/Madrid") "2022-04-01 00:30:00 +0200 CEST" (format-time-string "%F %T %z %Z" (org-encode-time '(0 30 23 31 3 2022 nil nil "Europe/Madrid")) "Europe/Madrid") "2022-03-31 23:30:00 +0200 CEST"