GNU bug report logs - #36895
Patch in dired-guess-shell-alist-default

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 1 Aug 2019 21:47:03 UTC

Severity: normal

Tags: patch

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36895 in the body.
You can then email your comments to 36895 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36895; Package emacs. (Thu, 01 Aug 2019 21:47:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 01 Aug 2019 21:47:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Patch in dired-guess-shell-alist-default
Date: Fri, 02 Aug 2019 00:42:32 +0300
[Message part 1 (text/plain, inline)]
Tags: patch

Isn't "git apply" used more often nowadays than "patch"?
If yes, then I propose this patch:

[dired-guess-shell-alist-default.patch (text/x-diff, inline)]
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 462fa4ee15..3b3c0aeaf3 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -909,11 +909,11 @@ dired-guess-shell-alist-default
 	 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
 		  " " dired-guess-shell-znew-switches))
 
-   '("\\.patch\\'" "cat * | patch")
-   (list "\\.patch\\.g?z\\'" "gunzip -qc * | patch"
+   '("\\.patch\\'" "cat * | patch" "cat * | git apply")
+   (list "\\.patch\\.g?z\\'" "gunzip -qc * | patch" "gunzip -qc * | git apply"
 	 ;; Optional decompression.
 	 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
-   (list "\\.patch\\.Z\\'" "zcat * | patch"
+   (list "\\.patch\\.Z\\'" "zcat * | patch" "zcat * | git apply"
 	 ;; Optional conversion to gzip format.
 	 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
 		  " " dired-guess-shell-znew-switches))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36895; Package emacs. (Fri, 02 Aug 2019 07:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 36895 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36895 <at> debbugs.gnu.org
Subject: Re: bug#36895: Patch in dired-guess-shell-alist-default
Date: Fri, 02 Aug 2019 09:59:26 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Date: Fri, 02 Aug 2019 00:42:32 +0300
> 
> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36895; Package emacs. (Sat, 03 Aug 2019 22:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 36895 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 36895 <at> debbugs.gnu.org
Subject: Re: bug#36895: Patch in dired-guess-shell-alist-default
Date: Sun, 04 Aug 2019 01:16:06 +0300
[Message part 1 (text/plain, inline)]
>> 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:

[dired-guess-shell-alist-default.2.patch (text/x-diff, inline)]
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")))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36895; Package emacs. (Sun, 04 Aug 2019 16:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 36895 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36895 <at> debbugs.gnu.org
Subject: Re: bug#36895: Patch in dired-guess-shell-alist-default
Date: Sun, 04 Aug 2019 19:47:19 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: 36895 <at> debbugs.gnu.org
> Date: Sun, 04 Aug 2019 01:16:06 +0300
> 
> >> 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:

Thanks, LGTM.




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Mon, 05 Aug 2019 21:19:03 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Mon, 05 Aug 2019 21:19:03 GMT) Full text and rfc822 format available.

Message #19 received at 36895-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 36895-done <at> debbugs.gnu.org
Subject: Re: bug#36895: Patch in dired-guess-shell-alist-default
Date: Tue, 06 Aug 2019 00:04:40 +0300
>> >> 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:
>
> Thanks, LGTM.

Pushed to master and closed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 Sep 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.