From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric Lilja" Newsgroups: gmane.emacs.help Subject: Re: Changing font-lock for combined HTML and PHP code?? Date: 16 Apr 2007 12:13:15 -0700 Organization: http://groups.google.com Message-ID: <1176750795.320403.140590@y80g2000hsf.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1176752213 14811 80.91.229.12 (16 Apr 2007 19:36:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Apr 2007 19:36:53 +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 Apr 16 21:36:47 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HdX0H-00051Z-Ku for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2007 21:36:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdX4v-0001rt-4e for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2007 15:41:33 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!postnews.google.com!y80g2000hsf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 41 Original-NNTP-Posting-Host: 85.194.49.108 Original-X-Trace: posting.google.com 1176750795 12367 127.0.0.1 (16 Apr 2007 19:13:15 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 16 Apr 2007 19:13:15 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: y80g2000hsf.googlegroups.com; posting-host=85.194.49.108; posting-account=VhnPwg0AAAB7O5OQRS5Hs376X47qoQdE Original-Xref: shelby.stanford.edu gnu.emacs.help:147129 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:42733 Archived-At: On 16 Apr, 20:22, William Case wrote: > Hi; > > I am working on web site made up of files that combine HTML and PHP. My > main interest is in the PHP coding. Is there a relatively easy way to > set the font-lock colors for the tags (constants) that distinguishes > between a HTML tag and a PHP tag when I am in php-mode. I would like to find a good way to handle these kinds of files too, with both html code and php code. What I'm experimenting with just now is adding a keyboard setting for the html-mode to go to php mode and keyboard setting for php mode to go to html mode. Not ideal but better than what I had before which was treating php-files like html-files, hehe. I like emacs' html mode. I downloaded php mode from a third party. The code is simply: (require 'php-mode) ; php-mode actually runs this hook, maybe there's a better place to put this... (defun my-c-mode-common-hook () (define-key c-mode-base-map "\C-c\C-h" 'html-mode) ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) (defun my-html-mode-hook () (define-key html-mode-map "\C-c\C-p" 'php-mode) ) (add-hook 'html-mode-hook 'my-html-mode-hook) The php-mode will actually font lock the html code but I don't like the way it indents it at all. Thus I switch between the modes with these keyboard bindings depending on if I'm editing a html part of the file or a php part. As I said, not ideal, but better than my earlier approach. - Eric