From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#36895: Patch in dired-guess-shell-alist-default Date: Sun, 04 Aug 2019 01:16:06 +0300 Organization: LINKOV.NET Message-ID: <87pnlluc7t.fsf@mail.linkov.net> References: <87wofwva5j.fsf@mail.linkov.net> <837e7wgii9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="50025"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 36895@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 04 00:34:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hu2bR-000CsM-GW for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Aug 2019 00:34:17 +0200 Original-Received: from localhost ([::1]:42262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hu2bQ-0006LO-Br for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 18:34:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36634) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hu2bD-00069I-Ta for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 18:34:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hu2bC-0000J6-WB for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 18:34:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hu2bC-0000Iz-TI for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 18:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hu2bC-0003cQ-PR for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 18:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 22:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36895 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36895-submit@debbugs.gnu.org id=B36895.156487163413876 (code B ref 36895); Sat, 03 Aug 2019 22:34:02 +0000 Original-Received: (at 36895) by debbugs.gnu.org; 3 Aug 2019 22:33:54 +0000 Original-Received: from localhost ([127.0.0.1]:60172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu2b3-0003bj-Rr for submit@debbugs.gnu.org; Sat, 03 Aug 2019 18:33:54 -0400 Original-Received: from egyptian.birch.relay.mailchannels.net ([23.83.209.56]:49600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu2b0-0003ba-SY for 36895@debbugs.gnu.org; Sat, 03 Aug 2019 18:33:52 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id A77071A11D9; Sat, 3 Aug 2019 22:33:49 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a75.g.dreamhost.com (100-96-11-214.trex.outbound.svc.cluster.local [100.96.11.214]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3350D1A1564; Sat, 3 Aug 2019 22:33:49 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a75.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.5); Sat, 03 Aug 2019 22:33:49 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Troubled-Fearful: 70126afb777dfcf0_1564871629482_1515368090 X-MC-Loop-Signature: 1564871629482:2012539524 X-MC-Ingress-Time: 1564871629481 Original-Received: from pdx1-sub0-mail-a75.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a75.g.dreamhost.com (Postfix) with ESMTP id F07457FED2; Sat, 3 Aug 2019 15:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=fqsU9HHQa/s4nHTzPSHMnxBI8Lw=; b= PB62tvcpahRqgV1Wk1964PceRFJei3CT7g1pefMSnkbYPfJQNChTRTqM+y0m24Zc 6ZdwdON5Wyr/QIvA/ncGUU0fNqyOnW7hcFptrDIDwEXh9C2BtILTNwRk4xQxn49N GW81NYV+caq6a9EUeIt8T744VjAQs0vbvCWHmYTnujQ= Original-Received: from mail.jurta.org (m91-129-103-76.cust.tele2.ee [91.129.103.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a75.g.dreamhost.com (Postfix) with ESMTPSA id 60D0C7F0F9; Sat, 3 Aug 2019 15:33:41 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a75 In-Reply-To: <837e7wgii9.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 02 Aug 2019 09:59:26 +0300") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddruddtfedgtdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdefrdejieenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdefrdejiedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164507 Archived-At: --=-=-= Content-Type: text/plain >> 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dired-guess-shell-alist-default.2.patch 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"))) --=-=-=--