From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ishi soichi Newsgroups: gmane.emacs.help Subject: Re: change faces interactively Date: Sat, 21 Jan 2012 10:20:04 +0900 Message-ID: References: <67E1B9EC96D94790BEA9EF4E01430D8F@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8f23534be426fd04b6ff982b X-Trace: dough.gmane.org 1327108821 32730 80.91.229.12 (21 Jan 2012 01:20:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 21 Jan 2012 01:20:21 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 21 02:20:16 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RoPct-0003gl-CG for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Jan 2012 02:20:15 +0100 Original-Received: from localhost ([::1]:39448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoPcs-0003EL-FF for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jan 2012 20:20:14 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:40122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoPcl-0003C0-Sh for help-gnu-emacs@gnu.org; Fri, 20 Jan 2012 20:20:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RoPcj-0003H5-NH for help-gnu-emacs@gnu.org; Fri, 20 Jan 2012 20:20:07 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:46702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoPcj-0003Gd-BN for help-gnu-emacs@gnu.org; Fri, 20 Jan 2012 20:20:05 -0500 Original-Received: by iadj38 with SMTP id j38so2024879iad.0 for ; Fri, 20 Jan 2012 17:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zWMVbwr1+66zwHdziCoRwtl3QsMStlrABB7hWJoNKt8=; b=o2sqN/iF/gEuR5YiVjFHOuiWNEcyLf7k8IC08nJUSmoaIB4KWfZbELIKeh4w9puNgn Q/pkSgW5VGx2xuG7I41N0Xx6bQ+tRJK+z9zxGbB9xCx+5JkDq1nmi4i1aBmJxvEOcXSO Lv6eglwuadGqIpcsga4tXrNDqS1i1jIGJNws0= Original-Received: by 10.50.170.35 with SMTP id aj3mr127070igc.2.1327108804847; Fri, 20 Jan 2012 17:20:04 -0800 (PST) Original-Received: by 10.42.149.134 with HTTP; Fri, 20 Jan 2012 17:20:04 -0800 (PST) In-Reply-To: <67E1B9EC96D94790BEA9EF4E01430D8F@us.oracle.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83531 Archived-At: --e89a8f23534be426fd04b6ff982b Content-Type: text/plain; charset=ISO-8859-1 Sorry for my poor explanation. What I want is an interactive function that turns on/off face changes by command. Say, a buffer is in "my-mode". The above (define-generic-mode ... ) will AUTOMATICALLY apply the face definitions to all characters as soon as the buffer is opened (assuming the mode definition recognizes its file extension). I would rather develop a function that applies the faces AT WILL even after the buffer is opened IN THAT MODE. For example, a buffer is in "my-mode" but none of the words in that buffer is applied with any faces. Now I will implement a function, (defun my-mode-face-1 () (interactive)...), then a certain set of words in that buffer is bold-faced. After that, I will implement another function, (defun my-mode-face-2 () (interactive) ...), then another set of the words in that buffer is italic-faced. And so on... If it does not make sense, please ask me again. I appreciate it. soichi 2012/1/21 Drew Adams > > I'm trying to develop an interactive function that changes faces. > > For example, one way to change the face is > > > > ;;changes face of "think", "thinks", and "thought" > > (define-generic-mode my-mode > > nil nil > > '(("think?\\w*\\|thought" . 'org-warning)) nil nil) > > > > But this changes the face according to the mode, not the > > interactive command input. > > > > Is there anyway to develop an interactive function like that ? > > (defun change-face-to-one () (interactive) ...) > > Not quite sure what you're asking. Do you just want to modify a set of > faces FS > so they look the same as some given face G? > > If so, you can define a command that reads the names of the faces to > modify (FS) > and the face to copy (G), and then, in the body of the function, call > `copy-face' to modify each of the former (each F in FS). > > > --e89a8f23534be426fd04b6ff982b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sorry for my poor explanation.
What I want is an interactive function t= hat turns on/off face changes by command.

Say, a b= uffer is in "my-mode". =A0The above (define-generic-mode ... ) wi= ll AUTOMATICALLY apply the face definitions to all characters as soon as th= e buffer is opened (assuming the mode definition recognizes its file extens= ion).
I would rather develop a function that applies the faces AT WILL even = after the buffer is opened IN THAT MODE. =A0
For example, a buffe= r is in "my-mode" but none of the words in that buffer is applied= with any faces.
Now I will implement a function, (defun my-mode-face-1 () =A0(interact= ive)...), then a certain set of words in that buffer is bold-faced. =A0Afte= r that, I will implement another function, (defun my-mode-face-2 () (intera= ctive) ...), then another set of the words in that buffer is italic-faced. = And so on...

If it does not make sense, please ask me again. =A0I ap= preciate it.

soichi


2012/1/21 Drew Adams <drew.adams@oracle.com>
> I'm trying to dev= elop an interactive function that changes faces.
> For example, one way to change the face is
>
> ;;changes face of "think", "thi= nks", and "thought"
> (define-generic-mode my-mode
> =A0 nil nil
> =A0 '(("think?\\w*\\|thought" . 'org-warning))= nil nil)
>
> But this changes the face according to the mode, not the
> interactive command input.
>
> Is there anyway to develop an interactive function like that ?
> (defun change-face-to-one () (interactive) ...)

Not quite sure what you're asking. =A0Do you just want to modify = a set of faces FS
so they look the same as some given face G?

If so, you can define a command that reads the names of the faces to modify= (FS)
and the face to copy (G), and then, in the body of the function, call
`copy-face' to modify each of the former (each F in FS).



--e89a8f23534be426fd04b6ff982b--