Configuring emacs to recognize two modes of yaws file

From Notes_Wiki
Revision as of 08:49, 12 September 2018 by Saurabh (talk | contribs)

<yambe:breadcrumb self="Configuring emacs to recognize two modes of yaws file">Emacs|Emacs</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


<yambe:breadcrumb self="Configuring emacs to recognize two modes of yaws file">Emacs|Emacs</yambe:breadcrumb>