From: "Mirko" <mvukovic@nycap.rr.com>
Subject: Re: How to programmatically highlight region?
Date: 17 Nov 2006 18:35:30 -0800 [thread overview]
Message-ID: <1163817330.364336.26340@m7g2000cwm.googlegroups.com> (raw)
In-Reply-To: <mailman.691.1163638542.2155.help-gnu-emacs@gnu.org>
Perry Smith wrote:
> On Nov 15, 2006, at 4:48 PM, David Abrahams wrote:
>
> > Perry Smith <pedz@easesoftware.com> writes:
> >
> >> On Nov 15, 2006, at 2:10 PM, David Abrahams wrote:
> >>
> >> Hi,
> >>
> >> Could someone tell me how to get the effect of an "activated
> >> mark" in
> >> transient mark mode from within elisp? In other words, I'd
> >> like to be
> >> able to set up the point and mark, and when my elisp
> >> completes, see
> >> the region highlighted. Seems like it should be simple, but
> >> nothing I
> >> do seems to work.
> >>
> >> You might be asking how transient mark mode works.
> >
> > I don't think that's what I'm asking.
> >
> >> It seems to be just a variable that commands look at. But this
> >> works for me:
> >>
> >> (defun dog-test ()
> >> (interactive)
> >> (transient-mark-mode 1)
> >> (set-mark (point))
> >> (forward-char 20))
> >>
> >> execute dog-test from the minibuffer and the current point plus 20
> >> characters are highlighted
> >
> > Not for me. :(
> >
> > Thanks for responding.
>
> I felt challenged :-)
>
> You make a face. Put the attributes that you want in it. Then use
> put-text-property to apply that face to the region.
>
> (make-face 'my-blue-face)
>
> (set-face-attribute 'my-blue-face nil :background "blue")
>
> (defun dog-test3 ()
> (interactive)
> (put-text-property (point) (mark) 'face 'my-blue-face))
>
> Set your mark and point, then do M-x dog-test3
>
> There is something I don't understand though. If you have font-lock-
> mode set, then it does not work. I'm not sure what is happening in
> that case. I'm curious to see if others reply.
>
> Hope this help...
> Perry Smith
> Ease Software, Inc.
> pedz@easesoftware.com
> http://www.easesoftware.com
>
> Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems
>
>
Um, could someone comment on how to accomplish the following:
If I have a string such as "self.foo" I would like to see only
foo(underlined), i.e. make the "self." invisible, and change the
appearance of foo.
I think I understand how I could change the appearance of foo, but the
info on invisibility left me confused as how I can hide text.
Thanks,
Mirko
next prev parent reply other threads:[~2006-11-18 2:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-15 20:10 How to programmatically highlight region? David Abrahams
2006-11-15 21:41 ` Perry Smith
2006-11-15 22:48 ` David Abrahams
2006-11-16 0:50 ` Perry Smith
[not found] ` <mailman.691.1163638542.2155.help-gnu-emacs@gnu.org>
2006-11-18 2:35 ` Mirko [this message]
2006-11-22 9:38 ` Mathias Dahl
2006-11-22 13:36 ` Ehud Karni
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=1163817330.364336.26340@m7g2000cwm.googlegroups.com \
--to=mvukovic@nycap.rr.com \
/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.