Well the site where I find it out doesn't seen to have anymore, so here
it is. It doesn't do much except highlighting stuff, no function
completion or something like that and I have access to the C menu, I
should search again I'm sure that I will found something better.
;;PHP MODE from http://zez.org/bf/
(require 'font-lock)
(require 'cc-mode)
(provide 'php-mode)
;;;###autoload
(define-derived-mode php-mode c-mode "PHP3"
"Major mode for editing PHP code.\n\n\\{php-mode-map}"
(setq case-fold-search t)
(turn-on-font-lock)
(setq font-lock-maximum-decoration t)
)
;; Make php-mode the default mode for PHP source code buffers.
;;;###autoload
(setq auto-mode-alist
(append
'( ("\\.php\\'" . php-mode) ("\\.php3\\'" .
php-mode)("\\.php4\\'" . php-mode) )
auto-mode-alist))
;; Make a menu keymap (with a prompt string)
;; and make it the menu bar item's definition.
(define-key php-mode-map [menu-bar] (make-sparse-keymap))
(define-key php-mode-map [menu-bar php]
(cons "PHP3" (make-sparse-keymap "PHP3")))
;; Define specific subcommands in this menu.
(define-key php-mode-map [menu-bar php complete-function]
'("Complete function name" . php-complete-function))
(define-key php-mode-map
[menu-bar php document-function]
'("View function documentation" . php-document-function))
(define-key php-mode-map
[menu-bar php browse-manual]
'("Browse manual" . php-browse-manual))
;; Define function name completion function
(defun php-complete-function ()
"Complete the function name at the point from known PHP3 functions."
(interactive)
(message "php-complete-function not implemented yet"))
;; Define function documentation function
(defun php-document-function ()
"Bring up documentation for the function at the point."
(interactive)
(message "php-document-function not implemented yet"))
;; Define function for browsing manual
(defun php-browse-manual ()
"Bring up manual for PHP3."
(interactive)
(message "php-browse-manual not implemented yet"))
;; Define abbreviations and their expansions
(define-abbrev php-mode-abbrev-table "ex" "extends")
(define-abbrev php-mode-abbrev-table "fu" "function")
(define-abbrev php-mode-abbrev-table "GL" "GLOBAL")
(define-abbrev php-mode-abbrev-table "req" "require(")
(define-abbrev php-mode-abbrev-table "ret" "return")
;; Set up font locking
(defconst php-font-lock-keywords-1 nil
"Subdued level highlighting for PHP mode.")
(defconst php-font-lock-keywords-2 nil
"Medium level highlighting for PHP mode.")
(defconst php-font-lock-keywords-3 nil
"Gauchy level highlighting for PHP mode.")
(let* (
(php-keywords
(regexp-opt
'("break" "continue" "do" "else" "for" "if" "return"
"switch" "while" "super" "new" "extends" "php" ) t))
(php-types
(regexp-opt
'("static" "const" "int" "integer" "real" "double" "float"
"string" "array" "object" "var" "GLOBAL" "function")))
(php-builtins
(regexp-opt
'("echo" "print" "require" "include")))
)
(setq php-font-lock-keywords-1
(list
;; Fontify type specifiers.
(cons (concat "\\<\\(" php-types "\\)\\>")
'font-lock-type-face)
))
(setq php-font-lock-keywords-2
(append php-font-lock-keywords-1
(list
;; Fontify keywords (except case, default and goto; see below).
(cons (concat "\\<" php-keywords "\\>") 'font-lock-keyword-face)
;;
;; Fontify case/goto keywords and targets, and case default/goto
tags.
'("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
;;
;; Fontify all constants.
'("\\<\\(false\\|null\\|true\\)\\>" .
font-lock-constant-face)
;;
;; Fontify function declarations
'("\\<\\(function\\)\\s-+\\(\\sw+\\)\\s-*("
(1 font-lock-keyword-face)
(2 font-lock-function-name-face)
)
)
))
(setq php-font-lock-keywords-3
(append php-font-lock-keywords-2
(list
;; Fontify function and method names
'("\\<\\(\\$\\([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\)->\\)?\\([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\)\\s-*("
(2 font-lock-variable-name-face t t)
(3 font-lock-function-name-face t t)
)
;; Fontify variable name references.
'("\\(\\$\\([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*->\\)?\\([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\)\\)"
(1 font-lock-variable-name-face t t)
(2 font-lock-variable-name-face t t)
)
'("\\<\\$\\(this\\)->"
(1 font-lock-keyword-face t t) ;; "this" as keyword
)
;; Fontify class names
'("\\<\\(class\\)\\s-+\\([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\)\\(\\(\\s-+extends\\s-+\\)\\([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\)\\)?\\s-*\\{"
(1 font-lock-keyword-face t t) ;; class keyword
(2 font-lock-type-face t t) ;; class name
(4 font-lock-keyword-face t t) ;; extend keyword
(5 font-lock-type-face t t) ;; super class name
)
)))
)
(defvar php-font-lock-keywords php-font-lock-keywords-3
"Default expressions to highlight in PHP mode.")
;; font-lock-add-keywords is only defined in GNU Emacs
(if (not (string-match "XEmacs" emacs-version))
(font-lock-add-keywords 'php-mode php-font-lock-keywords))
;; Add char '#' as a start comment delimiter
;; we don't need to set up the end comment delimiter
(modify-syntax-entry ?\# "< b")
Alexander Skwar wrote:
>
> So sprach »Francis Fillion« am 2001-07-18 18.07.2001 um 18:11:35 -0400 :
> > The best editor is emacs, you can have one in windows too and it's
>
> Actually I like vim better :) Emacs is just so HUGE.... :)
>
> > I use they php mode, it's not perfect but it do the job, I will need to
>
> Does Emacs (Emacs? Hmm, what about XEmacs?) have a PHP mode? Last time
> I checked, it did not - although I used XEmacs back then.
>
> Alexander Skwar
> --
> How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
> Homepage: http://www.digitalprojects.com | http://www.iso-top.de
> iso-top.de - Die günstige Art an Linux Distributionen zu kommen
> Uptime: 1 hour 17 minutes
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
Francis Fillion, BAA SI
Broadcasting live from his linux box.
And the maintainer of http://www.windplanet.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]