unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "rgb" <rbielaws@i1.net>
To: help-gnu-emacs@gnu.org
Subject: Re: elisp q: what functions do I need to *visually* replace string foo with bar
Date: 7 Feb 2007 09:34:04 -0800	[thread overview]
Message-ID: <1170869644.562266.161910@m58g2000cwm.googlegroups.com> (raw)
In-Reply-To: <1170864058.926740.61920@a75g2000cwd.googlegroups.com>

On Feb 7, 10:00 am, "Mirko" <mvuko...@nycap.rr.com> wrote:
> Hello group,
>
> I would like to simplify the looks of my program files (programing
> language is called IDL from ITT Visual Solutions).  In these I have
> many variable references of the type
>
> *self.foo
>
> I would like emacs to display them (when in font lock mode) with just
> foo, but foo being italicized.
>
> Could someone please point me to the relevant elisp functions that can
> get me going?
>
> Thank you,
>
> Mirko

Making foo italic is pretty easy.
(setq font-lock-defaults
      '((("\\*self\\.\\(\\(?:\\s_\\|\\sw\\)+\\)" 1 my-italic-face))))

But making the reset invisible requires that you put the invisible
property
on the text which requires you to write a function.

For a quick fix you could just make the text invisible by just giving
it a
a face you make with foreground and background the same...

(setq font-lock-defaults
      '((("\\*self\\.\\(\\(?:\\s_\\|\\sw\\)+\\)" 1 my-italic-face)
        ("\\(\\*self\\.\\)\\(?:\\s_\\|\\sw\\)+" 1 my-invisible-face))
       ))

Perhaps someone else has an example of putting properties onto
text under font-lock control....
I don't have one handy.

  parent reply	other threads:[~2007-02-07 17:34 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 [this message]
2007-02-07 18:43   ` David Hansen
2007-02-08  3:12   ` Stefan Monnier
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=1170869644.562266.161910@m58g2000cwm.googlegroups.com \
    --to=rbielaws@i1.net \
    --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).