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)

(define-derived-mode php-mode c-mode "PHP3"
  "Major mode for editing PHP code.\n\n\\{php-mode-map}"
  (setq case-fold-search t)
  (setq font-lock-maximum-decoration t)

;; Make php-mode the default mode for PHP source code buffers.
(setq auto-mode-alist
       '( ("\\.php\\'" . php-mode) ("\\.php3\\'" .
php-mode)("\\.php4\\'" . php-mode) )

;; 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."
  (message "php-complete-function not implemented yet"))

;; Define function documentation function
(defun php-document-function ()
  "Bring up documentation for the function at the point."
  (message "php-document-function not implemented yet"))

;; Define function for browsing manual
(defun php-browse-manual ()
  "Bring up manual for PHP3."
  (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* (
         '("break" "continue" "do" "else" "for" "if" "return"
           "switch" "while" "super" "new" "extends" "php" ) t))
         '("static" "const" "int" "integer" "real" "double" "float"
           "string" "array" "object" "var" "GLOBAL" "function")))
         '("echo" "print" "require" "include")))
  (setq php-font-lock-keywords-1
         ;; Fontify type specifiers.
         (cons (concat "\\<\\(" php-types "\\)\\>")

  (setq php-font-lock-keywords-2
    (append php-font-lock-keywords-1
       ;; 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
       '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
         (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
           ;; Fontify all constants.
           '("\\<\\(false\\|null\\|true\\)\\>" .
       ;; Fontify function declarations
         (1 font-lock-keyword-face)
         (2 font-lock-function-name-face)
  (setq php-font-lock-keywords-3
    (append php-font-lock-keywords-2
       ;; Fontify function and method names
         (2 font-lock-variable-name-face t t)
         (3 font-lock-function-name-face t t)
       ;; Fontify variable name references.
         (1 font-lock-variable-name-face t t)
         (2 font-lock-variable-name-face t t)
         (1 font-lock-keyword-face t t) ;; "this" as keyword
       ;; Fontify class names
         (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]

Reply via email to