[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 8709aad 2/3: Fix a couple of problems in changelog generating f
From: |
Noam Postavsky |
Subject: |
emacs-27 8709aad 2/3: Fix a couple of problems in changelog generating functions |
Date: |
Sun, 22 Mar 2020 23:13:45 -0400 (EDT) |
branch: emacs-27
commit 8709aaddd8707c9eafb359f9ec824e4bc109bbc6
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
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.
---
lisp/vc/diff-mode.el | 49 ++++++++++++++++++++++++++-----------------------
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 d61c363..8171a58 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...)),
where DEFUN... is a list of function names found in FILE."
(save-excursion
(goto-char (point-min))
- (let ((defuns nil)
- (hunk-end nil)
- (hunk-mismatch-files nil)
- (make-defun-context-follower
- (lambda (goline)
- (let ((eodefun nil)
- (defname nil))
- (list
- (lambda () ;; Check for end of current defun.
- (when (and eodefun
- (funcall goline)
- (>= (point) eodefun))
- (setq defname nil)
- (setq eodefun nil)))
- (lambda (&optional get-current) ;; Check for new defun.
- (if get-current
- defname
- (when-let* ((def (and (not eodefun)
- (funcall goline)
- (add-log-current-defun)))
- (eof (save-excursion (end-of-defun) (point))))
- (setq eodefun eof)
- (setq defname def)))))))))
+ (let* ((defuns nil)
+ (hunk-end nil)
+ (hunk-mismatch-files nil)
+ (make-defun-context-follower
+ (lambda (goline)
+ (let ((eodefun nil)
+ (defname nil))
+ (list
+ (lambda () ;; Check for end of current defun.
+ (when (and eodefun
+ (funcall goline)
+ (>= (point) eodefun))
+ (setq defname nil)
+ (setq eodefun nil)))
+ (lambda (&optional get-current) ;; Check for new defun.
+ (if get-current
+ defname
+ (when-let* ((def (and (not eodefun)
+ (funcall goline)
+ (add-log-current-defun)))
+ (eof (save-excursion
+ (condition-case ()
+ (progn (end-of-defun) (point))
+ (scan-error hunk-end)))))
+ (setq eodefun eof)
+ (setq defname def)))))))))
(while
;; Might need to skip over file headers between diff
;; hunks (e.g., "diff --git ..." etc).
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 8b61688..d5d4614 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
functions. You can then add a description where needed, and use
\\[fill-paragraph] to join consecutive function names."
(interactive)
- (let* ((diff-buf nil)
- ;; Unfortunately, `log-edit-show-diff' doesn't have a NO-SHOW
- ;; option, so we try to work around it via display-buffer
- ;; machinery.
- (display-buffer-overriding-action
- `(,(lambda (buf alist)
- (setq diff-buf buf)
- (display-buffer-no-window buf alist))
- . ((allow-no-window . t)))))
- (change-log-insert-entries
- (with-current-buffer (progn (log-edit-show-diff) diff-buf)
- (diff-add-log-current-defuns)))))
+ (change-log-insert-entries
+ (with-current-buffer
+ (let* ((diff-buf nil)
+ ;; Unfortunately, `log-edit-show-diff' doesn't have a
+ ;; NO-SHOW option, so we try to work around it via
+ ;; display-buffer machinery.
+ (display-buffer-overriding-action
+ `(,(lambda (buf alist)
+ (setq diff-buf buf)
+ (display-buffer-no-window buf alist))
+ . ((allow-no-window . t)))))
+ (log-edit-show-diff)
+ diff-buf)
+ (diff-add-log-current-defuns))))
(defun log-edit-insert-changelog (&optional use-first)
"Insert a log message by looking at the ChangeLog.