From: Ihor Radchenko <email@example.com> To: Max Nikulin <firstname.lastname@example.org> Cc: email@example.com, Paul Eggert <firstname.lastname@example.org> Subject: Re: [PATCH v4] org-encode-time compatibility and convenience helper Date: Sat, 14 May 2022 14:06:12 +0800 [thread overview] Message-ID: <87lev4bqcr.fsf@localhost> (raw) In-Reply-To: <email@example.com> Max Nikulin <firstname.lastname@example.org> writes: >>> I do not like repeating of `org-encode-time' but do not see another way >>> till Emacs-29 will become the lowest supported version. >> >> This is fine. AFAIK, other parts of time handling code is full of conds >> and pcases. > > I mean that before my patch there was single `encode-time' outside of > `pcase', I replace `list' by `org-encode-time' inside each pattern. I do not see it is a big deal. At least, readability of the code did not degrade, IMHO. >>>> + (org-encode-time >>>> + (apply #'list >>>> + (or (car time0) 0) >>>> + (+ (if (eq timestamp? 'minute) n 0) (nth 1 time0)) >>>> + (+ (if (eq timestamp? 'hour) n 0) (nth 2 time0)) >>>> + (+ (if (eq timestamp? 'day) n 0) (nth 3 time0)) >>>> + (+ (if (eq timestamp? 'month) n 0) (nth 4 time0)) >>>> + (+ (if (eq timestamp? 'year) n 0) (nth 5 time0)) >>>> + (nthcdr 6 time0)))) >>>> (when (and (memq timestamp? '(hour minute)) >>>> extra >>>> (string-match "-\\([0-9]\\):\\([0-5][0-9]\\)" extra)) > > From my point of view > > (cl-mapcar > (lambda (value part) > (if (and part (eq part timestamp?)) > (+ n value) > value)) > time0 '(second minute hour day month year nil nil nil)) > > is better than the original code, but... > > Nicolas Goaziou to emacs-orgmode. [Patch] to correctly sort the items > with emphasis marks in a list. Mon, 19 Apr 2021 18:08:17 +0200. > https://email@example.com > > >> I stay away from CL as much as possible, otherwise newcomers will have >> to learn two languages to start contributing, Elisp and CL (cl-loop, >> ewww). CL is still necessary however, as we cannot use `seq' yet. I think that Nicolas was mostly referring to things like cl-loop, which introduce a whole new piece of language concepts into Elisp. cl-mapcar is merely a convenience function. Just as any other Elisp function. It behaves without surprises within the general Elisp programming concepts. I do not see why we should not use it if it improves the code clarity. Best, Ihor
prev parent reply other threads:[~2022-05-14 6:13 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-11 15:22 [DRAFT][PATCH] " Max Nikulin 2022-04-11 17:43 ` Paul Eggert 2022-04-23 8:25 ` Ihor Radchenko 2022-04-23 19:37 ` Paul Eggert 2022-04-24 3:35 ` Ihor Radchenko 2022-04-24 11:34 ` [DRAFT][PATCH v2] " Max Nikulin 2022-04-26 9:07 ` Ihor Radchenko 2022-05-03 12:14 ` [PATCH v3] " Max Nikulin 2022-05-04 9:56 ` Ihor Radchenko 2022-05-04 16:49 ` Max Nikulin 2022-05-05 15:22 ` [PATCH v4] " Max Nikulin 2022-05-07 4:46 ` Ihor Radchenko 2022-05-10 14:31 ` Max Nikulin 2022-05-11 13:20 ` Ihor Radchenko 2022-05-13 15:14 ` Max Nikulin 2022-05-14 6:06 ` Ihor Radchenko [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87lev4bqcr.fsf@localhost \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH v4] org-encode-time compatibility and convenience helper' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).