aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-02-04 21:41:09 +0000
committerDan Nicolaescu2008-02-04 21:41:09 +0000
commit8a72c7f8c9ec04056ca218de3599ee45c0b09f76 (patch)
tree37822b5fb530fbe405d5fb06cb01eb0bc4b9c6a6
parentc0bc797888951a468475c76d3cfa00c2a2a92547 (diff)
downloademacs-8a72c7f8c9ec04056ca218de3599ee45c0b09f76.tar.gz
emacs-8a72c7f8c9ec04056ca218de3599ee45c0b09f76.zip
Add new TODO entry.
(diff-create-changelog): New function. (diff-mode-menu): Bind it.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/diff-mode.el33
2 files changed, 39 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0dd1faa81df..bf6afb7aa35 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12008-02-04 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * diff-mode.el: Add new TODO entry.
4 (diff-create-changelog): New function.
5 (diff-mode-menu): Bind it.
6
12008-02-04 Kenichi Handa <handa@ni.aist.go.jp> 72008-02-04 Kenichi Handa <handa@ni.aist.go.jp>
2 8
3 * international/mule-diag.el (print-fontset-element): Handle the 9 * international/mule-diag.el (print-fontset-element): Handle the
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 @@
39 39
40;; Todo: 40;; Todo:
41 41
42;; - Improve `diff-create-changelog', it is very simplistic now.
43;;
42;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks. 44;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks.
43;; Also allow C-c C-a to delete already-applied hunks. 45;; Also allow C-c C-a to delete already-applied hunks.
44;; 46;;
@@ -171,6 +173,8 @@ when editing big diffs)."
171 ["Apply hunk" diff-apply-hunk t] 173 ["Apply hunk" diff-apply-hunk t]
172 ["Test applying hunk" diff-test-hunk t] 174 ["Test applying hunk" diff-test-hunk t]
173 ["Apply diff with Ediff" diff-ediff-patch t] 175 ["Apply diff with Ediff" diff-ediff-patch t]
176 ["Create Change Log" diff-create-changelog
177 :help "Create ChangeLog entries for the changes in the diff buffer"]
174 "-----" 178 "-----"
175 ["Reverse direction" diff-reverse-direction t] 179 ["Reverse direction" diff-reverse-direction t]
176 ["Context -> Unified" diff-context->unified t] 180 ["Context -> Unified" diff-context->unified t]
@@ -1725,6 +1729,35 @@ For use in `add-log-current-defun-function'."
1725 props 'diff-refine-preproc)))))))) 1729 props 'diff-refine-preproc))))))))
1726 1730
1727 1731
1732(defun diff-create-changelog ()
1733 "Iterate through the current diff and create ChangeLog entries."
1734 (interactive)
1735 ;; XXX: Currently add-change-log-entry-other-window is only called
1736 ;; once per hunk. Some hunks have multiple changes, it would be
1737 ;; good to call it for each change.
1738 (save-excursion
1739 (goto-char (point-min))
1740 (let ((orig-buffer (current-buffer)))
1741 (condition-case nil
1742 ;; Call add-change-log-entry-other-window for each hunk in
1743 ;; the diff buffer.
1744 (while t
1745 (set-buffer orig-buffer)
1746 (diff-hunk-next)
1747 (beginning-of-line)
1748 (while (not (looking-at "^ "))
1749 (forward-line 1))
1750 ;; Move to where the changes are,
1751 ;; `add-change-log-entry-other-window' works better in
1752 ;; that case.
1753 (while (not (looking-at "^[!+-]"))
1754 (forward-line 1))
1755 (add-change-log-entry-other-window)
1756 ;; Insert a "." so that the entries created don't get
1757 ;; merged.
1758 (insert "."))
1759 (error nil)))))
1760
1728;; provide the package 1761;; provide the package
1729(provide 'diff-mode) 1762(provide 'diff-mode)
1730 1763