From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: change faces interactively Date: Mon, 23 Jan 2012 11:51:02 +0100 Message-ID: <4F1D3B96.2050106@easy-emacs.de> References: <67E1B9EC96D94790BEA9EF4E01430D8F@us.oracle.com> <3859A6A238864D3D82B0DE219A88A724@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1327315888 2889 80.91.229.12 (23 Jan 2012 10:51:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2012 10:51:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 23 11:51:24 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 1RpHUg-0004ee-7l for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2012 11:51:23 +0100 Original-Received: from localhost ([::1]:37608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpHUf-0000l9-Q9 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2012 05:51:21 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:35613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpHUW-0000kh-CH for help-gnu-emacs@gnu.org; Mon, 23 Jan 2012 05:51:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpHUQ-0004hs-Dq for help-gnu-emacs@gnu.org; Mon, 23 Jan 2012 05:51:12 -0500 Original-Received: from moutng.kundenserver.de ([212.227.17.10]:61405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpHUQ-0004hn-0l for help-gnu-emacs@gnu.org; Mon, 23 Jan 2012 05:51:06 -0500 Original-Received: from [192.168.178.27] (brln-4db9c05c.pool.mediaWays.net [77.185.192.92]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LrXNx-1SlT7i2GJZ-012w9b; Mon, 23 Jan 2012 11:51:04 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.24) Gecko/20111101 SUSE/3.1.16 Thunderbird/3.1.16 In-Reply-To: <3859A6A238864D3D82B0DE219A88A724@us.oracle.com> X-Provags-ID: V02:K0:JRvMDO3PmPmmXyoYQ7Tsn/lG8QKVOteWNjmCFSMtn04 IbgVPTd+ciJ/QMTzc1nLvxaHyqEGH11JsXJJ4qMhw/Iym66tYM NV0FzuO7sjy6Rmt4FkCgi/AM3TuLBzeZcy9lye6TIBC17QZGaU nk1hJ4Wc8z7ps+H2YINV7SdqM6jWxF356HGe5BlBc+YDxWyTIx oHEA1aCuZQA7+FNxBVrZpmUottYTgHL3gCwCSl50udm+paRrJK 2qhcrBxcVwydrtoFmAcfpqd0QZXVKcSHaW+bRhB6S3IIOLzizs 07vTBN46inaGlAiAsrnUkHdFcZO84GeyeABNKurL9vKZ8bncde Oa6JYK27YeujktA7QXWf49t56DyTUPqmquTQobkFu X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.10 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:83544 Archived-At: Am 21.01.2012 03:07, schrieb Drew Adams: >> 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. > > Sorry, I don't have much time right now - perhaps someone else can help. > > If you just want to highlight stuff then perhaps have a look here: > http://www.emacswiki.org/emacs/FaceMenuPlus > http://www.emacswiki.org/emacs/HighlightLibrary > > > here an example from python-mode.el which sets a `py-number-face' depending from a `boolean py-use-number-face-p' (when py-use-number-face-p (add-to-list 'python-font-lock-keywords '("\\([0-9]+\\([eE][+-]?[0-9]*\\)?\\|0[xX][0-9a-fA-F]+\\)" 1 py-number-face))) You can put such into a command, calling font-lock-fontify-buffer afterwards HTH, Andreas -- http://launchpad.net/python-mode http://launchpad.net/s-x-emacs-werkstatt/