diff options
| author | Noam Postavsky | 2020-03-20 06:00:11 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2020-03-22 23:06:31 -0400 |
| commit | 8709aaddd8707c9eafb359f9ec824e4bc109bbc6 (patch) | |
| tree | 899e70ed928ec78656ea655db00cc9b6f5487c98 /lisp | |
| parent | 9ab85f087f7db38168dcf07d24f51ecd2c583f8a (diff) | |
| download | emacs-8709aaddd8707c9eafb359f9ec824e4bc109bbc6.tar.gz emacs-8709aaddd8707c9eafb359f9ec824e4bc109bbc6.zip | |
Fix a couple of problems in changelog generating functions
* lisp/vc/diff-mode.el (diff-add-log-current-defuns): If there is a
scan-error when calling end-of-defun, go to end of hunk. This can
easily happen since we are calling end-of-defun on a partial code
fragment from a diff.
* lisp/vc/log-edit.el (log-edit-generate-changelog-from-diff): Bind
display-buffer-overriding-action around the log-edit-show-diff call
only. Otherwise, it can affect, for example, debugger windows
triggered by the diff-add-log-current-defuns call.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/vc/diff-mode.el | 49 | ||||
| -rw-r--r-- | lisp/vc/log-edit.el | 26 |
2 files changed, 40 insertions, 35 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index d61c363c821..8171a585158 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el | |||
| @@ -2247,29 +2247,32 @@ The elements of the alist are of the form (FILE . (DEFUN...)), | |||
| 2247 | where DEFUN... is a list of function names found in FILE." | 2247 | where DEFUN... is a list of function names found in FILE." |
| 2248 | (save-excursion | 2248 | (save-excursion |
| 2249 | (goto-char (point-min)) | 2249 | (goto-char (point-min)) |
| 2250 | (let ((defuns nil) | 2250 | (let* ((defuns nil) |
| 2251 | (hunk-end nil) | 2251 | (hunk-end nil) |
| 2252 | (hunk-mismatch-files nil) | 2252 | (hunk-mismatch-files nil) |
| 2253 | (make-defun-context-follower | 2253 | (make-defun-context-follower |
| 2254 | (lambda (goline) | 2254 | (lambda (goline) |
| 2255 | (let ((eodefun nil) | 2255 | (let ((eodefun nil) |
| 2256 | (defname nil)) | 2256 | (defname nil)) |
| 2257 | (list | 2257 | (list |
| 2258 | (lambda () ;; Check for end of current defun. | 2258 | (lambda () ;; Check for end of current defun. |
| 2259 | (when (and eodefun | 2259 | (when (and eodefun |
| 2260 | (funcall goline) | 2260 | (funcall goline) |
| 2261 | (>= (point) eodefun)) | 2261 | (>= (point) eodefun)) |
| 2262 | (setq defname nil) | 2262 | (setq defname nil) |
| 2263 | (setq eodefun nil))) | 2263 | (setq eodefun nil))) |
| 2264 | (lambda (&optional get-current) ;; Check for new defun. | 2264 | (lambda (&optional get-current) ;; Check for new defun. |
| 2265 | (if get-current | 2265 | (if get-current |
| 2266 | defname | 2266 | defname |
| 2267 | (when-let* ((def (and (not eodefun) | 2267 | (when-let* ((def (and (not eodefun) |
| 2268 | (funcall goline) | 2268 | (funcall goline) |
| 2269 | (add-log-current-defun))) | 2269 | (add-log-current-defun))) |
| 2270 | (eof (save-excursion (end-of-defun) (point)))) | 2270 | (eof (save-excursion |
| 2271 | (setq eodefun eof) | 2271 | (condition-case () |
| 2272 | (setq defname def))))))))) | 2272 | (progn (end-of-defun) (point)) |
| 2273 | (scan-error hunk-end))))) | ||
| 2274 | (setq eodefun eof) | ||
| 2275 | (setq defname def))))))))) | ||
| 2273 | (while | 2276 | (while |
| 2274 | ;; Might need to skip over file headers between diff | 2277 | ;; Might need to skip over file headers between diff |
| 2275 | ;; hunks (e.g., "diff --git ..." etc). | 2278 | ;; hunks (e.g., "diff --git ..." etc). |
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 8b6168835f0..d5d46147cf7 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el | |||
| @@ -788,18 +788,20 @@ This command will generate a ChangeLog entries listing the | |||
| 788 | functions. You can then add a description where needed, and use | 788 | functions. You can then add a description where needed, and use |
| 789 | \\[fill-paragraph] to join consecutive function names." | 789 | \\[fill-paragraph] to join consecutive function names." |
| 790 | (interactive) | 790 | (interactive) |
| 791 | (let* ((diff-buf nil) | 791 | (change-log-insert-entries |
| 792 | ;; Unfortunately, `log-edit-show-diff' doesn't have a NO-SHOW | 792 | (with-current-buffer |
| 793 | ;; option, so we try to work around it via display-buffer | 793 | (let* ((diff-buf nil) |
| 794 | ;; machinery. | 794 | ;; Unfortunately, `log-edit-show-diff' doesn't have a |
| 795 | (display-buffer-overriding-action | 795 | ;; NO-SHOW option, so we try to work around it via |
| 796 | `(,(lambda (buf alist) | 796 | ;; display-buffer machinery. |
| 797 | (setq diff-buf buf) | 797 | (display-buffer-overriding-action |
| 798 | (display-buffer-no-window buf alist)) | 798 | `(,(lambda (buf alist) |
| 799 | . ((allow-no-window . t))))) | 799 | (setq diff-buf buf) |
| 800 | (change-log-insert-entries | 800 | (display-buffer-no-window buf alist)) |
| 801 | (with-current-buffer (progn (log-edit-show-diff) diff-buf) | 801 | . ((allow-no-window . t))))) |
| 802 | (diff-add-log-current-defuns))))) | 802 | (log-edit-show-diff) |
| 803 | diff-buf) | ||
| 804 | (diff-add-log-current-defuns)))) | ||
| 803 | 805 | ||
| 804 | (defun log-edit-insert-changelog (&optional use-first) | 806 | (defun log-edit-insert-changelog (&optional use-first) |
| 805 | "Insert a log message by looking at the ChangeLog. | 807 | "Insert a log message by looking at the ChangeLog. |