Difference between revisions of "Configuring emacs to recognize two modes of yaws file"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Emacs|Emacs</yambe:breadcrumb> <yambe:breadcrumb>Erlang_installation|Erlang installation</yambe:breadcrumb> =Configuring emacs to recognize two modes of yaws...")
 
m
Line 2: Line 2:
<yambe:breadcrumb>Erlang_installation|Erlang installation</yambe:breadcrumb>
<yambe:breadcrumb>Erlang_installation|Erlang installation</yambe:breadcrumb>
=Configuring emacs to recognize two modes of yaws file=
=Configuring emacs to recognize two modes of yaws file=
'''This no longer works.  It is recommended to start .yaws pages directly with <erl></erl> and use ehtml for generating html output'''


In .yaws file we have two different types of code: HTML and Erlang.  It is possible to configure emacs so that it properly recognizes the format to use based on whether the cursor is between <erl> </erl> or not.  To setup emacs to recognize both modes use:
In .yaws file we have two different types of code: HTML and Erlang.  It is possible to configure emacs so that it properly recognizes the format to use based on whether the cursor is between <erl> </erl> or not.  To setup emacs to recognize both modes use:

Revision as of 02:08, 16 February 2014

<yambe:breadcrumb>Emacs|Emacs</yambe:breadcrumb> <yambe:breadcrumb>Erlang_installation|Erlang installation</yambe:breadcrumb>

Configuring emacs to recognize two modes of yaws file

This no longer works. It is recommended to start .yaws pages directly with <erl></erl> and use ehtml for generating html output

In .yaws file we have two different types of code: HTML and Erlang. It is possible to configure emacs so that it properly recognizes the format to use based on whether the cursor is between <erl> </erl> or not. To setup emacs to recognize both modes use:

  1. Save content of two-mode-mode.el from https://github.com/klacke/yaws/blob/master/two-mode-mode.el to .emacs.d folder with same file-name.
  2. Verify that folder .emacs.d is in load-path by looking for lines similar to '(setq load-path (cons "~/.emacs.d" load-path))' or '(setq load-path (append ' ("~/.emacs.d") load-path ))'.
  3. Then add following code to .emacs file to enable two-modes for yaws files:
;;For two-mode yaws
(require 'nxml-mode)

(require 'two-mode-mode)

(or (assoc "\\.yaws$" auto-mode-alist)
    (setq auto-mode-alist (cons '("\\.yaws$" . two-mode-mode)
				auto-mode-alist)))

Steps have been learned from https://github.com/klacke/yaws/wiki/Two-mode