branch: externals/vc-jj commit db664ff18991f6bc0a4ce01b19e9f22514b65f70 Author: Rudi Schlatte <r...@constantly.at> Commit: Rudi Schlatte <r...@constantly.at>
Ensure log-edit-callback is bound to something meaningful Make sure `log-edit-done` behaves properly also when the user calls `jj describe` from a terminal. Fixes #83 --- NEWS.org | 4 ++++ vc-jj.el | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/NEWS.org b/NEWS.org index 98d3c72460..8ff9e0fcef 100644 --- a/NEWS.org +++ b/NEWS.org @@ -31,6 +31,10 @@ =vc-find-revision=, like =vc-revision-other-window=, now do not error. - Identify the "removed" vc file state. Previously, removed files would be incorrectly labeled as "ignored." +- vc-jj now sets up =log-edit-callback= so =log-edit-done= works properly + when editing =.jjdescription= files. This makes Emacs work properly + as external editor when calling =jj commit= or similar from the + terminal. ** [[https://codeberg.org/emacs-jj-vc/vc-jj.el/compare/v0.2...v0.3][0.3]] - 2025-06-15 diff --git a/vc-jj.el b/vc-jj.el index 3bb1163e6e..54e007d7a2 100644 --- a/vc-jj.el +++ b/vc-jj.el @@ -844,6 +844,16 @@ the command to run, e.g., the semi-standard \"jj git push -c @-\"." ;;;###autoload (add-to-list 'auto-mode-alist '("\\.jjdescription\\'" . log-edit-mode)) +;;;###autoload +(add-hook 'vc-log-mode-hook #'vc-jj-ensure-log-edit-callback) +;;;###autoload +(defun vc-jj-ensure-log-edit-callback () + "Set up `log-edit-callback' when editing jj commit messages." + (unless log-edit-callback + (setq-local log-edit-callback (lambda () + (interactive) + (save-buffer) + (kill-buffer))))) (provide 'vc-jj) ;;; vc-jj.el ends here