Function: log-view-modify-change-comment

log-view-modify-change-comment is an interactive and byte-compiled function defined in log-view.el.gz.

Signature

(log-view-modify-change-comment)

Documentation

Edit the change comment displayed at point.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-view.el.gz
(defun log-view-modify-change-comment ()
  "Edit the change comment displayed at point."
  (interactive)
  (let* ((files (list (if log-view-per-file-logs
			  (log-view-current-file)
                        (car log-view-vc-fileset))))
         (rev (log-view-current-tag))
         ;; `log-view-extract-comment' is the legacy code for this; the
         ;; `get-change-comment' backend action is the new way to do it.
         ;;
         ;; FIXME: Eventually the older backends should have
         ;; implementations of `get-change-comment' because that ought
         ;; to be more robust than the approach taken by
         ;; `log-view-extract-comment'.  Then we can delete the latter.
         ;; See discussion in bug#64055.  --spwhitton
         ;;
         ;; FIXME: We should implement backend actions
         ;; `get-change-comment' and `modify-change-comment' for bzr and
         ;; Hg, so that this command works for those backends.
         ;; As discussed in bug#64055, `get-change-comment' is required,
         ;; and parsing the old comment out of the Log View buffer will
         ;; not do.  This is because for these backends there are
         ;; `vc-*-log-switches' variables which can change what gets put
         ;; in the Log View buffers and break any Lisp parsing attempt.
         (comment (condition-case _
                      (vc-call-backend log-view-vc-backend
                                       'get-change-comment files rev)
                    (vc-not-supported (log-view-extract-comment)))))
    (when (memq 'log-edit-insert-message-template log-edit-hook)
      (let* ((first-newline (string-match "\n" comment))
             (summary (substring comment 0 first-newline))
             (rest (and first-newline
                        (substring comment (1+ first-newline)))))
        (setq comment
              ;; As we are part of the VC subsystem I think we are
              ;; entitled to call a \\`log-edit--' function.
              ;; --spwhitton
              (concat (log-edit--make-header-line "Summary" summary)
                      (if (length> rest 0) rest "\n")))))
    (vc-modify-change-comment files rev comment)))