'Is it possible to write HTML-withASP-withJavascript-withCSS in EMACS?
I am enjoying learning the EMACS text editor...but I can't help thinking that the HTML mode could use some work.
I am currently programming in Legacy ASP/Javascript/CSS/HTML and was wondering if there is a mode that works with this. If possible, I was also hoping the mode wouldn't be from 10+ years ago or in a buggy state.
Thanks for your help! Will
Solution 1:[1]
nXhtml supports classic ASP JavaScript, is frequently updated and is not very buggy. It has better ASP support (except debugging) than current versions of Visual Studio IMO; I just use VS2010 for server-side debugging when necessary.
Here are the relevant sections of my .emacs
:
(load "autostart" t)
(eval-after-load "mumamo-fun"
'(define-mumamo-multi-major-mode asp-html-mumamo-mode
"Turn on multiple major modes for ASP with main mode `nxhtml-mode'.
This also covers inlined style and JavaScript."
("ASP Html Family" nxhtml-mode
(mumamo-chunk-asp%
mumamo-asp-chunk-inlined-script
mumamo-chunk-inlined-script
mumamo-chunk-style=
mumamo-chunk-onjs=
))))
(add-to-list 'auto-mode-alist '("\\.inc$" . asp-html-mumamo-mode))
; XXX this is a total hack, see:
; http://www.mail-archive.com/[email protected]/msg00197.html
(defun tab-width-4 ()
(setq tab-width 4))
(add-hook 'mumamo-after-change-major-mode-hook 'tab-width-4 t)
Update: For newer versions of nXhtml, you may need to change mumamo-asp-chunk-inlined-script
to mumamo-chunk-asp-server-script
.
(The last bit is necessary because the ASP code I'm working on assumes 4-space tabs; feel free to ignore it if this isn't a problem for you.)
If you have ASP that ends in anything other than .asp
or .inc
, you'll need to edit auto-mode-alist
further.
Solution 2:[2]
Since version 2.0 web-mode.el (available on http://web-mode.org) is compatible with ASPX. This major mode is also compatible with JSP and PHP.
Solution 3:[3]
You can always use the Emacs Emulation for visual studio instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | fxbois |
Solution 3 | Glorfindel |