unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 36895@debbugs.gnu.org
Subject: bug#36895: Patch in dired-guess-shell-alist-default
Date: Sun, 04 Aug 2019 01:16:06 +0300	[thread overview]
Message-ID: <87pnlluc7t.fsf@mail.linkov.net> (raw)
In-Reply-To: <837e7wgii9.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 02 Aug 2019 09:59:26 +0300")

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dired-guess-shell-alist-default.2.patch --]
[-- Type: text/x-diff, Size: 870 bytes --]

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	other threads:[~2019-08-03 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 21:42 bug#36895: Patch in dired-guess-shell-alist-default Juri Linkov
2019-08-02  6:59 ` Eli Zaretskii
2019-08-03 22:16   ` Juri Linkov [this message]
2019-08-04 16:47     ` Eli Zaretskii
2019-08-05 21:04       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnlluc7t.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=36895@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).