Installing Emacs HTMLModeDeluxe

I found a really cool integrated PHP/Html/CSS mode for emacs that
works pretty well for me. Here’s how I set it up.

mkdir htmlmodedeluxe; cd htmlmodedeluxe
wget http://www.lysator.liu.se/~lenst/about_psgml/psgml-1.2.5.tar.gz
wget http://www-users.rwth-aachen.de/g.ohrner/Download/mmm-mode-older_post0.4.7_cvs.tar.bz2
wget http://aleron.dl.sourceforge.net/sourceforge/php-mode/php-mode-1.1.0.tgz
sudo wget http://www.garshol.priv.no/download/software/css-mode/css-mode.el
tar -zxvf tar -zxvf php-mode-1.1.0.tgzphp-mode.el
tar -jxvf mmm-mode-older_post0.4.7_cvs.tar.bz2
tar -zxvf psgml-1.2.5.tar.gz
find . -name "*.el" -exec cp \{\} /usr/share/emacs/site-lisp/ \;
wget http://involution.com/htmlmodedeluxe.emacs.txt


cat htmlmodedeluxe.emacs.txt

;;************************************************************
;; configure HTML editing
;;************************************************************
;;
(require 'php-mode)
(require 'css-mode)
;;
;; configure css-mode
(autoload 'css-mode "css-mode")
(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-indent-level '2)
;;
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
;;
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
;;
;; set up an mmm group for fancy html editing
(mmm-add-group
'fancy-html
'(
(html-php-tagged
:submode php-mode
:face mmm-code-submode-face
:front "<[?]php”
:back “[?]>”)
(html-css-attribute
:submode css-mode
:face mmm-declaration-submode-face
:front “style=\”"
:back “\”")))
;;
;; What files to invoke the new html-mode for?
(add-to-list ‘auto-mode-alist ‘(”\\.inc\\’” . html-mode))
(add-to-list ‘auto-mode-alist ‘(”\\.phtml\\’” . html-mode))
(add-to-list ‘auto-mode-alist ‘(”\\.php[34]?\\’” . html-mode))
(add-to-list ‘auto-mode-alist ‘(”\\.[sj]?html?\\’” . html-mode))
(add-to-list ‘auto-mode-alist ‘(”\\.jsp\\’” . html-mode))
;;
;; What features should be turned on in this html-mode?
(add-to-list ‘mmm-mode-ext-classes-alist ‘(html-mode nil html-js))
(add-to-list ‘mmm-mode-ext-classes-alist ‘(html-mode nil embedded-css))
(add-to-list ‘mmm-mode-ext-classes-alist ‘(html-mode nil fancy-html))
;;
;; Not exactly related to editing HTML: enable editing help with mouse-3 in all sgml files
(defun go-bind-markup-menu-to-mouse3 ()
(define-key sgml-mode-map [(down-mouse-3)] ’sgml-tags-menu))
;;
(add-hook ’sgml-mode-hook ‘go-bind-markup-menu-to-mouse3)

(set-face-background ‘mmm-default-submode-face “black”)
(set-face-background ‘mmm-code-submode-face “black”)

(cond (window-system
(set-face-background ‘mmm-default-submode-face “white”)
(set-face-background ‘mmm-code-submode-face “white”)
) )

Here is what php mode looks like in XEmacs.

And, of course, in the preferred environment, terminal mode!

Comments

Leave a response

Comments