Next / Previous / Contents / Shipman's homepage

7. Decluttering your project directory

Once you accumulate a lot of template files, they tend to clutter up the directory where you are building your XML document. Follow this procedure to move them to a subdirectory out of sight and use them from there.

  1. Start in the directory where the XML document lives.

  2. Make a subdirectory i/:

    mkdir i
    

  3. Move your templates to that directory. For example:

    mv proc step i
    

  4. Add these lines to your .emacs file:

    ;; Define a command to insert a fragment from the i/ subdirectory.
    ;;
    (defun insert-frag (name)
      "Like insert-file but prepends 'i/' to the path given."
      (interactive "MTemplate: ")
      (insert-file (concat "i/" name)))
    ;;
    ;; Bind the above command to C-c C-e.
    ;;
    (global-set-key "\C-c\C-e" 'insert-frag)
    

  5. To insert a template named F, use the key sequence “C-c C-e F”.