summaryrefslogtreecommitdiff
path: root/lisp/diff-mode.el
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2008-02-04 21:41:09 +0000
committerDan Nicolaescu <dann@ics.uci.edu>2008-02-04 21:41:09 +0000
commit8a72c7f8c9ec04056ca218de3599ee45c0b09f76 (patch)
tree37822b5fb530fbe405d5fb06cb01eb0bc4b9c6a6 /lisp/diff-mode.el
parentc0bc797888951a468475c76d3cfa00c2a2a92547 (diff)
downloademacs-8a72c7f8c9ec04056ca218de3599ee45c0b09f76.tar.gz
Add new TODO entry.
(diff-create-changelog): New function. (diff-mode-menu): Bind it.
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r--lisp/diff-mode.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index b8b6a009e2b..ba6b2850205 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -39,6 +39,8 @@
;; Todo:
+;; - Improve `diff-create-changelog', it is very simplistic now.
+;;
;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks.
;; Also allow C-c C-a to delete already-applied hunks.
;;
@@ -171,6 +173,8 @@ when editing big diffs)."
["Apply hunk" diff-apply-hunk t]
["Test applying hunk" diff-test-hunk t]
["Apply diff with Ediff" diff-ediff-patch t]
+ ["Create Change Log" diff-create-changelog
+ :help "Create ChangeLog entries for the changes in the diff buffer"]
"-----"
["Reverse direction" diff-reverse-direction t]
["Context -> Unified" diff-context->unified t]
@@ -1725,6 +1729,35 @@ For use in `add-log-current-defun-function'."
props 'diff-refine-preproc))))))))
+(defun diff-create-changelog ()
+ "Iterate through the current diff and create ChangeLog entries."
+ (interactive)
+ ;; XXX: Currently add-change-log-entry-other-window is only called
+ ;; once per hunk. Some hunks have multiple changes, it would be
+ ;; good to call it for each change.
+ (save-excursion
+ (goto-char (point-min))
+ (let ((orig-buffer (current-buffer)))
+ (condition-case nil
+ ;; Call add-change-log-entry-other-window for each hunk in
+ ;; the diff buffer.
+ (while t
+ (set-buffer orig-buffer)
+ (diff-hunk-next)
+ (beginning-of-line)
+ (while (not (looking-at "^ "))
+ (forward-line 1))
+ ;; Move to where the changes are,
+ ;; `add-change-log-entry-other-window' works better in
+ ;; that case.
+ (while (not (looking-at "^[!+-]"))
+ (forward-line 1))
+ (add-change-log-entry-other-window)
+ ;; Insert a "." so that the entries created don't get
+ ;; merged.
+ (insert "."))
+ (error nil)))))
+
;; provide the package
(provide 'diff-mode)