]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/dired-x.el (dired-guess-shell-alist-default): Use git when possible.
authorJuri Linkov <juri@linkov.net>
Mon, 5 Aug 2019 21:04:07 +0000 (00:04 +0300)
committerJuri Linkov <juri@linkov.net>
Mon, 5 Aug 2019 21:04:07 +0000 (00:04 +0300)
Check for Git backend and provide "git apply" for patch files (bug#36895).

lisp/dired-x.el

index 462fa4ee15296d86f60ba79ffec1c22b565a7fa9..313a22725c798d06ece2c743e5f8f85bef791854 100644 (file)
@@ -827,6 +827,7 @@ Also useful for `auto-mode-alist' like this:
 ;; install GNU zip's version of zcat.
 
 (autoload 'Man-support-local-filenames "man")
+(autoload 'vc-responsible-backend "vc")
 
 (defvar dired-guess-shell-alist-default
   (list
@@ -909,7 +910,10 @@ Also useful for `auto-mode-alist' like this:
         '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
                  " " dired-guess-shell-znew-switches))
 
-   '("\\.patch\\'" "cat * | patch")
+   (list "\\.patch\\'"
+         '(if (eq (ignore-errors (vc-responsible-backend default-directory)) 'Git)
+              "cat * | git apply"
+            "cat * | patch"))
    (list "\\.patch\\.g?z\\'" "gunzip -qc * | patch"
         ;; Optional decompression.
         '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))