Function: c-calc-comment-indent
c-calc-comment-indent is a byte-compiled function defined in
cc-cmds.el.gz.
Signature
(c-calc-comment-indent ENTRY)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
;; Inserting/indenting comments
(defun c-calc-comment-indent (entry)
;; This function might do hidden buffer changes.
(if (symbolp entry)
(setq entry (or (assq entry c-indent-comment-alist)
(assq 'other c-indent-comment-alist)
'(default . (column . nil)))))
(let ((action (car (cdr entry)))
(value (cdr (cdr entry)))
(col (current-column)))
(cond ((eq action 'space)
(+ col value))
((eq action 'column)
(unless value (setq value comment-column))
(if (bolp)
;; Do not pad with one space if we're at bol.
value
(max (1+ col) value)))
((eq action 'align)
(or (save-excursion
(beginning-of-line)
(unless (bobp)
(backward-char)
(let ((lim (c-literal-limits (c-point 'bol) t)))
(when (consp lim)
(goto-char (car lim))
(when (looking-at "/[/*]") ; FIXME!!! Adapt for AWK! (ACM, 2005/11/18)
;; Found comment to align with.
(if (bolp)
;; Do not pad with one space if we're at bol.
0
(max (1+ col) (current-column))))))))
;; Recurse to handle value as a new spec.
(c-calc-comment-indent (cdr entry)))))))