Function: opascal-new-comment-line

opascal-new-comment-line is an interactive and byte-compiled function defined in opascal.el.gz.

Signature

(opascal-new-comment-line)

Documentation

If in a // comment, do a newline, indented such that one is still in the comment block. If not in a // comment, just does a normal newline.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/opascal.el.gz
(defun opascal-new-comment-line ()
  "If in a // comment, do a newline, indented such that one is still in the
comment block.  If not in a // comment, just does a normal newline."
  (interactive)
  (declare
   (obsolete "use comment-indent-new-line with comment-multi-line instead"
             "27.1"))
  (let ((comment (opascal-current-token)))
    (if (not (eq 'comment-single-line (opascal-token-kind comment)))
        ;; Not in a // comment. Just do the normal newline.
        (newline)
      (let* ((start-comment (opascal-comment-block-start comment))
             (comment-start (opascal-token-start start-comment))
             (content-start (opascal-comment-content-start start-comment))
             (prefix
              (concat (make-string (opascal-column-of comment-start) ?\s) "//"
                      (make-string (- content-start comment-start 2) ?\s))))
        (delete-horizontal-space)
        (insert "\n" prefix)))))