emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Nicer fontification for org-todo-list
@ 2012-11-02 17:47 Ingo Lohmar
  2012-11-02 17:50 ` Ingo Lohmar
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Lohmar @ 2012-11-02 17:47 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

recently I was bothered by a very minor thing in my custom agenda:
the headline showing the keywords is always using the "warning" face
for the selected keyword(s), instead of the proper faces used to
display to them everywhere else.  Attached is a patch that changes
this that should work under all conditions as far as I can see (and
tested).  Do you think this is useful?  I feel it is the right thing
(TM) to do.

I used a separate function for the propertization (is that a word?),
in case it might become useful elsewhere --- feel free to refactor
this to your liking.  I would be happy to see this change applied.

Standard disclaimer: Not using the git version, but works in the elpa
version from last night.

Regards,
Ingo

-----

--- org-agenda-orig.el	2012-11-02 18:26:43.848678550 +0100
+++ org-agenda.el	2012-11-02 18:43:23.377778537 +0100
@@ -4490,6 +4490,17 @@
 
 ;;; Agenda TODO list
 
+(defun org-propertize-todo-keyword-list (keywords)
+  (concat
+   (if (or (equal keywords "ALL") (not keywords))
+       (propertize "ALL" 'face 'warning)
+     (mapconcat
+      (lambda (kw)
+        (propertize kw 'face (org-get-todo-face kw)))
+      (org-split-string keywords "|")
+      "|"))
+   "\n"))
+
 (defvar org-select-this-todo-keyword nil)
 (defvar org-last-arg nil)
 
@@ -4550,9 +4561,7 @@
 				   (concat "ToDo: "
 					   (or org-select-this-todo-keyword "ALL"))))
 	(org-agenda-mark-header-line (point-min))
-	(setq pos (point))
-	(insert (or org-select-this-todo-keyword "ALL") "\n")
-	(add-text-properties pos (1- (point)) (list 'face 'org-warning))
+	(insert (org-propertize-todo-keyword-list org-select-this-todo-keyword))
 	(setq pos (point))
 	(unless org-agenda-multi
 	  (insert "Available with `N r': (0)[ALL]")

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

* Re: [PATCH] Nicer fontification for org-todo-list
  2012-11-02 17:47 [PATCH] Nicer fontification for org-todo-list Ingo Lohmar
@ 2012-11-02 17:50 ` Ingo Lohmar
  2012-12-04 14:01   ` Ingo Lohmar
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Lohmar @ 2012-11-02 17:50 UTC (permalink / raw)
  To: emacs-orgmode

Apart from a spurious "to" in my explanation, I should clarify:

This is a patch to "org-todo-list" in org-agenda.el.

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

* Re: [PATCH] Nicer fontification for org-todo-list
  2012-11-02 17:50 ` Ingo Lohmar
@ 2012-12-04 14:01   ` Ingo Lohmar
  2012-12-04 14:39     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Lohmar @ 2012-12-04 14:01 UTC (permalink / raw)
  To: emacs-orgmode

Hey guys,

It seems that whatever I send to this mailing list goes unnoticed and then gets
lost in some black hole.  :)

Could anybody let me know if there's any interest in the patch, or if there's
any more work for me to do or anything left to explain/sort out?

Otherwise I'll bite the bullet and make it a private patch to apply during my
update routine..

Regards,
Ingo

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

* Re: [PATCH] Nicer fontification for org-todo-list
  2012-12-04 14:01   ` Ingo Lohmar
@ 2012-12-04 14:39     ` Bastien
  2012-12-06 20:14       ` Ingo Lohmar
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-12-04 14:39 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-orgmode

Hi Ingo,

sorry nobody had the time to test the patch and report.

It looks good to me and does the right thing.  

Do you mind resending it using git?  Don't forget to add a changelog
entry (with `C-x 4 a' in the modified places) and a TINYCHANGE cookie 
at the end of the entry.

Note that we cannot accept patches larger than 20 lines, so if you
want to contribute further, maybe you can consider signing the FSF
papers?

See
http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Thanks for your contribution/patience!

-- 
 Bastien

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

