emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-agenda: Skip formatting if format string is ""
@ 2021-05-08 15:55 Samim Pezeshki
  2021-05-15  8:12 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Samim Pezeshki @ 2021-05-08 15:55 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi!

This is my first patch.

The patch skips formatting TODO item in org-agenda when the format string
is "".
When the format string was "" the extra space would still be inserted which
was not needed when there is no TODO keyword.

Thanks,
Samim

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

[-- Attachment #2: 0001-org-agenda-Skip-formatting-if-format-string-is.patch --]
[-- Type: text/x-patch, Size: 1331 bytes --]

From dc3ba301219622bc7d324901a5f277024f8b55cc Mon Sep 17 00:00:00 2001
From: Samim Pezeshki <psamim@gmail.com>
Date: Sat, 8 May 2021 20:09:16 +0430
Subject: [PATCH] org-agenda: Skip formatting if format string is ""

When the format string was "" the extra space would still be inserted
which was not needed when there is no TODO keyword.
---
 lisp/org-agenda.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 85e201086..32ed19afc 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7147,12 +7147,13 @@ The optional argument TYPE tells the agenda type."
 	    (setq x
 		  (concat
 		   (substring x 0 (match-end 1))
-		   (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))
+       (when (not (eq 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.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] org-agenda: Skip formatting if format string is ""
  2021-05-08 15:55 [PATCH] org-agenda: Skip formatting if format string is "" Samim Pezeshki
@ 2021-05-15  8:12 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2021-05-15  8:12 UTC (permalink / raw)
  To: Samim Pezeshki; +Cc: emacs-orgmode

Hi Samim,

Samim Pezeshki <p.samim@gmail.com> writes:

> This is my first patch.

Thank you!

> The patch skips formatting TODO item in org-agenda when the format
> string is "". 
> When the format string was "" the extra space would still be inserted
> which was not needed when there is no TODO keyword.

Applied in the maint branch as 06c064e97 with some minor modifications
and a proper changelog entry in the commit message.

See https://orgmode.org/worg/org-contribute.html#commit-messages

Thanks,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-15  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 15:55 [PATCH] org-agenda: Skip formatting if format string is "" Samim Pezeshki
2021-05-15  8:12 ` Bastien

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).