emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Wiegley <johnw@newartisans.com>
To: emacs-orgmode@gnu.org
Subject: Code snippet for bolding or italicizing A/C priority strings
Date: Wed, 10 Oct 2007 02:02:24 -0400	[thread overview]
Message-ID: <m2myurzevj.fsf@newartisans.com> (raw)

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)

             reply	other threads:[~2007-10-10  6:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10  6:02 John Wiegley [this message]
2007-10-10  8:37 ` Code snippet for bolding or italicizing A/C priority strings John Wiegley
2007-10-10 12:32   ` Rainer Stengele
2007-10-11 10:20   ` Carsten Dominik

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=m2myurzevj.fsf@newartisans.com \
    --to=johnw@newartisans.com \
    --cc=emacs-orgmode@gnu.org \
    /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).