* Re: [PATCH] Nicer fontification for org-todo-list
  2012-12-04 14:39     ` Bastien
@ 2012-12-06 20:14       ` Ingo Lohmar
  2012-12-18 17:23         ` Ingo Lohmar
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Lohmar @ 2012-12-06 20:14 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On Tue, Dec 04 2012 15:39 (+0100), Bastien wrote:

> Hi Ingo,
>
> sorry nobody had the time to test the patch and report.
>
> It looks good to me and does the right thing.  
>
> Do you mind resending it using git?  Don't forget to add a changelog
> entry (with `C-x 4 a' in the modified places) and a TINYCHANGE cookie 
> at the end of the entry.
>
> Note that we cannot accept patches larger than 20 lines, so if you
> want to contribute further, maybe you can consider signing the FSF
> papers?
>
> See
> http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt
>
> Thanks for your contribution/patience!
>
> -- 
>  Bastien

Hi Bastien,

No worries, and thanks for taking the time.  Below is the patch in git
format, I hope the format is ok (incl changelog), otherwise please bear
with me...  Will send the mail regarding the FSF papers soon!

Ingo



From 1ecc9832bcda75638dc29565f71516416e599e89 Mon Sep 17 00:00:00 2001
From: Ingo Lohmar <i.lohmar@gmail.com>
Date: Thu, 6 Dec 2012 20:51:59 +0100
Subject: [PATCH] Propertize keywords in todo list header

* org-agenda.el (org-todo-list): Propertize keywords with
  their proper faces in the header of a todo list agenda.

TINYCHANGE
---
 lisp/org-agenda.el |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 2c484b5..15321e1 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4509,6 +4509,17 @@ in `org-agenda-text-search-extra-files'.
 
 ;;; Agenda TODO list
 
+(defun org-propertize-todo-keyword-list (keywords)
+  (concat
+   (if (or (equal keywords "ALL") (not keywords))
+       (propertize "ALL" 'face 'warning)
+     (mapconcat
+      (lambda (kw)
+        (propertize kw 'face (org-get-todo-face kw)))
+      (org-split-string keywords "|")
+      "|"))
+   "\n"))
+
 (defvar org-select-this-todo-keyword nil)
 (defvar org-last-arg nil)
 
@@ -4569,9 +4580,7 @@ for a keyword.  A numeric prefix directly selects the Nth keyword in
 				   (concat "ToDo: "
 					   (or org-select-this-todo-keyword "ALL"))))
 	(org-agenda-mark-header-line (point-min))
-	(setq pos (point))
-	(insert (or org-select-this-todo-keyword "ALL") "\n")
-	(add-text-properties pos (1- (point)) (list 'face 'org-warning))
+	(insert (org-propertize-todo-keyword-list org-select-this-todo-keyword))
 	(setq pos (point))
 	(unless org-agenda-multi
 	  (insert "Available with `N r': (0)[ALL]")
-- 
1.7.10.4

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

* Re: [PATCH] Nicer fontification for org-todo-list
  2012-12-06 20:14       ` Ingo Lohmar
@ 2012-12-18 17:23         ` Ingo Lohmar
  2012-12-18 17:51           ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Lohmar @ 2012-12-18 17:23 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien and all,

Is anything still to be fixed before the patch that I sent can be
applied?  I am curious since there was no reaction and no change in the
repo as far as I can tell...

Best
Ingo

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

* Re: [PATCH] Nicer fontification for org-todo-list
  2012-12-18 17:23         ` Ingo Lohmar
@ 2012-12-18 17:51           ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2012-12-18 17:51 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-orgmode

Hi Ingo,

Ingo Lohmar <i.lohmar@gmail.com> writes:

> Is anything still to be fixed before the patch that I sent can be
> applied?  I am curious since there was no reaction and no change in the
> repo as far as I can tell...

I just applied a slightly modified version of your patch:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=0f3264f

I changed the commit log to mention "New function", and I
used the org-agenda- prefix for this function.

Thanks again for this patch, sorry it took long to apply it.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2012-12-18 17:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02 17:47 [PATCH] Nicer fontification for org-todo-list Ingo Lohmar
2012-11-02 17:50 ` Ingo Lohmar
2012-12-04 14:01   ` Ingo Lohmar
2012-12-04 14:39     ` Bastien
2012-12-06 20:14       ` Ingo Lohmar
2012-12-18 17:23         ` Ingo Lohmar
2012-12-18 17:51           ` Bastien

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