fgallina / multi-web-mode Goto Github PK
View Code? Open in Web Editor NEWMulti Web Mode is a minor mode wich makes web editing in Emacs much easier.
License: GNU General Public License v3.0
Multi Web Mode is a minor mode wich makes web editing in Emacs much easier.
License: GNU General Public License v3.0
I'm not sure why, but if i change my config to use js2-mode instead of js-mode,
all highlighting is red and the syntax checking doesn't seem to work.
I once used web-mode in web-mode.org. It has some advantages, such as when you set colour in HTML, the colour-character's background will become to the corresponding colour. and it also auto-close the tag in HTML when we press '/'. I'm looking forward these functions.
I also love multi-web-mode, so I want it will be better.
For 20 years i've been fighting with emacs' indentation of JS code in SCRIPT tags. Three minutes after installing this (which i stumbled across in a stackoverflow answer), my problems are solved and i can finally stop cursing at emasc every time i tap enter inside a SCRIPT tag.
THANK YOU!
Hello,
I was wondering if multi-web-mode could be re-engineered to work inside minted environments on AucTeX for all the programming languages covered by Pygments. This would allow maximum flexibility when writing LaTeX documents. I think several other people could be interested in this feature. Maybe this could be started as a fork of multi-web-mode? I've also mentioned this feature on stackoverflow here. Thanks.
Consider this file:
<h1>I'm using multi-web-mode</h1>
<script>
function a() {
console.log("a");
}
</script>
When I move down inside the script multi-web-mode enables javascript-mode on the whole buffer. But javascript-mode gets confused by the apostrophe in the h1
, thinks that we're inside a quote, and doesn't know how to indent properly:
installing multi-web-mode exactly as instructed (for the elisp part) I get the following error when opening a HTML or PHP file:
Error in post-command-hook (mweb-post-command-hook): (invalid-function (quote mode))
The file is then opened as if multi-web-mode wasn't active (when in fact it is)
As you'll already know, there are a few existing approaches to this kind of thing ( http://www.emacswiki.org/emacs/MultipleModes ) and frankly it can all be a bit confusing. It would be really helpful if you could provide a brief description in the readme file of how this library differs, or why you decided to write it instead of adopting (or adapting) an existing approach?
Big fan of git-emacs here. When a mode switch occurs the modeline indicator disappears.
I wonder if multi-web-mode can be made templates-system-compatible (like jinja2/django). It would be very useful!
Hello,
First of all thanks, I think this is the first multi-mode emacs plugin I try that I find nice & simple.
Now my problem: if I don't use multi-web-global-mode, for example with coffee-mode and erb, then it always "jumps out" of multi-web-mode:
(defun multi-web-mode-coffee-erb ()
(setq mweb-default-major-mode 'coffee-mode)
(setq mweb-tags '((ruby-mode "<%==\\|<%=\\|<%#\\|<%" "%>")))
(setq mweb-filename-extensions '("erb"))
(multi-web-mode))
(add-to-list 'auto-mode-alist '("\\coffee\\.erb\\'" . multi-web-mode-coffee-erb))
After some investiguation, I see that in mweb-change-major-mode
when it changes mode (calls ruby-mode
) then multi-web-mode is disabled, and one has to call M-x multi-web-mode
again to reenable it... which will work until you change mode again.
[EDIT] I just checked and this also happens in plain PHP/HTML mode.
Hi,
at first I would like to thank you for making this mode! It's the only "multiple mode" extension for Emacs that works for me when editing mixed HTML/PHP files. :-)
Unfortunately I am experiencing a small hitch. The following code is the only thing that I have in my init.el file.
(add-to-list 'load-path "~/.emacs.d/plugins/php-mode/")
(require 'php-mode)
(add-hook 'php-mode-hook (lambda () (message "Hello")))
(add-to-list 'load-path "~/.emacs.d/plugins/multi-web-mode/")
(require 'multi-web-mode)
(setq mweb-default-major-mode 'html-mode)
(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
(js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
(css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
(setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
(multi-web-global-mode 1)
The problem is that whenever I press a TAB key to automatically indent some line within a PHP chunk the php-mode-hook is invoked (according to those Hello messages printed into the Messages buffer). Is this a correct behaviour? For me it's a little bit annoying and it slows me down during editing (I have some nontrivial config hooked to that hook and it takes some time to fulfill it).
Please will you find some time to look at this issue? I'm currently using Emacs 24.2.1 with the latest version of your mode.
Thank you very much!
Hi,
Thanks for making this! I've been playing around with other multi-mode alternatives and this one seems the most appealing :) I'm having an issue that's probably down to my own mistake, however. I'm triggering the mode using a hook like this:
(defun multi-web-mode-html-erb ()
(setq mweb-default-major-mode 'html-mode)
(setq mweb-tags '((ruby-mode "<%==|<%=|<%#|<%" "%>")))
(setq mweb-filename-extensions '("html.erb"))
(multi-web-mode))
(defun multi-web-mode-text-erb ()
(setq mweb-default-major-mode 'text-mode)
(setq mweb-tags '((ruby-mode "<%==|<%=|<%#|<%" "%>")))
(setq mweb-filename-extensions '("text.erb"))
(multi-web-mode))
(add-to-list 'auto-mode-alist '("\.html\.erb$" . multi-web-mode-html-erb))
(add-to-list 'auto-mode-alist '("\.text\.erb$" . multi-web-mode-text-erb))
I'm doing it this way so that I can get better customization per file extension than with a global mode. It is being triggered correctly, but when I open a .html.erb file it just renders as HTML everywhere, with the blocks of Ruby not being highlighted at all (unless I throw some bogus HTML inside the <% ... %>
blocks, which causes the HTML to be highlighted, like multi-web-mode isn't recognising the ERB tags.
.text.erb files just get rendered with no highlighting, due to them being interpreted as all-text, with no ERB.
Is there's a problem with the patterns I'm setting for the <% erb %> tags? They're a lot like tags really :)
Chris
The situation is as follows:
Issue: indent-region() deletes much of the region. It is clear that there is some point in the file that triggers some failure where, depending on whether mark was placed at the beginning or end of region, will delete from the trigger point to mark.
If not in multi-web-mode, the indent-region works as expected (i.e. nothing is deleted, and the indentation is sometimes wrong because of the mixed mode file, but that is expected).
This is something related to v.24 of Emacs. The same file, sourcing the same startup scripts in v.23 works fine.
The file is a PHP file, and the mode list is (XHMTL yas Multi-Web).
I have removed everything from startup except php-mode (1.5.0) and multi-web-mode with the same result. Except for extra files extensions, the startup is exactly as provided in the standard config.
If I am following things right, it looks like the actual function being called is the built-in sgml-indent-line()
I can provide more info/do more debugging, but at this point I do not know what would be most useful and request guidance.
Hi... is there a way to dynamically change the mweb-default-major-mode... once a file has been opened. I've started a new role developing coldfusion. Here files can be written using either based or script(){} based code. I find I open up a script based file with html-mode set as the mweb-default-major-mode and can't easily quickly switch the file to JavaScript-mode. Any ideas appreciated. Thanks
(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
(js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
(css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
Above is how we initialize major mode selector (how I can call it?).
I think, it is useful when mweb
permits to add hook function into each tags. So when we change from one mode to another, the hook called. It'll be more fun I thing..
(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>" my-php-mode-hook-function)
(js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>" my-js-mode-mode-hook-function)
(css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
Is there any interest in getting this uploaded to a public package repository such as ELPA or marmalade?
Alternatively, are you assuming that users have installed el-get? (After I noticed you have a fork of that project)
can not undo...
See joaotavora/autopair#32 - author suggested reporting here.
Deleting a closing paren with autopiar-mode and multi-web-mode both on causes an elisp error.
Very useful for surrounding text with divs/paragraphs/other markup tags.
Also would be nice to indent afterwards automatically...
Hi, thanks for a plug-in with a lot of potential.
It seems like the evil-mode modes are lost when the plug-in changes major mode. Like if I am in Visual mode i HTML and move my marker inside a PHP area I'm back to normal mode.
Thanks for your emacs extension.
I'm using the latest multi-web-mode for PHP/HTML editing, it can recognise html and php very accurately. However, PHP indentation is incorrect, please see the image:
http://i.imgur.com/o5KHL.png
php-mode itself will work correctly with multi-web-mode turned off.
(Emacs 24.2.50.1 on Debian 6)
multi-web-mode is excellent and I think this is the best mode for webdev on emacs, but just a little thing is bothering me, namely right now if you place your caret inside either the <script> or </script>, the major mode switches to js-mode, it would be nice if there was a way to tell multi-web-mode to only change mode when the caret is between the tags, excluding the tags themselves.
edit:
Unfortunately I opened this issue for the wrong project. I'm really sorry!
Please mark it as spam.
Hi there,
I just downloaded and installed this mode and used the example configuration. On the first html file I loaded, it failed to do any mode switching. After investigation, it turned out that my html file used single quotes rather than double quotes for most of the attributes (e.g. <style type='text/css'>).
It might help new users if you make the example mweb-tags match either type of quote, e.g.
(setq mweb-tags '((php-mode "<?php|<? |<?=" "?>")
(js-mode "<script +\(type=['"]text/javascript['"]\|language=['"]javascript['"]\)[^>]>" "</script>")
(css-mode "<style +type=['"]text/css['"][^>]>" "</style>")))
Cheers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.