Subject: nroff-mode auto-fill-mode not on directives

From: Kevin Ryde <[email-masked]>
Date: Wed, 20 Aug 2008 08:30:41 +1000

In nroff-mode it'd be good if auto-fill-mode didn't fill when you're
entering a long directive line like

    .IP some long line going past your normal fill width ...

Almost always *roff directives have to be a single line.  I struck the
problem with a groff .URL with a long url doubled-up to both display
literally and be clickable in -Thtml.

I've been using the regexp below, which suppresses auto-fill on .IP and
the like, but continues to auto-fill the comment directives (no change)

    .\"    traditional
    .\#    groff extension
    '''    another traditional, apparently

And of course non-directive lines ("." or "'") are still auto-filled
(either ordinary text, or comments starting \" and \#).

2008-08-18  Kevin Ryde  <[email-masked]>

	* textmodes/nroff-mode.el (nroff-mode): Set auto-fill-inhibit-regexp
	so as not to auto-fill on directive lines, other than comment
	directives.

*** nroff-mode.el	08 May 2008 11:29:50 +1000	1.40
--- nroff-mode.el	18 Aug 2008 20:29:55 +1000	
***************
*** 144,149 ****
--- 144,160 ----
         (concat "[.']\\|" paragraph-start))
    (set (make-local-variable 'paragraph-separate)
         (concat "[.']\\|" paragraph-separate))
+ 
+   ;; Don't auto-fill directive lines starting . or ' since they normally
+   ;; have to be one line.  But do auto-fill comments .\" .\# and '''
+   ;;
+   ;; Comment directives (those starting . or ') are [.'][ \t]*\\[#"] or a
+   ;; ''', and this regexp is everything except those.  So [.'] followed by
+   ;; not backslash and not ' or followed by backslash but then not # or "
+   ;;
+   (set (make-local-variable 'auto-fill-inhibit-regexp)
+        "[.'][ \t]*\\([^ \t\\']\\|\\\\[^#\"]\\)")
+ 
    ;; comment syntax added by mit-erl!gildea 18 Apr 86
    (set (make-local-variable 'comment-start) "\\\" ")
    (set (make-local-variable 'comment-start-skip) "\\\\[\"#][ \t]*")

-- 
The Copenhagen Interpretation elucidated for the layman:
  You can't be sure until you see for yourself.