Function: log-edit-changelog-entries

log-edit-changelog-entries is a byte-compiled function defined in log-edit.el.gz.

Signature

(log-edit-changelog-entries FILE)

Documentation

Return the ChangeLog entries for FILE, and the ChangeLog they came from.

The return value looks like this:
  (LOGBUFFER (ENTRYSTART ENTRYEND) ...)
where LOGBUFFER is the name of the ChangeLog buffer, and each
(ENTRYSTART . ENTRYEND) pair is a buffer region.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit-changelog-entries (file)
  "Return the ChangeLog entries for FILE, and the ChangeLog they came from.
The return value looks like this:
  (LOGBUFFER (ENTRYSTART ENTRYEND) ...)
where LOGBUFFER is the name of the ChangeLog buffer, and each
\(ENTRYSTART . ENTRYEND) pair is a buffer region."
  (let ((changelog-file-name
         (let ((default-directory
                 (file-name-directory (expand-file-name file)))
               (visiting-buffer (find-buffer-visiting file)))
           ;; If there is a buffer visiting FILE, and it has a local
           ;; value for `change-log-default-name', use that.
           (or (and visiting-buffer
                    (local-variable-p 'change-log-default-name
                                      visiting-buffer)
                    (with-current-buffer visiting-buffer
                      change-log-default-name))
               ;; `find-change-log' uses `change-log-default-name' if set
               ;; and sets it before exiting, so we need to work around
               ;; that memoizing which is undesired here.
               (progn
                 (setq change-log-default-name nil)
                 (find-change-log))))))
    (when (or (find-buffer-visiting changelog-file-name)
              (file-exists-p changelog-file-name)
              add-log-dont-create-changelog-file)
      (with-current-buffer
          (add-log-find-changelog-buffer changelog-file-name)
        (unless (eq major-mode 'change-log-mode) (change-log-mode))
        (goto-char (point-min))
        (if (looking-at "\\s-*\n") (goto-char (match-end 0)))
        (if (not (log-edit-changelog-ours-p))
            (list (current-buffer))
          (save-restriction
            (log-edit-narrow-changelog)
            (goto-char (point-min))

            (let ((pattern (log-edit-changelog--pattern file
                                                        changelog-file-name)))
              (let (texts
                    (pos (point)))
                (while (and (not (eobp)) (re-search-forward pattern nil t))
                  (let ((entry (log-edit-changelog-entry)))
                    (if (< (elt entry 1) (max (1+ pos) (point)))
                        ;; This is not relevant, actually.
                        nil
                      (push entry texts))
                    ;; Make sure we make progress.
                    (setq pos (max (1+ pos) (elt entry 1)))
                    (goto-char pos)))

                (cons (current-buffer) texts)))))))))