I've discovered that when using emacs and mmm-mode submode highlight fails to work. This impacts users attempting to mix html-mode, php-mode, javascript, ruby-mode etc... I've observed this bug on both x86 machines as well as amd64 machines. I have tried both emacs and emacs-cvs. I've also tried various versions of mmm-mode, ruby-mode, pgsml mode etc... I have tried a variety of configuration settings. Here is one: (require 'mmm-mode) (require 'mmm-auto) (setq mmm-global-mode 'maybe) (setq mmm-submode-decoration-level 2) (set-face-background 'mmm-output-submode-face "DarkSlateGray") (set-face-background 'mmm-code-submode-face "DarkSlateBlue") (set-face-background 'mmm-comment-submode-face "DarkOliveGreen") (mmm-add-classes '((erb-code :submode ruby-mode :match-face (("<%#" . mmm-comment-submode-face) ("<%=" . mmm-output-submode-face) ("<%" . mmm-code-submode-face)) :front "<%[#=]?" :back "%>" :insert ((?% erb-code nil @ "<%" @ " " _ " " @ "%>" @) (?# erb-comment nil @ "<%#" @ " " _ " " @ "%>" @) (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))))) (add-hook 'html-mode-hook (lambda () (local-set-key (kbd "<f8>") 'mmm-parse-buffer) (setq mmm-classes '(erb-code)) (mmm-mode-on))) (add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode)) for highlighting of .rhtml files. This exact setup does function correctly in XEmacs. This setup is reported to work by other Emacs users throughout the Internet. Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2, 2.6.14-gentoo-r5 i686) ================================================================= System uname: 2.6.14-gentoo-r5 i686 Intel(R) Xeon(TM) CPU 3.40GHz Gentoo Base System version 1.6.14 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.3 [enabled] dev-lang/python: 2.3.5, 2.4.2 sys-apps/sandbox: 1.2.12 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=pentium4" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=pentium4" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://mirrors.cs.uri.edu/gentoo http://distfiles.oshean.org http://open-systems.ufl.edu/mirrors/gentoo" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://hydrogen.oshean.org/gentoo-portage" USE="x86 X a52 aac aalib accessibility acpi alsa apache2 apm arts asterisk audiofile avi bash-completion berkdb bitmap-fonts bzip2 cdr cjk crypt cscope cups curl doc dv dvd dvdr dvdread eds effects emacs emboss encode enscript esd examples exif expat fam fastcgi ffmpeg flac foomaticdb fortran gd gdbm gif gimp gimpprint glitz glut gmp gnome gnutls gphoto2 gpm graphvix gstreamer gtk gtk2 gtkhtml guile hal idn ieee1394 imagemagick imap imlib inkjar ipv6 java jpeg kde kqemu lcms ldap ldb libcac libg++ libwww lua mad maildir mhash mikmod mmx mng mod_lisp motif mozilla mp3 mpeg mplayer mysql ncurses nls nptl nsplugin nvidia ogg oggvorbis openal opengl oss pam pcre pdflib perl plotutils plugin png postgres ppds python qt quicktime readline real rtc ruby samba sasl scanner sdl silvercity smp spell sql sqlite sse sse2 ssl subversion tcltk tcpd tetex threads tiff truetype truetype-fonts type1-fonts udev unicode usb v4l v4l2 vcd vorbis win32codecs wmf xanim xine xinerama xml2 xmms xosd xprint xv xvid xvmc zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Brandon, I got your email but haven't had time to respond. I'll just do all the responding here instead. I took the example elisp code from your bug report and tried it in emacs-22.0.50 (CVS from a few days ago). I put it in a "rhtml-test.el" and invoked emacs: emacs -l rhtml-init.el -q test.rhtml I got the following output: http://dev.gentoo.org/~mkennedy/test-rhtml.png It looks like there is a problem with applying ruby-mode to single line regions. The example shows that <% and <%= works if you insert newlines before the code. Is this what you're referring to?
Created attachment 81709 [details] rhtml-init.el
Created attachment 81710 [details] test.rhtml
Yep, that's exactly it. I never thought to see how it would respond to multiple lines. I justed tested by adding: (mmm-add-classes '((embedded-php :submode php-mode :front "<\\?\\(php\\)?" :back "\\?>" ))) (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil embedded-php)) to rhtml-init.el Found that <?php echo "test" ?> and <?php echo "test" ?> is behaving/malfunctioning the same way as ruby-mode. One liners are being colorized under html-mode ("sometext" is being font-locked as if it was an HTML string of text aka attribute text) while the multiple line version began to highlight the php keyword echo correctly. How can we go about fixing this? Could it be an emacs regexp multi-line problem? P.S. I have an ebuild for mmm-mode 4.8, that version does not fix this problem but it does fix some indention problems. Brandon
Here is the problem also documented on the mmm-mode mailing list http://sourceforge.net/mailarchive/forum.php?thread_id=8644105&forum_id=5108
BTW, I committed an updated ebuild for mmm-mode (0.4.8) a day or so ago so no need to submit your to bugzilla.
Found various screenshots throughout the 'net showing GNU Emacs users with proper mmm-mode highlighting. Attempted to contact those users via comments on their blogs etc... No word back at this time. http://shylock.uw.hu/Emacs/editing-erb-code.png http://times.usefulinc.com/2005/12/01-emacs-firefox Also found this additional note about the bug. I'm going to follow its directions and see if the fix works for me. http://www.masonhq.com/?MMMModeForEmacs Unfortunately, syntax highlighting with MMM-mode is seriously broken in GNU Emacs 21.x There have been some changes in font-lock.el that prevented the highlighting of inline regions, and lines starting with %. To work around this, use font-lock.el from Emacs 20.x. There are also problems with <% %> and <& &> sometimes interfering with quotes in html-mode. Using html-helper-mode instead of html-mode fixes this. -- EgorShipovalov
Thanks for appending that information. I'll do the same for whatever I find. On a whim I tried an MMM w/ nxml-mode and ruby-mode. This seems to work ok, albiet with a lot of mmm-parse-buffer'ing via f8 and I didn't test it with a schema.
As a work around, there is http://dev.technomancy.us/phil/wiki/arorem which combines HTML mode and Ruby mode syntax into one mode (rather than try to mix modes).
As there been any progress on this bug?
I think we should probably close this bug out as functionality that mmm-mode/Emacs lacks and will continue to lack until upstream modifies underlying Emacs notion of buffers. It appears that the users of Emacs that are doing Ruby on Rails development are moving more towards rails.el which is a mode specific to Rails programming. Links to Rails programming and the Emacs Rails mode are found here: http://wiki.rubyonrails.org/rails/pages/HowToUseEmacsWithRails and http://rubyforge.org/projects/emacs-rails/ respectively.
(In reply to comment #11) > I think we should probably close this bug out as functionality that > mmm-mode/Emacs lacks and will continue to lack until upstream modifies > underlying Emacs notion of buffers. It appears that the users of Emacs that are > doing Ruby on Rails development are moving more towards rails.el which is a > mode specific to Rails programming. That's a word, thanks for the comment.