From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 EC2eJFRIz2MrAAAAbAwnHQ (envelope-from ) for ; Tue, 24 Jan 2023 03:54:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0HONJFRIz2NcKQEAauVa8A (envelope-from ) for ; Tue, 24 Jan 2023 03:54:12 +0100 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 F4144A7D4 for ; Tue, 24 Jan 2023 03:54:11 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pK9R2-0001so-Ps; Mon, 23 Jan 2023 21:53:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK9R1-0001sc-Cj for emacs-orgmode@gnu.org; Mon, 23 Jan 2023 21:53:19 -0500 Received: from mail-qt1-f173.google.com ([209.85.160.173]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK9Qz-0003rb-Nx for emacs-orgmode@gnu.org; Mon, 23 Jan 2023 21:53:18 -0500 Received: by mail-qt1-f173.google.com with SMTP id s4so12084973qtx.6 for ; Mon, 23 Jan 2023 18:53:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hdjiiMq/zSKFsGOFG8uFt0vH/Rtop6MeiXG7vJvCKdw=; b=n43Mh/hTQ0EwhhKy6iuvPzd7+ALYs5/hTOx0rlYQ0hHUFWd3FzXYnXA35TvskZeWud JBEN0M9WPKATnfGK3xp1bhzlJq//IkZ4aTJUCF6niAq52AmEzszad48xFH6/mOt62w3U 5BFy3+kA4SEFr79TVevXH09Sh7nCMoxF3EkQyypPGqjWOm2zQ2ukSExpRcH4e1KAfGXN bheuFnJX8SX+s9M37aykSnl960t/SkqwVDOxkx54dWOgbk5hE1a/rMXyfSiSnwvwXh0/ iW5rZ0CB+DuFta1P5yczJY4+3oO+qKxDobyL5ASqZ87lHasdF3tjBJ6QJ6qWxjlXzsw3 YhMw== X-Gm-Message-State: AFqh2koJ3w2ACGKcV73UV2EkBdhU3Mr0EEVECIGHsxQcyLRg42388j5v v0zG1ocHD8gwplSTEMqUeFhOd9vf2pQ= X-Google-Smtp-Source: AMrXdXu61aq3jA0Og+lZblCwvt6FVjAQ66c/Fj25In8ZvbD7oejcBcmjGXvCn0mO+iaqA5IBmtfTVw== X-Received: by 2002:ac8:4cdc:0:b0:3ae:6bed:4818 with SMTP id l28-20020ac84cdc000000b003ae6bed4818mr37451629qtv.66.1674528795638; Mon, 23 Jan 2023 18:53:15 -0800 (PST) Received: from localhost.localdomain (pool-98-113-163-150.nycmny.fios.verizon.net. [98.113.163.150]) by smtp.gmail.com with ESMTPSA id q196-20020a3743cd000000b0070736988c10sm616307qka.110.2023.01.23.18.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 18:53:15 -0800 (PST) From: "Aaron L. Zeng" To: emacs-orgmode@gnu.org Cc: "Aaron L. Zeng" Subject: [PATCH] lisp/org-agenda.el: Fix void-function string-pad in Emacs <28.1 Date: Mon, 23 Jan 2023 21:52:59 -0500 Message-Id: <20230124025259.1301063-1-me@bcc32.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.160.173; envelope-from=zeng.aaron.l@gmail.com; helo=mail-qt1-f173.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.149, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674528852; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hdjiiMq/zSKFsGOFG8uFt0vH/Rtop6MeiXG7vJvCKdw=; b=uuj0naFuv7wiX5l0u1PoHfWWw/gVy+9XIniUnv/QFn2QiLeNZzUVfuxWMYaYiTgO70j2JK JRXh7DVoeWN9O8weKhgjBEE2V8FvE5MXXZpQMBvcBkv4dMaK96162QKJjouNB9t6pDDgSu avzR5c2WL9NJtsYPeTeN0mk8Vq7BBPW0dRkyKWApU+MfllIVWy2Ktn2IdBzdodjHI2gHQn J1mKeY71DNb6hnhP9YrA8wqsPnvJfwRhM1bC1GVMAK5ecL2YfqYVpEfCtoMYlZ3g1Zcmct hZQPkJBOTyBDcU7tR+VjMo/z2XPnDQbQm18eFSUHkq4XVyRi4pe6WJqBGKf8Xw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674528852; a=rsa-sha256; cv=none; b=oGIV+ylDfniErNFGZuq7pi4HYh1G5UaQm/p70X6glYOwV3gsYUgG8YRJeJwt6Ou5BfuAZV bNjUNzudutVuKUkPdbErNzJembxixVGEGcszdTw5hIRgeLBPMycHG1NZb0O54mmnUzdUSN E30qwiunmorxs3WXwYzGuavInSXArF223JdKkxrfven4/8PRvEkaJZvpJB4WGXjkuXKlYt KfmGEdQFBgt2mNI5QaSccgxzuWB9xWz8Qa+U17gC/TZmlRwKcwXd/beT0btswflRidOfPD kOkf+/idITB/xaJ7kl0h3NFb4b/pU8SNykqc0OgyTcaxVaM/YRs8ogrsCqhk7w== Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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: 0.11 X-Spam-Score: 0.11 X-Migadu-Queue-Id: F4144A7D4 X-Migadu-Scanner: scn1.migadu.com X-TUID: F1Iyh5zw0lUn * org-compat.el (org-string-pad): Add compatibility function `org-string-pad' for `string-pad', introduced in Emacs 28.1. * org-agenda.el (org-fix-agenda-info): Use `org-string-pad' rather than `string-pad'. Since this is more-or-less just copying string-pad's definition from subr-x.el, I think this qualifies for TINYCHANGE. TINYCHANGE --- lisp/org-agenda.el | 4 ++-- lisp/org-compat.el | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 2d194ad34..4f0522086 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3474,13 +3474,13 @@ This ensures the export commands can easily use it." (when (setq tmp (plist-get props 'date)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) (let ((calendar-date-display-form - '(year "-" (string-pad month 2 ?0 'left) "-" (string-pad day 2 ?0 'left)))) + '(year "-" (org-string-pad month 2 ?0 'left) "-" (org-string-pad day 2 ?0 'left)))) (setq tmp (calendar-date-string tmp))) (setq props (plist-put props 'date tmp))) (when (setq tmp (plist-get props 'day)) (when (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) (let ((calendar-date-display-form - '(year "-" (string-pad month 2 ?0 'left) "-" (string-pad day 2 ?0 'left)))) + '(year "-" (org-string-pad month 2 ?0 'left) "-" (org-string-pad day 2 ?0 'left)))) (setq tmp (calendar-date-string tmp))) (setq props (plist-put props 'day tmp)) (setq props (plist-put props 'agenda-day tmp))) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 6c5085255..eb20d5baf 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -173,6 +173,27 @@ removed." (string-trim (replace-regexp-in-string blank " " string t t) blank blank)))) +(if (fboundp 'string-pad) + (defalias 'org-string-pad #'string-pad) + ;; From Emacs subr-x.el. + (defun org-string-pad (string length &optional padding start) + "Pad STRING to LENGTH using PADDING. +If PADDING is nil, the space character is used. If not nil, it +should be a character. + +If STRING is longer than the absolute value of LENGTH, no padding +is done. + +If START is nil (or not present), the padding is done to the end +of the string, and if non-nil, padding is done to the start of +the string." + (unless (natnump length) + (signal 'wrong-type-argument (list 'natnump length))) + (let ((pad-length (- length (length string)))) + (cond ((<= pad-length 0) string) + (start (concat (make-string pad-length (or padding ?\s)) string)) + (t (concat string (make-string pad-length (or padding ?\s)))))))) + (if (fboundp 'format-prompt) (defalias 'org-format-prompt #'format-prompt) ;; From Emacs minibuffer.el, inlining -- 2.38.1