From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0HdkCKUdBGKx8gAAgWs5BA (envelope-from ) for ; Wed, 09 Feb 2022 21:01:41 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id yLDHBaUdBGINQAEA9RJhRA (envelope-from ) for ; Wed, 09 Feb 2022 21:01:41 +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 A83713766E for ; Wed, 9 Feb 2022 21:01:35 +0100 (CET) Received: from localhost ([::1]:38622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHt9i-0004JY-4e for larch@yhetil.org; Wed, 09 Feb 2022 15:01:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHsQ8-0004jJ-02 for emacs-orgmode@gnu.org; Wed, 09 Feb 2022 14:14:28 -0500 Received: from [2a00:1450:4864:20::62f] (port=44734 helo=mail-ej1-x62f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHsQ6-0002Ei-Em for emacs-orgmode@gnu.org; Wed, 09 Feb 2022 14:14:27 -0500 Received: by mail-ej1-x62f.google.com with SMTP id ka4so10030833ejc.11 for ; Wed, 09 Feb 2022 11:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0Xuc4fEdMaOrpNij+Bn22MU+8t9x1kpeXD28ke4SWuk=; b=YxL/ueojX8dt/s0T17xle8oPyw1wrm49JpgYjd4HEbwHY2VvF5BcHjazXirgJY6XQo 7+1amnV962eX/R/zT7msQkHnBu8rRFavoLx6XFNt43DF9UGWMYAAA8lluOO0ou2DsVhX oeQ8Vxb4r3bg8/RXklg9zCeHgv8nf2sfOgq4v4fmczfKQnK7HD5FsBEyU+6/pUFMeqoi A3HqyV3BDerVZRrRWRbNLIud3Tkc5ntdfteSOJRX7aYinZclXnQlKwJ2NFmVwHdw7w6A jdaJxUUTUy25LUy9lPfXuf20Wh3WKcXvp55+svlG9aqTUFvum6dHTcXyR5hfLKrN/qgw 8/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0Xuc4fEdMaOrpNij+Bn22MU+8t9x1kpeXD28ke4SWuk=; b=6XpC3GRfmUkVdAgVB+wO+UWzA3dQdATQCk8pWb4G6EgaZJfyrK+C/FUmITZcLKcyzx I80TGBNio2KRQtczZqLtgolTUvQOmBIGv2PBj9POEDgNh/EBtqeM9I4h4jMxqZuMINjG knAqmfbcO7bpVfZLy/06KaJlyhiEo3Ni4+2b2JKs78dcSGXREvFGXTxluIF6jENBENP9 zbNLhGxu0q4/DYMjpXf8Rj1QYOf/aiDaMwYz63G9c/L9jF2UeyXqnmtF9zWVHEKPiX8I yEsiM+OW7hwtbXZOp3Drb00AK+ux0El8qodESs1dzRwoVuSfCAVnVjTrq/8MS88vAa3G Tgug== X-Gm-Message-State: AOAM533gGktR1gallTBhqzpiQnxWgsYg06+gSGbbO5VUHclX8bt1RcOp UcyyjPOFRdUgQG4FXyzj75MII+yLKQuFza5CYQA= X-Google-Smtp-Source: ABdhPJx92FBnr3N4+aqco/O6myZ/gIqKKWp3jiZQfx8zinB/1E+F9A5gUo6nHWwr4koi9zPpSpW+QZazOxdi1N+oHVA= X-Received: by 2002:a17:906:4f11:: with SMTP id t17mr3368195eju.655.1644434064048; Wed, 09 Feb 2022 11:14:24 -0800 (PST) MIME-Version: 1.0 References: <87v8xsuywx.fsf@localhost> In-Reply-To: <87v8xsuywx.fsf@localhost> From: Samim Pezeshki Date: Wed, 9 Feb 2022 22:44:11 +0330 Message-ID: Subject: Re: [PATCH] org-agenda: Skip formatting if format string is "" To: Ihor Radchenko Content-Type: multipart/mixed; boundary="0000000000003e9db605d79aa467" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::62f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=p.samim@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, 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: emacs-orgmode@gnu.org, Nicolas Goaziou Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644436895; 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=PVTFWSd3tFxX9FYChGzVNq1B+vFCLURnFbknIA6RAr4=; b=jdia1KMaj9F3pKx970a/Sotlq1/dzT2ScVgq/NABuzZxEK9i0FWd+YqcGKNMaIOBvah/rB hFHv2R6HwqS7zXXjOrh4wYFRHzSXO4ezYsQ61gqrHy+C3JX0E2H/+8NsChTncmun6S4p0n h5VWQzVfiV2UZwxhTuUiCfoq6oz7e2YR5S08irfe56R0Ow3fe8yb2djAiQ9FnGbfFoH/ce dgsKOiC3Qrarx2iVr4LxRJgXNvUnUfevGiki6y147nK7IHBJUHSdvZRyZUTZ3MNwDqxhka wdbsXRmvMZ92wuGHW4zK9Xnqpxy7nODF87Ca9Dlx+pOKsJiJa+3zh1i/bMrvzw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644436895; a=rsa-sha256; cv=none; b=jAYa8HkB6vlp7rQNybzPk9VqmHyijmmq85ce+rEarIa/fQ6LhyqhYecIxfL1rEIpFMulp5 nxwYtM0n2pNYkY8dU38sRkd5gv9u12J10Xwmg/XUmEcbETCjaXjHf1UPcoqfsHWW4Jgqbm oPNjbJAYfz+VkJD4rRKb3KtzEaOfSyf+yVfqg13fHUk/SYcp/g3/xkW7fFjGV10KyRYI4v WUEM1TZxTXNJsx3aYFhjwEcfj4eHmBKRgKVEicI9ICyWtF6W0LKfjV/r52nYWy5akyPo+U 0fTwCGiFKjq/n9Y1Q2F9i+uzm+WISRzOP4uNthnnjb65lkobfXWFNhZf/Z3FPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="YxL/ueoj"; 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: -2.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="YxL/ueoj"; 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: A83713766E X-Spam-Score: -2.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: LQoEthXNZX/x --0000000000003e9db605d79aa467 Content-Type: multipart/alternative; boundary="0000000000003e9db405d79aa465" --0000000000003e9db405d79aa465 Content-Type: text/plain; charset="UTF-8" Thanks Ihor for the detailed explanation, I updated the patch as you suggested. On Sun, Feb 6, 2022 at 12:53 PM Ihor Radchenko wrote: > Samim Pezeshki writes: > > > This commit prevents having extra spaces when the TODO format string is > an > > empty string (""). It was not working properly, with this patch now it > > works correctly. > > Thanks for the patch! > > > (concat > > (substring x 0 (match-end 1)) > > ... > > + (unless (string= org-agenda-todo-keyword-format "") > > + (format org-agenda-todo-keyword-format > > + (match-string 2 x)) > > + ;; Remove `display' property as the icon could leak > > + ;; on the white space. > > + (org-add-props " " (org-plist-delete (text-properties-at 0 x) > > + 'display))) > > (substring x (match-end 3))))))) > > x))) > > Your patch will unconditionally hide todo keywords in agenda even when > org-agenda-todo-keyword-format is not empty. This will happen because > (unless ...) form will only return the last " ", but never the keyword. > > You should better wrap the (org-add-props ...) with another unless > condition. > > Best, > Ihor > --0000000000003e9db405d79aa465 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Ihor for the detailed expla= nation,
I updated the patch as you suggested.<= /div>

On Sun, Feb 6, 2022 at 12:53 PM Ihor Radchenko <yantar92@gmail.com> wrote:
Samim Pezeshki <p.samim@gmail.com> writes:

> This commit prevents having extra spaces when the TODO format string i= s an
> empty string ("").=C2=A0 It was not working properly, with t= his patch now it
> works correctly.

Thanks for the patch!

>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(concat >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (substri= ng x 0 (match-end 1))
> ...
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (string=3D org-agenda-todo-keyword= -format "")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(format org-agenda-todo-keyword-for= mat
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(match-string 2 x))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Remove `display' property as= the icon could leak
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; on the white space.
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-add-props " " (org-p= list-delete (text-properties-at 0 x)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 'display)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(substring x (match-end 3)))))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 x)))

Your patch will unconditionally hide todo keywords in agenda even when
org-agenda-todo-keyword-format is not empty. This will happen because
(unless ...) form will only return the last " ", but never the ke= yword.

You should better wrap the (org-add-props ...) with another unless
condition.

Best,
Ihor
--0000000000003e9db405d79aa465-- --0000000000003e9db605d79aa467 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-lisp-org-agenda.el-Fix-bug-in-org-agenda-highlight-t.patch" Content-Disposition: attachment; filename="0001-lisp-org-agenda.el-Fix-bug-in-org-agenda-highlight-t.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kzfxk46a0 RnJvbSAyZTkwY2FjMzNjMjJjZjhlYTA5ZjdmMDJlNjQ0ZGY5ODNiN2NhMGQxIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBTYW1pbSBQZXplc2hraSA8cHNhbWltQGdtYWlsLmNvbT4KRGF0 ZTogU2F0LCA1IEZlYiAyMDIyIDIwOjExOjE5ICswMzMwClN1YmplY3Q6IFtQQVRDSF0gbGlzcC9v cmctYWdlbmRhLmVsOiBGaXggYnVnIGluIGBvcmctYWdlbmRhLWhpZ2hsaWdodC10b2RvJwoKKiBs aXNwL29yZy1hZ2VuZGEuZWwgKG9yZy1hZ2VuZGEtaGlnaGxpZ2h0LXRvZG8pOiBTa2lwIGZvcm1h dHRpbmcKdGhlIHRvLWRvIGtleXdvcmQgd2hlbiBgb3JnLWFnZW5kYS10b2RvLWtleXdvcmQtZm9y bWF0JyBpcyB0aGUKZW1wdHkgc3RyaW5nLgoKVElOWUNIQU5HRQotLS0KIGxpc3Avb3JnLWFnZW5k YS5lbCB8IDE3ICsrKysrKysrKy0tLS0tLS0tCiAxIGZpbGUgY2hhbmdlZCwgOSBpbnNlcnRpb25z KCspLCA4IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWFnZW5kYS5lbCBiL2xp c3Avb3JnLWFnZW5kYS5lbAppbmRleCA5YmM0NGE1NmUuLjNiNjM5N2IyNSAxMDA2NDQKLS0tIGEv bGlzcC9vcmctYWdlbmRhLmVsCisrKyBiL2xpc3Avb3JnLWFnZW5kYS5lbApAQCAtNzYzNCwxNCAr NzYzNCwxNSBAQCBUaGUgb3B0aW9uYWwgYXJndW1l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0ZSBzcGFjZS4KKyAgICAgICAgIChvcmctYWRkLXByb3BzICIgIiAob3JnLXBsaXN0LWRlbGV0 ZSAodGV4dC1wcm9wZXJ0aWVzLWF0IDAgeCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAnZGlzcGxheSkpKQorICAgICAgIChzdWJzdHJpbmcgeCAobWF0Y2gt ZW5kIDMpKSkpKSkpCiAgICAgICB4KSkpCiAKIChkZWZzdWJzdCBvcmctY21wLXZhbHVlcyAoYSBi IHByb3BlcnR5KQotLSAKMi4zNS4xCgo= --0000000000003e9db605d79aa467--