From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: font-lock question Date: Mon, 9 Feb 2004 18:12:13 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1076359577 8780 80.91.224.253 (9 Feb 2004 20:46:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Feb 2004 20:46:17 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 09 21:46:09 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AqIIC-0005Ny-00 for ; Mon, 09 Feb 2004 21:46:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AqII9-0007bR-0B for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Feb 2004 15:46:05 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news2.telebyte.nl!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1076358248 55154 193.149.49.134 (9 Feb 2004 20:24:08 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 9 Feb 2004 20:24:08 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:120790 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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 Xref: main.gmane.org gmane.emacs.help:16738 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16738 Javier Oviedo wrote on Mon, 9 Feb 2004 11:18:00 -0500: > Hello all: > This will probably sound like a rather bizarre question but here goes... Bizarre indeed! > Is there a way to fontify a buffer based on a different mode but still > retain all of the original/base modes attributes(expect for the face > attributes, of course)? Yes. The answer is _always_ yes in Emacs. :-) > Example: I have c-file open in emacs and the buffer is using c-mode. > I'd like to use the faces for emacs-lisp-mode(this just an example, so > please humor me) but keep every other attribute of the c-mode. Can this > be done? Is there some other way I could accomplish this? Perhaps using > a minor mode and it's faces but keeping the attributes of the major > mode? I'm open to any and all suggestions. How about something like this (not tested): (defun jo-funny-font () (font-lock-mode -1) ;; The next line is taken from lisp-mode-variables in lisp-mode.el (setq font-lock-defaults '((lisp-font-lock-keywords lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) nil nil (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun (font-lock-mark-block-function . mark-defun))) (font-lock-mode 1)) (add-hook 'c-mode-hook 'jo-funny-font) But why do you want to do this? > Thanks in advance! > Javier -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").