Good question. This feels like it should be standard. With a little digging into the code and experimenting,
this seems at first glance to work:
From the ediff control window:
- M-:
(setq ediff-word-mode t)
RET
- ! to run
ediff-update-diffs
Which we can encapsulate in a command (which I've bound to . in the ediff control buffer) like so:
(defun my-ediff-toggle-word-mode ()
"Toggle between linewise and wordwise comparisons."
(interactive)
(setq ediff-word-mode (not ediff-word-mode))
(ediff-update-diffs))
(add-hook 'ediff-startup-hook #'my-ediff-startup-hook)
(defun my-ediff-startup-hook ()
"Custom `ediff-startup-hook' behaviours."
(define-key ediff-mode-map (kbd ".") #'my-ediff-toggle-word-mode))
Note that ediff-word-mode
disables refinements, so you would need to use @ to restore that (if desired) after toggling back to linewise diffs.
If you don't experience any issues with this (let me know), then I think this should be a feature-request (M-x report-emacs-bug
).