(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.
This commit is contained in:
Stefan Monnier 2008-02-05 02:14:10 +00:00
parent 76b071b197
commit 8330c1755e
2 changed files with 27 additions and 19 deletions

View file

@ -1,3 +1,10 @@
2008-02-05 Stefan Monnier <monnier@iro.umontreal.ca>
* diff-mode.el (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.
2008-02-04 Dan Nicolaescu <dann@ics.uci.edu> 2008-02-04 Dan Nicolaescu <dann@ics.uci.edu>
* diff-mode.el: Add new TODO entry. * diff-mode.el: Add new TODO entry.

View file

@ -39,7 +39,8 @@
;; Todo: ;; Todo:
;; - Improve `diff-create-changelog', it is very simplistic now. ;; - Improve `diff-add-change-log-entries-other-window',
;; it is very simplistic now.
;; ;;
;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks. ;; - Add a `delete-after-apply' so C-c C-a automatically deletes hunks.
;; Also allow C-c C-a to delete already-applied hunks. ;; Also allow C-c C-a to delete already-applied hunks.
@ -151,6 +152,8 @@ when editing big diffs)."
`(("\e" . ,diff-mode-shared-map) `(("\e" . ,diff-mode-shared-map)
;; From compilation-minor-mode. ;; From compilation-minor-mode.
("\C-c\C-c" . diff-goto-source) ("\C-c\C-c" . diff-goto-source)
;; By analogy with the global C-x 4 a binding.
("\C-x4A" . diff-add-change-log-entries-other-window)
;; Misc operations. ;; Misc operations.
("\C-c\C-a" . diff-apply-hunk) ("\C-c\C-a" . diff-apply-hunk)
("\C-c\C-e" . diff-ediff-patch) ("\C-c\C-e" . diff-ediff-patch)
@ -173,7 +176,7 @@ when editing big diffs)."
["Apply hunk" diff-apply-hunk t] ["Apply hunk" diff-apply-hunk t]
["Test applying hunk" diff-test-hunk t] ["Test applying hunk" diff-test-hunk t]
["Apply diff with Ediff" diff-ediff-patch t] ["Apply diff with Ediff" diff-ediff-patch t]
["Create Change Log" diff-create-changelog ["Create Change Log entries" diff-add-change-log-entries-other-window
:help "Create ChangeLog entries for the changes in the diff buffer"] :help "Create ChangeLog entries for the changes in the diff buffer"]
"-----" "-----"
["Reverse direction" diff-reverse-direction t] ["Reverse direction" diff-reverse-direction t]
@ -1729,8 +1732,9 @@ For use in `add-log-current-defun-function'."
props 'diff-refine-preproc)))))))) props 'diff-refine-preproc))))))))
(defun diff-create-changelog () (defun diff-add-change-log-entries-other-window ()
"Iterate through the current diff and create ChangeLog entries." "Iterate through the current diff and create ChangeLog entries.
I.e. like `add-change-log-entry-other-window' but applied to all hunks."
(interactive) (interactive)
;; XXX: Currently add-change-log-entry-other-window is only called ;; XXX: Currently add-change-log-entry-other-window is only called
;; once per hunk. Some hunks have multiple changes, it would be ;; once per hunk. Some hunks have multiple changes, it would be
@ -1741,21 +1745,18 @@ For use in `add-log-current-defun-function'."
(condition-case nil (condition-case nil
;; Call add-change-log-entry-other-window for each hunk in ;; Call add-change-log-entry-other-window for each hunk in
;; the diff buffer. ;; the diff buffer.
(while t (while (progn
(set-buffer orig-buffer) (diff-hunk-next)
(diff-hunk-next) ;; Move to where the changes are,
(beginning-of-line) ;; `add-change-log-entry-other-window' works better in
(while (not (looking-at "^ ")) ;; that case.
(forward-line 1)) (re-search-forward "\n[!+-<>]" nil t))
;; Move to where the changes are, (save-excursion
;; `add-change-log-entry-other-window' works better in (add-change-log-entry-other-window)
;; that case. ;; Insert a "." so that the entries created don't get
(while (not (looking-at "^[!+-]")) ;; merged.
(forward-line 1)) (insert ".")))
(add-change-log-entry-other-window) ;; When there's no more hunks, diff-hunk-next signals an error.
;; Insert a "." so that the entries created don't get
;; merged.
(insert "."))
(error nil))))) (error nil)))))
;; provide the package ;; provide the package