From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: elisp q: what functions do I need to *visually* replace string foo with bar
Date: Wed, 07 Feb 2007 22:12:57 -0500 [thread overview]
Message-ID: <jwv7iutwdnq.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 1170869644.562266.161910@m58g2000cwm.googlegroups.com
> (setq font-lock-defaults
> '((("\\*self\\.\\(\\(?:\\s_\\|\\sw\\)+\\)" 1 my-italic-face)
> ("\\(\\*self\\.\\)\\(?:\\s_\\|\\sw\\)+" 1 my-invisible-face))
> ))
This can be advantageously merged:
(setq font-lock-keywords
'(("\\(\\*self\\.\\)\\(\\(?:\\s_\\|\\sw\\)+\\)"
(1 'my-invisible-face)
(2 'italic))))
And instead of a special transparent face, you can use:
(setq font-lock-keywords
'(("\\(\\*self\\.\\)\\(\\(?:\\s_\\|\\sw\\)+\\)"
(1 '(face nil invisible t))
(2 'italic))))
but then you'll also have to add `invisible' to
`font-lock-extra-managed-props'.
And the above setting of `font-lock-keywords' is of course incorrect since
it erases any other font-lock rules of the major mode. Maybe something like
(add-hook 'my-idl-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\(\\*self\\.\\)\\(\\(?:\\s_\\|\\sw\\)+\\)"
(1 'my-invisible-face)
(2 'italic))))
(add-to-list 'font-lock-extra-managed-props 'invisible)))
Of course the above has not been tested at all.
Stefan
next prev parent reply other threads:[~2007-02-08 3:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-07 16:00 elisp q: what functions do I need to *visually* replace string foo with bar Mirko
2007-02-07 17:24 ` anoop aryal
2007-02-07 17:34 ` rgb
2007-02-07 18:43 ` David Hansen
2007-02-08 3:12 ` Stefan Monnier [this message]
2007-02-08 13:36 ` Mirko
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv7iutwdnq.fsf-monnier+gnu.emacs.help@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=help-gnu-emacs@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.
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).