emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samim Pezeshki <p.samim@gmail.com>
To: emacs-orgmode@gnu.org, Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: [PATCH] org-agenda: Skip formatting if format string is ""
Date: Sat, 5 Feb 2022 20:32:21 +0330	[thread overview]
Message-ID: <CAJAdVc0GpUnv=+rpz4f8FWMXsonpC+H2j8uXZHNKUHBfPRst_w@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 503 bytes --]

Hi!

I had contributed a patch which was merged at
commit 90a9ee17410a4b6663f5957c653258e9f9418d7d .

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.

Attached is the screenshot of the bug, you see there is an extra space in
the place of the TODO keyword. The third heading (Meditate) has a TODO
keyword, and the org-agenda-todo-keyword-format is set to an empty string.


Thanks,
Samim

[-- Attachment #1.2: Type: text/html, Size: 1659 bytes --]

[-- Attachment #2: 0001-lisp-org-agenda.el-Fix-bug-in-org-agenda-highlight-t.patch --]
[-- Type: text/x-patch, Size: 1599 bytes --]

From 7e49286c49ab342f91504205fc72ac6a8d095a1f Mon Sep 17 00:00:00 2001
From: Samim Pezeshki <psamim@gmail.com>
Date: Sat, 5 Feb 2022 20:11:19 +0330
Subject: [PATCH] lisp/org-agenda.el: Fix bug in `org-agenda-highlight-todo'

* lisp/org-agenda.el (org-agenda-highlight-todo): Skip formatting
the to-do keyword when `org-agenda-todo-keyword-format' is the
empty string.

TINYCHANGE
---
 lisp/org-agenda.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9bc44a56e..fea0675e7 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7634,13 +7634,13 @@ The optional argument TYPE tells the agenda type."
 	    (setq x
 		  (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))
+       (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)))
 
-- 
2.35.1


[-- Attachment #3: 2022-02-05_20-29.png --]
[-- Type: image/png, Size: 6263 bytes --]

             reply	other threads:[~2022-02-05 17:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 17:02 Samim Pezeshki [this message]
2022-02-06  9:28 ` [PATCH] org-agenda: Skip formatting if format string is "" Ihor Radchenko
2022-02-09 19:14   ` Samim Pezeshki
2022-03-15 18:35     ` Samim Pezeshki
2022-03-21  7:34       ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2021-05-08 15:55 Samim Pezeshki
2021-05-15  8:12 ` Bastien

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='CAJAdVc0GpUnv=+rpz4f8FWMXsonpC+H2j8uXZHNKUHBfPRst_w@mail.gmail.com' \
    --to=p.samim@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).