Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!ucbvax!pur-ee.UUCP!mlm
From: mlm@pur-ee.UUCP ("Michael L. McLean")
Newsgroups: comp.emacs
Subject: Re: Comment Blocks ...
Message-ID: <8805070219.AA13465@ei.ecn.purdue.edu>
Date: 7 May 88 02:19:04 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: pur-ee!mlm@rutgers.edu
Organization: The Internet
Lines: 77


In article <28549@yale-celray.yale.UUCP>, @RELAY.CS.NET:kgk@cs writes:
> Has anybody implemented a function for Lisp mode which will indent a
> long comment, ignoring the comment characters?  What I mean is a
> function which will indent
> 
> ;;; Foo bar 
> ;;; qux
> 
> to
> 
> ;;; Foo bar qux
> 
> but not
> 
> ;;; Foo bar ;;; qux

You can use fill-prefix to do this.  Here is a great little function
(sadly not mine, but I got it from the net so here it is) that will
set the fill prefix based on the text.  The var fill-coment-
block-regexp describes characters that qualify as possible fill
characters.  The default is anything except alpha-numeric.  The great
thing about this function is that it will work for shell mode
comments, assembler comments etc ....  I bind this to M-Q since the
default M-Q and M-q are both fill-paragraph.  The original author is
listed with the code.

While on the subject of comments, an auto-filled comment mode for
c-mode was posted a while back.  The author is listed as Robert
Mecklenburg and the posted is George Hartzell.  This mode fills C
comments like below.

	/*
	 * Your favorite 
	 * multi-line comment.
	 */

Unfortunatly this code (supposedly) works under 18.47 but it definatly
fails under 18.50.  Neither the poster nor I have been able to find
the problem.  Does anyone have a copy of this mode that works under
18.50 ???  If you do please please submit it.  Also if you are the
person who fixed it for 18.50 could you tell me what the problem was.
I have a feeling that I am missing something stupidly obvious in the
code.  Alternativly does anyone have a similar function they would
like to send me ???

Thanks  ---

	Mike McLean 
	mlm@ecn.purdue.edu
	{rutgers,ihnp4,inuxc}!pur-ee!mlm

---- Snip Snip Snippity Snippity Snip ----
;;; 
;;; Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
;;; 326 Commonwealth Ave.	UUCP:  mit-eddie!mgm.mit.edu!wolfgang
;;; Boston, Ma. 02115	TEL:   (617) 267-4365
;;; 

(defvar fill-comment-block-regexp "^a-zA-Z0-9"
  "*Regexp to identify the fill-prefix for the fill-comment-block function.")

(defun fill-comment-block ()
  "Fill a comment block. Uses fill-comment-block-regexp to identify the
fill-prefix. If none found, uses the default fill-prefix."
  (interactive)
  (save-excursion
    (beginning-of-line)
    (if (looking-at (concat "[" fill-comment-block-regexp "]"))
        (progn
	  (skip-chars-forward fill-comment-block-regexp)
	  (let ((fill-prefix))
	    (set-fill-prefix) 
	    (fill-paragraph nil)))
      (fill-paragraph nil))))

---- Snip Snip Snippity Snippity Snip ----