all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Colin Baxter <m43cap@yandex.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: , help-gnu-emacs@gnu.org
Subject: Re: multi-line highlighting
Date: Sun, 28 Feb 2021 17:57:08 +0000	[thread overview]
Message-ID: <87mtvoaxe3.fsf@yandex.com> (raw)
In-Reply-To: <jwv1rd0uqun.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 28 Feb 2021 11:00:41 -0500")

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

    >> I have in an org-mode file a need to color the face of the string
    >> between 'Alpha:' and a period. To achieve this I have
    >> 
    >> #+begin_src elisp (add-hook 'org-mode-hook (lambda ()
    >> (font-lock-add-keywords nil
    >> '(("\\(Alpha:\\)\\([^\n\r\t]+\\)\\(.\\)"
    >                                          ^^^ This is not the
    > regexp for a "period".

Yes, I discovered that fact.

I now have what I want working with this:

#+begin_src elisp
(add-hook 'org-mode-hook (lambda ()
   (font-lock-add-keywords nil
               '(("Alpha:\\|." . font-lock-warning-face)
                 ("Alpha:\\([^<]+?\\)." . (1 font-lock-constant-face))
                 ("Beta:\\|." . font-lock-doc-face)
                 ("Beta:\\([^<]+?\\)." .  (1 font-lock-comment-face))))))
#+end_src

My end marker is the FULLWIDTH FULL STOP character. It may not be the
most rigorous solution but it works.

    > Have you looked at the ELisp reference manual that comes with your
    > Emacs?  It has a section called "Font Lock Multiline".

Yes, I did.

Thanks.

Best wishes



      reply	other threads:[~2021-02-28 17:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 10:01 multi-line highlighting Colin Baxter
2021-02-28 10:13 ` Colin Baxter
2021-02-28 12:34   ` Colin Baxter
2021-02-28 16:00 ` Stefan Monnier
2021-02-28 17:57   ` Colin Baxter [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtvoaxe3.fsf@yandex.com \
    --to=m43cap@yandex.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.