Function: c-lineup-comment

c-lineup-comment is a byte-compiled function defined in cc-align.el.gz.

Signature

(c-lineup-comment LANGELEM)

Documentation

Line up a comment start according to c-comment-only-line-offset.

If the comment is lined up with a comment starter on the previous line, that alignment is preserved.

Works with: comment-intro.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-align.el.gz
(defun c-lineup-comment (_langelem)
  "Line up a comment start according to `c-comment-only-line-offset'.
If the comment is lined up with a comment starter on the previous
line, that alignment is preserved.

Works with: comment-intro."
  (save-excursion
    (back-to-indentation)
    (let ((col (current-column)))
      (cond
       ;; CASE 1: preserve aligned comments
       ((save-excursion
	  (and (c-backward-single-comment)
	       (= col (current-column))))
	(vector col))			; Return an absolute column.
       ;; indent as specified by c-comment-only-line-offset
       ((not (bolp))
	(or (car-safe c-comment-only-line-offset)
	    c-comment-only-line-offset))
       (t
	(or (cdr-safe c-comment-only-line-offset)
	    (car-safe c-comment-only-line-offset)
	    -1000))			;jam it against the left side
       ))))