From: William Paul Vrotney
Subject: Re: Closing paren on separate line (was Re: macro characters)
Date: 
Message-ID: <vrotneyEKyA81.Gw1@netcom.com>
As Jacques Duthen has so kindly pointed out, the Emacs code that I posted
had an error in the common ut:insert-balanced-comment part of the code for
the C-U argument handling (see below) in the event that you change the
lengths of the left and right comment delimiters.

You need to replace (+ end 2) by (+ end (length cleft))

Also, notice that it should also have the comment

        ;  ARG < 0 = place comment around previous ARG s-expressions.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun cl:insert-balanced-comment (arg)
  "Insert a balanced comment with point inside.
ARG = C-u = place comment around region.
ARG > 0 = place comment around next ARG s-expressions."
  (interactive "P")
  (ut:insert-balanced-comment arg "#|" "|#"))

; Insert a balanced comment (cleft cright) with point inside.
;  ARG = C-u = place comment around region.
;  ARG > 0 = place comment around next ARG s-expressions.
(defun ut:insert-balanced-comment (arg cleft cright)
  (cond ((not arg)
         (insert cleft) (insert cright) (backward-char (length cright)))
        ((not (numberp arg))
         (let ((begin (region-beginning)) (end (region-end)))
           (goto-char begin) (insert cleft)
           (goto-char (+ end 2)) (insert cright)))
        (t (cond ((< arg 0) (setq arg (- arg)) (backward-sexp arg)))
           (insert cleft) (forward-sexp arg) (insert cright))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-- 

William P. Vrotney - ·······@netcom.com