]> git.eshelyaron.com Git - emacs.git/commitdiff
ediff-current-file: New optional startup-hooks arg
authorPaul D. Nelson <ultrono@gmail.com>
Mon, 31 Mar 2025 07:07:07 +0000 (09:07 +0200)
committerEshel Yaron <me@eshelyaron.com>
Tue, 8 Apr 2025 05:41:34 +0000 (07:41 +0200)
* 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

index 36580c73d6ba5d935acde19ad38486eeeafdc624..bc89b2025ff3aa09a07b33c44c0a73bd31cdb203 100644 (file)
@@ -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