开发者

Is it possible to write HTML-withASP-withJavascript-withCSS in EMACS?

开发者 https://www.devze.com 2023-01-26 04:08 出处:网络
I 开发者_如何学编程am enjoying learning the EMACS text editor...but I can\'t help thinking that the HTML mode could use some work.

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


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/nxhtml@lists.launchpad.net/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.


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.


You can always use the Emacs Emulation for visual studio instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消