GNU bug report logs -
#41779
Fall back between vc-diff and diff-backup
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 9 Jun 2020 23:40:02 UTC
Severity: normal
Tags: patch, wontfix
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
tags 41779 wontfix
close 41779 28.0.50
quit
>> But I don't insist on this feature, I can handle this in my init file.
>> I proposed it as a patch only because Lars mentioned the same problem.
>
> I think my suggestion is not significantly worse or more awkward to use.
It seems my request was too specific, so I retract it.
It's easy to achieve this fallback in the init file with:
(advice-add 'diff-backup :around
(lambda (orig-fun file &optional switches)
(condition-case err
(funcall orig-fun file switches)
(error
;; Fall back to vc-diff
(if (vc-backend file)
(let ((vc-diff-switches switches))
(require 'vc)
(vc-diff-internal
t (list (vc-backend file) (list file)) nil nil t))
(error (cadr err))))))
'((name . diff-backup-fallback-to-vc-diff)))
(advice-add 'vc-diff :around
(lambda (orig-fun &rest args)
(if (vc-deduce-backend)
(apply orig-fun args)
;; Fall back to non-vc diff-backup
(diff-backup (if (derived-mode-p 'dired-mode)
(dired-get-filename)
buffer-file-name)
vc-diff-switches)))
'((name . vc-diff-fallback-to-diff-backup)))
This bug report was last modified 4 years and 332 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.