Mercurial > emacs
changeset 91528:bc2ac468b977
(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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 05 Feb 2008 02:14:10 +0000 |
parents | 1c3159ee43ab |
children | 54941ca420b8 |
files | lisp/ChangeLog lisp/diff-mode.el |
diffstat | 2 files changed, 27 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Feb 05 01:39:59 2008 +0000 +++ b/lisp/ChangeLog Tue Feb 05 02:14:10 2008 +0000 @@ -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> * diff-mode.el: Add new TODO entry.
--- a/lisp/diff-mode.el Tue Feb 05 01:39:59 2008 +0000 +++ b/lisp/diff-mode.el Tue Feb 05 02:14:10 2008 +0000 @@ -39,7 +39,8 @@ ;; 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. ;; Also allow C-c C-a to delete already-applied hunks. @@ -151,6 +152,8 @@ `(("\e" . ,diff-mode-shared-map) ;; From compilation-minor-mode. ("\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. ("\C-c\C-a" . diff-apply-hunk) ("\C-c\C-e" . diff-ediff-patch) @@ -173,7 +176,7 @@ ["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 + ["Create Change Log entries" diff-add-change-log-entries-other-window :help "Create ChangeLog entries for the changes in the diff buffer"] "-----" ["Reverse direction" diff-reverse-direction t] @@ -1729,8 +1732,9 @@ props 'diff-refine-preproc)))))))) -(defun diff-create-changelog () - "Iterate through the current diff and create ChangeLog entries." +(defun diff-add-change-log-entries-other-window () + "Iterate through the current diff and create ChangeLog entries. +I.e. like `add-change-log-entry-other-window' but applied to all hunks." (interactive) ;; XXX: Currently add-change-log-entry-other-window is only called ;; once per hunk. Some hunks have multiple changes, it would be @@ -1741,21 +1745,18 @@ (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 ".")) + (while (progn + (diff-hunk-next) + ;; Move to where the changes are, + ;; `add-change-log-entry-other-window' works better in + ;; that case. + (re-search-forward "\n[!+-<>]" nil t)) + (save-excursion + (add-change-log-entry-other-window) + ;; Insert a "." so that the entries created don't get + ;; merged. + (insert "."))) + ;; When there's no more hunks, diff-hunk-next signals an error. (error nil))))) ;; provide the package