emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Font-lock-add-keywords disables Org headline highlighting
Date: Wed, 21 Nov 2012 09:40:05 +0100	[thread overview]
Message-ID: <80fw43fixm.fsf@somewhere.org> (raw)

Hello,

With the following code, I can highlight special words such as `error' and
`warning' in any part of a buffer.

--8<---------------cut here---------------start------------->8---
(message "Minimal Emacs config file...")

(defface org-todo
  '((t (:weight bold :box (:line-width 1 :color "#89C58F")
                :foreground "#89C58F" :background "#E2FEDE")))
  "Face used to display state TODO.")

(defface org-level-1
  '((t (:weight bold :box (:line-width 1 :color "#42B5FF")
                :foreground "#42B5FF" :background "#D3EEFF")))
  "Outline level 1.")

(defface my/highlight-face
  '((t (:weight normal :slant normal :box '(:line-width 1 :color "#CC0000")
                :foreground "#CC0000" :background "#FFFF88")))
  "Face for making FIXME and other warnings stand out.")

(defvar my/highlight-org-regexps
  "\\(FIXME\\|BUG\\|XXX\\|[Ee]rror\\|[Ww]arning\\|WARNING\\)"
  "Patterns to highlight (for Org mode only, to ensure no conflict with the
  Org mode TODO keyword).")

;; set up highlighting of special patterns for Org mode only
(dolist (mode '(org-mode))
  (font-lock-add-keywords mode
                          `((,my/highlight-org-regexps 1 'my/highlight-face prepend))))

(message "Minimal Emacs config file... Done")
--8<---------------cut here---------------end--------------->8---

However, as you can see on the screencast at
http://screencast.com/t/RfMrD1IUBPZ, that conflicts with normal regular
highlighting of headlines.

In this MCE ("Minimal Complete Example"):

--8<---------------cut here---------------start------------->8---
* TODO Fix the warning about that

Bar is wrong.

* TODO Correct this

There is an error when you compile foo.
--8<---------------cut here---------------end--------------->8---

the first headline is not highlighted anymore (in `org-level-1') as soon as we
type one of the font-lock keywords (here: `warning').

Can you give me hints to sort this out?

Best regards,
  Seb

-- 
Sebastien Vauban

             reply	other threads:[~2012-11-21  8:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  8:40 Sebastien Vauban [this message]
2012-12-23  8:54 ` Font-lock-add-keywords disables Org headline highlighting 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=80fw43fixm.fsf@somewhere.org \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.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).