bob@MORNINGSTAR.COM (Bob Sutterfield) (02/19/91)
I'm using Per Abrahamsen <amanda@iesd.dk>'s outline-minor-mode with *roff. I have made the following adaptations to the LaTeX support which seem to work well enough with *roff and the -me macro set: (defvar Nroff-outline-regexp "\.sh[ ]+") (defun Nroff-outline-level () "Find the level of current outline heading in a Nroff document." , (save-excursion (skip-chars-forward " \n") (forward-char 1) (cond ((looking-at ".sh 9") 9) ((looking-at ".sh 8") 8) ((looking-at ".sh 7") 7) ((looking-at ".sh 6") 6) ((looking-at ".sh 5") 5) ((looking-at ".sh 4") 4) ((looking-at ".sh 3") 3) ((looking-at ".sh 2") 2) ((looking-at ".sh ") 1) ((looking-at ".sh 1") 1)))) (setq Nroff-mode-hook ;Use of Outline '(lambda () (setq outline-regexp Nroff-outline-regexp) (setq outline-level-function 'Nroff-outline-level))) My *roff source file starts and ends like: .sh 1 "first section" some text .sh 2 "first subsection" some text .sh 3 "first subsubsection" .sh 4 "first subsubsubsection" .sh 4 "second subsubsubsection" .sh 2 "second subsection" .sh 3 "first subsubsection" .\" Local Variables: .\" mode: electric-nroff .\" minor-mode: outline .\" outline-regexp: "\.sh[ ]+" .\" compile-command: "groff -me -TX75 design.me" .\" End: One problem is that I must still say "M-X outline-minor-mode" upon visiting the file. That is, the "minor-mode: outline" specified in the Local Variables part of the visited file doesn't seem to be happening. Any suggestions? Also, I have tried using the looking-at strings as above to find the outline level, rather than the gross length-of-the-regexp trick with the variable number of spaces, but I seem not to be recognizing what I'm looking at. I'd certainly prefer not to depend upon getting the number of spaces just right every time. What am I doing wrong?