From c815f3578cef2a2fde113dc637f1107a19b075ac Mon Sep 17 00:00:00 2001 From: "Paul D. Nelson" Date: Mon, 31 Mar 2025 09:07:07 +0200 Subject: [PATCH] ediff-current-file: New optional startup-hooks arg * lisp/vc/ediff.el (ediff-current-file): Add optional startup-hooks argument, so that the user can write wrapper commands with more finely customized behavior (bug#77323). (cherry picked from commit 2bced74aa9735d9a9a5cb00aedfcac72d54f5d50) --- lisp/vc/ediff.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index 36580c73d6b..bc89b2025ff 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -360,10 +360,13 @@ has been saved (if not in `buffer-file-name')." (defalias 'ediff #'ediff-files) ;;;###autoload -(defun ediff-current-file () +(defun ediff-current-file (&optional startup-hooks) "Start ediff between current buffer and its file on disk. This command can be used instead of `revert-buffer'. If there is -nothing to revert then this command fails." +nothing to revert then this command fails. + +Non-interactively, STARTUP-HOOKS is a list of functions that Emacs calls +without arguments after setting up the Ediff buffers." (interactive) ;; This duplicates code from menu-bar.el. (unless (or (not (eq revert-buffer-function 'revert-buffer--default)) @@ -395,7 +398,7 @@ nothing to revert then this command fails." (insert-file-contents file-name) ;; Assume same modes: (funcall current-major)) - (ediff-buffers revert-buf (current-buffer)))) + (ediff-buffers revert-buf (current-buffer) startup-hooks))) ;;;###autoload -- 2.39.5