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.
This commit is contained in:
parent
9ab85f087f
commit
8709aaddd8
2 changed files with 40 additions and 35 deletions
|
@ -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).
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue