aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-02-05 02:14:10 +0000
committerStefan Monnier2008-02-05 02:14:10 +0000
commit8330c1755ef06e8f6108c738d1a82deddbe0e20c (patch)
treea1b1ca5ae7a09f6f061109c01cb44c3fb51c6e29
parent76b071b197ac64cf37e88a5d9de71ffa1c03c4d6 (diff)
downloademacs-8330c1755ef06e8f6108c738d1a82deddbe0e20c.tar.gz
emacs-8330c1755ef06e8f6108c738d1a82deddbe0e20c.zip
(diff-add-change-log-entries-other-window):
Rename from diff-create-changelog. Change users. Minor change to hopefully work with plain diffs. (diff-mode-map): Add binding for it.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/diff-mode.el39
2 files changed, 27 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bf6afb7aa35..6e7743d7ae6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-02-05 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * diff-mode.el (diff-add-change-log-entries-other-window):
4 Rename from diff-create-changelog. Change users.
5 Minor change to hopefully work with plain diffs.
6 (diff-mode-map): Add binding for it.
7
12008-02-04 Dan Nicolaescu <dann@ics.uci.edu> 82008-02-04 Dan Nicolaescu <dann@ics.uci.edu>
2 9
3 * diff-mode.el: Add new TODO entry. 10 * diff-mode.el: Add new TODO entry.
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index ba6b2850205..bf6b5cf4895 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -39,7 +39,8 @@
39 39
40;; Todo: 40;; Todo:
41 41
42;; - Improve `diff-create-changelog', it is very simplistic now. 42;; - Improve `diff-add-change-log-entries-other-window',
43;; it is very simplistic now.
43;; 44;;
44;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks. 45;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks.
45;; Also allow C-c C-a to delete already-applied hunks. 46;; Also allow C-c C-a to delete already-applied hunks.
@@ -151,6 +152,8 @@ when editing big diffs)."
151 `(("\e" . ,diff-mode-shared-map) 152 `(("\e" . ,diff-mode-shared-map)
152 ;; From compilation-minor-mode. 153 ;; From compilation-minor-mode.
153 ("\C-c\C-c" . diff-goto-source) 154 ("\C-c\C-c" . diff-goto-source)
155 ;; By analogy with the global C-x 4 a binding.
156 ("\C-x4A" . diff-add-change-log-entries-other-window)
154 ;; Misc operations. 157 ;; Misc operations.
155 ("\C-c\C-a" . diff-apply-hunk) 158 ("\C-c\C-a" . diff-apply-hunk)
156 ("\C-c\C-e" . diff-ediff-patch) 159 ("\C-c\C-e" . diff-ediff-patch)
@@ -173,7 +176,7 @@ when editing big diffs)."
173 ["Apply hunk" diff-apply-hunk t] 176 ["Apply hunk" diff-apply-hunk t]
174 ["Test applying hunk" diff-test-hunk t] 177 ["Test applying hunk" diff-test-hunk t]
175 ["Apply diff with Ediff" diff-ediff-patch t] 178 ["Apply diff with Ediff" diff-ediff-patch t]
176 ["Create Change Log" diff-create-changelog 179 ["Create Change Log entries" diff-add-change-log-entries-other-window
177 :help "Create ChangeLog entries for the changes in the diff buffer"] 180 :help "Create ChangeLog entries for the changes in the diff buffer"]
178 "-----" 181 "-----"
179 ["Reverse direction" diff-reverse-direction t] 182 ["Reverse direction" diff-reverse-direction t]
@@ -1729,8 +1732,9 @@ For use in `add-log-current-defun-function'."
1729 props 'diff-refine-preproc)))))))) 1732 props 'diff-refine-preproc))))))))
1730 1733
1731 1734
1732(defun diff-create-changelog () 1735(defun diff-add-change-log-entries-other-window ()
1733 "Iterate through the current diff and create ChangeLog entries." 1736 "Iterate through the current diff and create ChangeLog entries.
1737I.e. like `add-change-log-entry-other-window' but applied to all hunks."
1734 (interactive) 1738 (interactive)
1735 ;; XXX: Currently add-change-log-entry-other-window is only called 1739 ;; XXX: Currently add-change-log-entry-other-window is only called
1736 ;; once per hunk. Some hunks have multiple changes, it would be 1740 ;; once per hunk. Some hunks have multiple changes, it would be
@@ -1741,21 +1745,18 @@ For use in `add-log-current-defun-function'."
1741 (condition-case nil 1745 (condition-case nil
1742 ;; Call add-change-log-entry-other-window for each hunk in 1746 ;; Call add-change-log-entry-other-window for each hunk in
1743 ;; the diff buffer. 1747 ;; the diff buffer.
1744 (while t 1748 (while (progn
1745 (set-buffer orig-buffer) 1749 (diff-hunk-next)
1746 (diff-hunk-next) 1750 ;; Move to where the changes are,
1747 (beginning-of-line) 1751 ;; `add-change-log-entry-other-window' works better in
1748 (while (not (looking-at "^ ")) 1752 ;; that case.
1749 (forward-line 1)) 1753 (re-search-forward "\n[!+-<>]" nil t))
1750 ;; Move to where the changes are, 1754 (save-excursion
1751 ;; `add-change-log-entry-other-window' works better in 1755 (add-change-log-entry-other-window)
1752 ;; that case. 1756 ;; Insert a "." so that the entries created don't get
1753 (while (not (looking-at "^[!+-]")) 1757 ;; merged.
1754 (forward-line 1)) 1758 (insert ".")))
1755 (add-change-log-entry-other-window) 1759 ;; When there's no more hunks, diff-hunk-next signals an error.
1756 ;; Insert a "." so that the entries created don't get
1757 ;; merged.
1758 (insert "."))
1759 (error nil))))) 1760 (error nil)))))
1760 1761
1761;; provide the package 1762;; provide the package