unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36895: Patch in dired-guess-shell-alist-default
@ 2019-08-01 21:42 Juri Linkov
  2019-08-02  6:59 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2019-08-01 21:42 UTC (permalink / raw)
  To: 36895

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

Tags: patch

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


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

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#36895: Patch in dired-guess-shell-alist-default
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-08-02  6:59 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 36895

> From: Juri Linkov <juri@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#36895: Patch in dired-guess-shell-alist-default
  2019-08-02  6:59 ` Eli Zaretskii
@ 2019-08-03 22:16   ` Juri Linkov
  2019-08-04 16:47     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2019-08-03 22:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36895

[-- 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")))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#36895: Patch in dired-guess-shell-alist-default
  2019-08-03 22:16   ` Juri Linkov
@ 2019-08-04 16:47     ` Eli Zaretskii
  2019-08-05 21:04       ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-08-04 16:47 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 36895

> From: Juri Linkov <juri@linkov.net>
> Cc: 36895@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#36895: Patch in dired-guess-shell-alist-default
  2019-08-04 16:47     ` Eli Zaretskii
@ 2019-08-05 21:04       ` Juri Linkov
  0 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2019-08-05 21:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36895-done

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-05 21:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2019-08-04 16:47     ` Eli Zaretskii
2019-08-05 21:04       ` Juri Linkov

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).