emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Code snippet for bolding or italicizing A/C priority strings
@ 2007-10-10  6:02 John Wiegley
  2007-10-10  8:37 ` John Wiegley
  0 siblings, 1 reply; 4+ messages in thread
From: John Wiegley @ 2007-10-10  6:02 UTC (permalink / raw)
  To: emacs-orgmode

This code snippet will modify your agenda buffer upon creation so that the
string [#A] is bolded, and [#C] is italicized.  It keeps whatever color it
had, it's just now strong or weak based on priority.

This doesn't change the display all that much, but it's enough to help pick
out the important and unimportant stuff.

Just pop into your .emacs and go!

John

(defun org-fontify-priorities ()
  (interactive)
  (save-excursion
    (let ((inhibit-read-only t))
      (goto-char (point-min))
      (while (re-search-forward "\\[#\\([A-C]\\)\\]" nil t)
        (let ((priority (match-string 1)))
          (cond ((string= priority "A")
                 (overlay-put (make-overlay (match-beginning 0)
                                            (match-end 0))
                              'face 'bold))
                ((string= priority "C")
                 (overlay-put (make-overlay (match-beginning 0)
                                            (match-end 0))
                              'face 'italic))))))))

(add-hook 'org-finalize-agenda-hook 'org-fontify-priorities)

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

* Re: Code snippet for bolding or italicizing A/C priority strings
  2007-10-10  6:02 Code snippet for bolding or italicizing A/C priority strings John Wiegley
@ 2007-10-10  8:37 ` John Wiegley
  2007-10-10 12:32   ` Rainer Stengele
  2007-10-11 10:20   ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: John Wiegley @ 2007-10-10  8:37 UTC (permalink / raw)
  To: emacs-orgmode

John Wiegley <johnw@newartisans.com> writes:

> This code snippet will modify your agenda buffer upon creation so that the
> string [#A] is bolded, and [#C] is italicized.  It keeps whatever color it
> had, it's just now strong or weak based on priority.

Actually, I'm finding I like having the whole title bolded or italicized, just
like Gnus does:

(defun org-fontify-priorities ()
  (interactive)
  (save-excursion
    (let ((inhibit-read-only t))
      (goto-char (point-min))
      (while (re-search-forward "\\[#\\([A-C]\\)\\]" nil t)
	(let ((priority (match-string 1)))
	  (cond ((string= priority "A")
		 (overlay-put (make-overlay (match-beginning 0)
					    ;;(match-end 0)
					    (line-end-position))
			      'face 'bold))
		((string= priority "C")
		 (overlay-put (make-overlay (match-beginning 0)
					    ;;(match-end 0)
					    (line-end-position))
			      'face 'italic))))))))

(add-hook 'org-finalize-agenda-hook 'org-fontify-priorities)

John

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

* Re: Code snippet for bolding or italicizing A/C priority strings
  2007-10-10  8:37 ` John Wiegley
@ 2007-10-10 12:32   ` Rainer Stengele
  2007-10-11 10:20   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Rainer Stengele @ 2007-10-10 12:32 UTC (permalink / raw)
  To: emacs-orgmode

John Wiegley schrieb:
> John Wiegley <johnw@newartisans.com> writes:
> 
>> This code snippet will modify your agenda buffer upon creation so that the
>> string [#A] is bolded, and [#C] is italicized.  It keeps whatever color it
>> had, it's just now strong or weak based on priority.
> 
> Actually, I'm finding I like having the whole title bolded or italicized, just
> like Gnus does:
> 
> (defun org-fontify-priorities ()
>   (interactive)
>   (save-excursion
>     (let ((inhibit-read-only t))
>       (goto-char (point-min))
>       (while (re-search-forward "\\[#\\([A-C]\\)\\]" nil t)
> 	(let ((priority (match-string 1)))
> 	  (cond ((string= priority "A")
> 		 (overlay-put (make-overlay (match-beginning 0)
> 					    ;;(match-end 0)
> 					    (line-end-position))
> 			      'face 'bold))
> 		((string= priority "C")
> 		 (overlay-put (make-overlay (match-beginning 0)
> 					    ;;(match-end 0)
> 					    (line-end-position))
> 			      'face 'italic))))))))
> 
> (add-hook 'org-finalize-agenda-hook 'org-fontify-priorities)
> 
> John
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 

Excellent! I appreciate your function very much!
It helps a lot to get a better overview in the agenda!

rainer

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

* Re: Code snippet for bolding or italicizing A/C priority strings
  2007-10-10  8:37 ` John Wiegley
  2007-10-10 12:32   ` Rainer Stengele
@ 2007-10-11 10:20   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2007-10-11 10:20 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-orgmode


On Oct 10, 2007, at 10:37, John Wiegley wrote:

> John Wiegley <johnw@newartisans.com> writes:
>
>> This code snippet will modify your agenda buffer upon creation so 
>> that the
>> string [#A] is bolded, and [#C] is italicized.  It keeps whatever 
>> color it
>> had, it's just now strong or weak based on priority.
>
> Actually, I'm finding I like having the whole title bolded or 
> italicized, just
> like Gnus does:

I have generalized this code to work with modified customized priorities
and to do the right thing when changing the priority from the agenda.
Thi code will be in 5.12.  You can turn it off with
`org-agenda-fonfity-priorities', default will be on.

Thanks, John!

- Carsten

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

end of thread, other threads:[~2007-10-11 10:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10  6:02 Code snippet for bolding or italicizing A/C priority strings John Wiegley
2007-10-10  8:37 ` John Wiegley
2007-10-10 12:32   ` Rainer Stengele
2007-10-11 10:20   ` Carsten Dominik

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