Function: log-edit--insert-filled-defuns
log-edit--insert-filled-defuns is a byte-compiled function defined in
log-edit.el.gz.
Signature
(log-edit--insert-filled-defuns FUNC-NAMES)
Documentation
Insert FUNC-NAMES, following ChangeLog formatting.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit--insert-filled-defuns (func-names)
"Insert FUNC-NAMES, following ChangeLog formatting."
(if (not func-names)
(insert ":")
;; Insert a space unless this list of defun names is being
;; inserted at the start of a line or after a space character.
(unless (or (memq (char-before) '(?\n ?\s))
(> (current-column) fill-column))
(insert " "))
(let ((inside-paren-pair nil)
(first-line t)
name)
;; Now insert the functions names one by one, inserting newlines
;; as appropriate.
(while func-names
(setq name (car func-names))
(setq func-names (cdr func-names))
;; If inserting `name' after preexisting text in the first
;; line would overflow the fill column, place it on its own
;; line.
(if (and first-line
(> (current-column) 0)
(> (+ (current-column)
(string-width name)
;; If this be the last name, the column must be
;; followed by an extra colon character.
(if func-names 1 2))
fill-column))
(progn
(insert "\n")
;; Iterate over this function name again.
(setq func-names (cons name func-names)))
(if inside-paren-pair
;; If `name' is not the first item in a list of defuns
;; and inserting it would overflow the fill column,
;; start a new list of defuns on the next line.
(if (> (+ (current-column)
(string-width name)
;; If this be the last name, the column must
;; be followed by an extra colon character;
;; however, there are two separator characters
;; that will be deleted, so the number of
;; columns to add to this in the case of
;; `name' being final and in other cases are 0
;; and 1 respectively.
(if func-names 0 1))
fill-column)
(progn
(delete-char -2)
(insert ")\n")
(setq inside-paren-pair nil
;; Iterate over this function name again.
func-names (cons name func-names)))
;; Insert this defun name with a separator attached.
(insert name ", "))
;; Otherwise, decide whether to start a list of defuns or
;; to insert `name' on its own line.
(if (> (+ (current-column)
(string-width name)
(if func-names 1 2)) ; The column number of
; line after inserting
; `name'...
fill-column)
;; ...would leave insufficient space for any
;; subsequent defun names so insert it on its own
;; line.
(insert (if func-names
(format "(%s)\n" name)
(format "(%s):" name)))
;; Insert a new defun list, unless `name' is the last
;; function name.
(insert (if (not func-names)
(format "(%s):" name)
(setq inside-paren-pair t)
(format "(%s, " name))))))
(setq first-line nil))
;; Close any open list of defuns.
(when inside-paren-pair
(delete-char -2)
(insert "):")))))