bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36895: Patch in dired-guess-shell-alist-default


From: Juri Linkov
Subject: bug#36895: Patch in dired-guess-shell-alist-default
Date: Sun, 04 Aug 2019 01:16:06 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> Isn't "git apply" used more often nowadays than "patch"?
>
> No, not here.  "git apply" is only relevant for when working in a Git
> repository.
>
> We could perhaps make this customizable, or maybe even make Emacs
> intuit the right command looking at the current buffer, though.

Yes, this would be more appropriate:

diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 462fa4ee15..313a22725c 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -827,6 +827,7 @@ dired-shell-command-history
 ;; 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 @@ dired-guess-shell-alist-default
         '(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")))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]