unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Eric Lilja" <mindcooler@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Changing font-lock for combined HTML and PHP code??
Date: 16 Apr 2007 12:13:15 -0700	[thread overview]
Message-ID: <1176750795.320403.140590@y80g2000hsf.googlegroups.com> (raw)
In-Reply-To: <mailman.2139.1176748185.7795.help-gnu-emacs@gnu.org>

On 16 Apr, 20:22, William Case <billli...@rogers.com> 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

       reply	other threads:[~2007-04-16 19:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2139.1176748185.7795.help-gnu-emacs@gnu.org>
2007-04-16 19:13 ` Eric Lilja [this message]
2007-04-16 19:55   ` Changing font-lock for combined HTML and PHP code?? William Case
     [not found]   ` <mailman.2146.1176753780.7795.help-gnu-emacs@gnu.org>
2007-04-18 15:15     ` Hadron
2007-04-18 15:49       ` Lennart Borgman (gmail)
2007-04-18 18:59         ` William Case
2007-04-29  4:44         ` William Case
2007-04-16 18:22 William Case
2007-04-16 19:41 ` Lennart Borgman (gmail)
2007-04-17 18:49 ` Karl Hegbloom

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1176750795.320403.140590@y80g2000hsf.googlegroups.com \
    --to=mindcooler@gmail.com \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).