From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Mirko" Newsgroups: gmane.emacs.help Subject: Re: How to programmatically highlight region? Date: 17 Nov 2006 18:35:30 -0800 Organization: http://groups.google.com Message-ID: <1163817330.364336.26340@m7g2000cwm.googlegroups.com> References: <87d57osc7s.fsf@pereiro.luannocracy.com> <147F5C25-BD32-4B93-96E7-00E3D8D596CD@easesoftware.com> <87lkmcqqc3.fsf@pereiro.luannocracy.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1163817651 28860 80.91.229.2 (18 Nov 2006 02:40:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2006 02:40:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 18 03:40:41 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GlG87-000248-AD for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Nov 2006 03:40:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GlG86-0007Cs-Mj for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Nov 2006 21:40:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!m7g2000cwm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 81 Original-NNTP-Posting-Host: 208.218.238.20 Original-X-Trace: posting.google.com 1163817335 26767 127.0.0.1 (18 Nov 2006 02:35:35 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 18 Nov 2006 02:35:35 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m7g2000cwm.googlegroups.com; posting-host=208.218.238.20; posting-account=zJ4b2Q0AAAB5wLprz3WGnkfVsRyuZtK0 Original-Xref: shelby.stanford.edu gnu.emacs.help:143169 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38786 Archived-At: Perry Smith wrote: > On Nov 15, 2006, at 4:48 PM, David Abrahams wrote: > > > Perry Smith 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