Stephen Leake <[email protected]> writes:

> Try this (it passes the new tests I've added based on your report):

Oops; that doesn't handle the case of comment-dwim on an existing
comment on the same line as code:

   E := (1 =>    --
           'A');

Try this:

(defun wisi-comment-indent ()
  "For `comment-indent-function'. Indent single line comment to
the comment on the previous line."
  (or
   (save-excursion
     (forward-comment -1)
     (when (looking-at comment-start)
       ;; There is a preceding comment line.
       (current-column)))

   ;; Probably called from `comment-indent'; either to insert a new
   ;; comment, or to indent the first line of an existing one.  In
   ;; either case, the comment may be after code on the same line.
   (save-excursion
     (let ((start-col (current-column)))
       (back-to-indentation)
       (if (looking-at comment-start)
           ;; An existing comment alone on a line. Return nil, so
           ;; `comment-indent' will call `indent-according-to-mode'
           nil

         ;; A comment after code on the same line; point was at the
         ;; comment start, so assume it is already correct.
         start-col)))
   ))

-- 
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to