From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: change faces interactively
Date: Mon, 23 Jan 2012 11:51:02 +0100 [thread overview]
Message-ID: <4F1D3B96.2050106@easy-emacs.de> (raw)
In-Reply-To: <3859A6A238864D3D82B0DE219A88A724@us.oracle.com>
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/
next prev parent reply other threads:[~2012-01-23 10:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 7:41 change faces interactively ishi soichi
2012-01-20 15:30 ` Drew Adams
2012-01-21 1:20 ` ishi soichi
2012-01-21 2:07 ` Drew Adams
2012-01-23 10:51 ` Andreas Röhler [this message]
2012-01-23 18:05 ` Michael Heerdegen
2012-01-25 6:44 ` ishi soichi
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=4F1D3B96.2050106@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--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.
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.