Previous: Filename, Up: Finding

3.3 Automatic Interface

Emacs provides an interface to detect automatically the format of a file and decode it when it is visited. It is used primarily by the facilities for editing rich (i.e., formatted) text, as a way to store formatting information transparently as ASCII markup. WoMan can in principle use this interface, but it must be configured explicitly.

This use of WoMan does not seem to be particularly advantageous, so it is not really supported. It originated during early experiments on how best to implement WoMan, before I implemented the current topic interface, and I subsequently stopped using it. I might revive it as a mechanism for storing pre-formatted WoMan files, somewhat analogous to the standard Unix catman facility. In the meantime, it exists for anyone who wants to experiment with it. Once it is set up it is simply a question of visiting the file and there is no WoMan-specific user interface!

To use it, put something like this in your .emacs file. [The call to set-visited-file-name is to avoid font-locking triggered by automatic major mode selection.]

     (autoload 'woman-decode-region "woman")
     
     (add-to-list 'format-alist
                  '(man "Unix man-page source format" "\\.\\(TH\\|ig\\) "
                        woman-decode-region nil nil
                        (lambda (arg)
                          set-visited-file-name
                          (file-name-sans-extension buffer-file-name))))