all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to apply (multi file) patches conveniently
@ 2017-02-06 12:13 Michael Heerdegen
  2017-02-06 15:49 ` Eli Zaretskii
  2017-02-07 14:25 ` Stefan Monnier
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-06 12:13 UTC (permalink / raw)
  To: Emacs mailing list

Hi,

I wonder how a convenient way to apply multi-file patches like they are
posted in emacs-devel or emacs-bug looks like.

Most of the time I first save the patch into a file and try to let git
apply it.  I do that with Magit (w w).  But in 50% of the cases I just
get a message like

128 git … am --3way -- /home/micha/isearch.patch
Patch format detection failed.

Though the patch looks normal to me (what could I'm being doing wrong?
in 50% of the cases it works as expected, and I don't see that I'm doing
something differently in these cases).

Since the documentation of git is not really... cool, I tried to find a
reliable tool in `epatch'.  But it's a total mess.  Consider I have a
patch with a skeleton that looks like this:

 doc/misc/cl.texi                     |   4 +-
 etc/NEWS                             |   4 +
 lisp/emacs-lisp/cl-seq.el            | 355 +++++++++++++++++++++--------------
 test/lisp/emacs-lisp/cl-seq-tests.el |  90 +++++++++
 4 files changed, 307 insertions(+), 146 deletions(-)

diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index 8baa0bd88c..6f387f5cbb 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
....

--- a/etc/NEWS
+++ b/etc/NEWS
....

--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
...

I call `epatch', then I'm asked for a directory to which the multi-file
patch should be applied to.  I'm specifying the name of the root of the
emacs repository, in my case, "/home/micha/software/emacs".

Epatch should be able to DTRT with this information.  But instead, it
apparently searches all files in this directory, for example, it
searches "cl.texi" in "/home/micha/software/emacs/" instead of
"/home/micha/software/emacs/doc/misc/" as expected.  As a result, I'm
prompted once for the location of every single file.  When I happen to
make a typo, like specifying "cl-seq.elc" instead of "cl-seq.el", the
whole session gets worthless and I can start anew from the beginning.

That looks like a bug to me, but why doesn't anyone else complain about
this - am I doing something wrong?


Thanks,

Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-06 12:13 How to apply (multi file) patches conveniently Michael Heerdegen
@ 2017-02-06 15:49 ` Eli Zaretskii
  2017-02-07 16:48   ` Michael Heerdegen
  2017-02-07 19:31   ` Michael Heerdegen
  2017-02-07 14:25 ` Stefan Monnier
  1 sibling, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2017-02-06 15:49 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Mon, 06 Feb 2017 13:13:14 +0100
> 
> I wonder how a convenient way to apply multi-file patches like they are
> posted in emacs-devel or emacs-bug looks like.

I just mark the entire patch in Emacs, then invoke "M-|", and type

  patch -d /the/root/directory/of/the/project -pN

where N should be chosen by counting the slashes that you will want
Patch to remove before looking for files relative to that root
directory.  For patches produced by "git diff" etc., N is typically 1.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-06 12:13 How to apply (multi file) patches conveniently Michael Heerdegen
  2017-02-06 15:49 ` Eli Zaretskii
@ 2017-02-07 14:25 ` Stefan Monnier
  2017-02-07 16:51   ` Michael Heerdegen
  1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2017-02-07 14:25 UTC (permalink / raw)
  To: help-gnu-emacs

> Though the patch looks normal to me (what could I'm being doing wrong?
> in 50% of the cases it works as expected, and I don't see that I'm doing
> something differently in these cases).

Many patches in email are broken by line-wrapping and things like that
(diff-mode has some code to try and undo the damage in some cases, tho
lately it hasn't been very effective).
Not sure if it explains our 50% failure rate, but it's at least a likely
explanation for some of them.


        Stefan




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

* Re: How to apply (multi file) patches conveniently
  2017-02-06 15:49 ` Eli Zaretskii
@ 2017-02-07 16:48   ` Michael Heerdegen
  2017-02-07 17:19     ` Nick Dokos
  2017-02-07 20:23     ` tomas
  2017-02-07 19:31   ` Michael Heerdegen
  1 sibling, 2 replies; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 16:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> I just mark the entire patch in Emacs, then invoke "M-|", and type
>
>   patch -d /the/root/directory/of/the/project -pN
>
> where N should be chosen by counting the slashes that you will want
> Patch to remove before looking for files relative to that root
> directory.  For patches produced by "git diff" etc., N is typically 1.

Ok thanks, then for now, I'll use a little command that is doing that
for me (funnily it seems to be impossible to type M-| with a German
keyboard, not even in X, because you need to hit Meta and AltGr and < at
the same time, and that doesn't generate an event at all).

And I guess epatch just makes nonsense and should be fixed.


Thanks,

Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 14:25 ` Stefan Monnier
@ 2017-02-07 16:51   ` Michael Heerdegen
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 16:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Many patches in email are broken by line-wrapping and things like that
> (diff-mode has some code to try and undo the damage in some cases, tho
> lately it hasn't been very effective).  Not sure if it explains our
> 50% failure rate, but it's at least a likely explanation for some of
> them.

AFAICT I configured Gnus so that it doesn't reformat the message body, I
need to explicitly hit a key to do that.

It's crazy that all people suffer this annoying problem...


Thanks,

Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 16:48   ` Michael Heerdegen
@ 2017-02-07 17:19     ` Nick Dokos
  2017-02-07 17:52       ` Michael Heerdegen
  2017-02-07 20:23     ` tomas
  1 sibling, 1 reply; 20+ messages in thread
From: Nick Dokos @ 2017-02-07 17:19 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> I just mark the entire patch in Emacs, then invoke "M-|", and type
>>
>>   patch -d /the/root/directory/of/the/project -pN
>>
>> where N should be chosen by counting the slashes that you will want
>> Patch to remove before looking for files relative to that root
>> directory.  For patches produced by "git diff" etc., N is typically 1.
>
> Ok thanks, then for now, I'll use a little command that is doing that
> for me (funnily it seems to be impossible to type M-| with a German
> keyboard, not even in X, because you need to hit Meta and AltGr and < at
> the same time, and that doesn't generate an event at all).
>

M-<anything> is a shortcut for ESC-<anything> so you could use the latter form,
as long as you have an ESC key.

-- 
Nick




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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 17:19     ` Nick Dokos
@ 2017-02-07 17:52       ` Michael Heerdegen
  2017-02-07 19:45         ` Nick Dokos
  2017-02-07 22:42         ` Robert Thorpe
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 17:52 UTC (permalink / raw)
  To: Nick Dokos; +Cc: help-gnu-emacs

Nick Dokos <ndokos@gmail.com> writes:

> M-<anything> is a shortcut for ESC-<anything> so you could use the
> latter form, as long as you have an ESC key.

Thanks, that works... yes, we have ESC keys in Germany ;-).


Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-06 15:49 ` Eli Zaretskii
  2017-02-07 16:48   ` Michael Heerdegen
@ 2017-02-07 19:31   ` Michael Heerdegen
  2017-02-07 20:03     ` Eli Zaretskii
  1 sibling, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 19:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> I just mark the entire patch in Emacs, then invoke "M-|", and type
>
>   patch -d /the/root/directory/of/the/project -pN

Btw, like with `epatch', this apparently also works with the complete
buffer contents - seems "patch" is smart enough to DTRT.  Which means,
if I do this from within a command, I can probably avoid letting the
user mark the patch as region.


Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 17:52       ` Michael Heerdegen
@ 2017-02-07 19:45         ` Nick Dokos
  2017-02-07 22:42         ` Robert Thorpe
  1 sibling, 0 replies; 20+ messages in thread
From: Nick Dokos @ 2017-02-07 19:45 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Nick Dokos <ndokos@gmail.com> writes:
>
>> M-<anything> is a shortcut for ESC-<anything> so you could use the
>> latter form, as long as you have an ESC key.
>
> Thanks, that works... yes, we have ESC keys in Germany ;-).
>
>

Not everybody is equally civilized:

  https://9to5mac.com/2016/10/25/remap-escape-key-action-macbook-pro-macos-sierra-10-12-1-modifier-keys/

;-)

-- 
Nick




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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 19:31   ` Michael Heerdegen
@ 2017-02-07 20:03     ` Eli Zaretskii
  2017-02-07 20:22       ` Michael Heerdegen
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2017-02-07 20:03 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 07 Feb 2017 20:31:52 +0100
> 
> > I just mark the entire patch in Emacs, then invoke "M-|", and type
> >
> >   patch -d /the/root/directory/of/the/project -pN
> 
> Btw, like with `epatch', this apparently also works with the complete
> buffer contents - seems "patch" is smart enough to DTRT.  Which means,
> if I do this from within a command, I can probably avoid letting the
> user mark the patch as region.

It depends on what is at the beginning of the buffer, and what is
after the patch itself.  With some text there, Patch could become
utterly confused.  It does know about a typical beginning of an email
message, but buffer contents could be anything...

So I really recommend to mark the patch.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 20:03     ` Eli Zaretskii
@ 2017-02-07 20:22       ` Michael Heerdegen
  2017-02-07 20:42         ` Eli Zaretskii
  2017-02-08  9:48         ` Thien-Thi Nguyen
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 20:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> It depends on what is at the beginning of the buffer, and what is
> after the patch itself.  With some text there, Patch could become
> utterly confused.  It does know about a typical beginning of an email
> message, but buffer contents could be anything...
>
> So I really recommend to mark the patch.

Ok, but can in real-life situations happen things worse then "patch"
saying it could not apply the patch?  Did it ever happen to you that it
applied something wrong?


FWIW, I wrote this:

#+begin_src emacs-lisp
(defun my-gnus-patch-from-article ()
  (interactive)
  (with-current-buffer gnus-article-buffer
    (shell-command-on-region
     (if (use-region-p) (region-beginning) (point-min))
     (if (use-region-p) (region-end)       (point-max))
     (format "patch -d '%s' -p1"
             (let* ((insert-default-directory nil)
                    (input (read-directory-name (format "Dir (default %s): "
                                                        (or source-directory default-directory)))))
               (if (string= input "")
                   (expand-file-name (or source-directory
                   default-directory)) input))))))

(define-key gnus-article-mode-map [?P] #'my-gnus-patch-from-article)
(define-key gnus-summary-mode-map [?P] #'my-gnus-patch-from-article)
#+end_src

so I can mark a region, but don't have to.


Thanks,

Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 16:48   ` Michael Heerdegen
  2017-02-07 17:19     ` Nick Dokos
@ 2017-02-07 20:23     ` tomas
  2017-02-07 20:42       ` Michael Heerdegen
  1 sibling, 1 reply; 20+ messages in thread
From: tomas @ 2017-02-07 20:23 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Feb 07, 2017 at 05:48:05PM +0100, Michael Heerdegen wrote:

[...]

> Ok thanks, then for now, I'll use a little command that is doing that
> for me (funnily it seems to be impossible to type M-| with a German
> keyboard [...]

FWIW it works for me, pc104, german layout, more precisely:

  tomas@rasputin:~$ setxkbmap -print
  xkb_keymap {
          xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
          xkb_types     { include "complete"      };
          xkb_compat    { include "complete"      };
          xkb_symbols   { include "pc+de(legacy)+gr:2+altwin(alt_super_win)+group(shifts_toggle)+compose(caps)+terminate(ctrl_alt_bksp)"   };
          xkb_geometry  { include "pc(pc104)"     };
  };

(I have some funky mappings, like CapsLock to compose, both shifts
simultaneously change to Greek, but that shouldn't influence that.
Meta is left alt)

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAliaLN8ACgkQBcgs9XrR2kbiHACeICaC5hn/iJ/OvIlVK4KVj8m3
kq0An1aikzEqPaPQhz4xMSYBsd2rCgX8
=CtYi
-----END PGP SIGNATURE-----



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 20:23     ` tomas
@ 2017-02-07 20:42       ` Michael Heerdegen
  2017-02-07 21:57         ` tomas
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 20:42 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs

<tomas@tuxteam.de> writes:

> > Ok thanks, then for now, I'll use a little command that is doing that
> > for me (funnily it seems to be impossible to type M-| with a German
> > keyboard [...]
>
> FWIW it works for me, pc104, german layout, more precisely:
>
>   tomas@rasputin:~$ setxkbmap -print
>   xkb_keymap {
>           xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
>           xkb_types     { include "complete"      };
>           xkb_compat    { include "complete"      };
>           xkb_symbols   { include "pc+de(legacy)+gr:2+altwin(alt_super_win)+group(shifts_toggle)+compose(caps)+terminate(ctrl_alt_bksp)"   };
>           xkb_geometry  { include "pc(pc104)"     };
>   };

I have this:

micha@drachen ~> setxkbmap -print
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+inet(evdev)"	};
	xkb_geometry  { include "pc(pc104)"	};
};

> (I have some funky mappings, like CapsLock to compose, both shifts
> simultaneously change to Greek, but that shouldn't influence that.
> Meta is left alt)

I thought that in this case it would depend on the keyboard matrix, as
described here:

  https://en.wikipedia.org/wiki/Rollover_(key)#Ghosting

In xev, when I hold down left alt and AltGr and hit <, I see no event
generated.  Maybe you just have the better keyboard?


Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 20:22       ` Michael Heerdegen
@ 2017-02-07 20:42         ` Eli Zaretskii
  2017-02-07 20:50           ` Michael Heerdegen
  2017-02-08  9:48         ` Thien-Thi Nguyen
  1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2017-02-07 20:42 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 07 Feb 2017 21:22:30 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > It depends on what is at the beginning of the buffer, and what is
> > after the patch itself.  With some text there, Patch could become
> > utterly confused.  It does know about a typical beginning of an email
> > message, but buffer contents could be anything...
> >
> > So I really recommend to mark the patch.
> 
> Ok, but can in real-life situations happen things worse then "patch"
> saying it could not apply the patch?  Did it ever happen to you that it
> applied something wrong?

No, that is unlikely (and never happened to me).  But I thought the
failure to apply was the original motivation for the question, no?

> FWIW, I wrote this:
> 
> #+begin_src emacs-lisp
> (defun my-gnus-patch-from-article ()
>   (interactive)
>   (with-current-buffer gnus-article-buffer
>     (shell-command-on-region
>      (if (use-region-p) (region-beginning) (point-min))
>      (if (use-region-p) (region-end)       (point-max))
>      (format "patch -d '%s' -p1"
                         ^^^^
Never quote command arguments by hand, always use
shell-quote-argument.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 20:42         ` Eli Zaretskii
@ 2017-02-07 20:50           ` Michael Heerdegen
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-07 20:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> No, that is unlikely (and never happened to me).  But I thought the
> failure to apply was the original motivation for the question, no?

Yes, but it's trivial to try again after marking a region, compared to
what I had to do with `epatch' (specifying paths of N files again).

I think applying a patch should not be a "work" of several minutes.  As
long as we speak about 5 +/- 3 seconds or so, I don't care if I have to
mark a region and try again any third time or so.

> >      (format "patch -d '%s' -p1"
>                          ^^^^
> Never quote command arguments by hand, always use
> shell-quote-argument.

Oh - indeed, thanks!


Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 20:42       ` Michael Heerdegen
@ 2017-02-07 21:57         ` tomas
  0 siblings, 0 replies; 20+ messages in thread
From: tomas @ 2017-02-07 21:57 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Feb 07, 2017 at 09:42:22PM +0100, Michael Heerdegen wrote:
> <tomas@tuxteam.de> writes:

[...]

> I have this:
> 
> micha@drachen ~> setxkbmap -print
> xkb_keymap {
> 	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
> 	xkb_types     { include "complete"	};
> 	xkb_compat    { include "complete"	};
> 	xkb_symbols   { include "pc+us+inet(evdev)"	};
> 	xkb_geometry  { include "pc(pc104)"	};
> };

Doesn't look outrageous to me.

> I thought that in this case it would depend on the keyboard matrix, as
> described here:
> 
>   https://en.wikipedia.org/wiki/Rollover_(key)#Ghosting
> 
> In xev, when I hold down left alt and AltGr and hit <, I see no event
> generated.  Maybe you just have the better keyboard?

Seems so. If xev stays mute, it seems you're out of luck :-(

(you could borrow another USB keyboard and try, to confirm). Nasty.

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAliaQrMACgkQBcgs9XrR2kYTKQCcDzHy+lYDDYxOeDXEuE5OTvh7
Kh8Anj4UrzW7JuLFrSBhJ7ylWCeBwwXI
=ynDy
-----END PGP SIGNATURE-----



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 17:52       ` Michael Heerdegen
  2017-02-07 19:45         ` Nick Dokos
@ 2017-02-07 22:42         ` Robert Thorpe
  1 sibling, 0 replies; 20+ messages in thread
From: Robert Thorpe @ 2017-02-07 22:42 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: ndokos, help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Nick Dokos <ndokos@gmail.com> writes:
>
>> M-<anything> is a shortcut for ESC-<anything> so you could use the
>> latter form, as long as you have an ESC key.
>
> Thanks, that works... yes, we have ESC keys in Germany ;-).

C-[ does the same thing as ESC.  It can be useful in these sort of
situations.

BR,
Robert Thorpe



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

* Re: How to apply (multi file) patches conveniently
  2017-02-07 20:22       ` Michael Heerdegen
  2017-02-07 20:42         ` Eli Zaretskii
@ 2017-02-08  9:48         ` Thien-Thi Nguyen
  2017-02-08 22:34           ` Michael Heerdegen
  1 sibling, 1 reply; 20+ messages in thread
From: Thien-Thi Nguyen @ 2017-02-08  9:48 UTC (permalink / raw)
  To: help-gnu-emacs

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


() Michael Heerdegen <michael_heerdegen@web.de>
() Tue, 07 Feb 2017 21:22:30 +0100

         (let* ((insert-default-directory nil)
                (input (read-directory-name
                        (format "Dir (default %s): "
                                (or source-directory
                                    default-directory)))))

Should this be moved into the ‘interactive’ form?

           (if (string= input "")
               (expand-file-name (or source-directory
                                     default-directory))
             input))

You can probably call ‘read-directory-name’ w/ some combination
of DIR, DEFAULT-DIRNAME and INITIAL args to have it produce the
same result.

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical mailing-list) t)
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: How to apply (multi file) patches conveniently
  2017-02-08  9:48         ` Thien-Thi Nguyen
@ 2017-02-08 22:34           ` Michael Heerdegen
  2017-02-09 17:49             ` Thien-Thi Nguyen
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2017-02-08 22:34 UTC (permalink / raw)
  To: help-gnu-emacs

Thien-Thi Nguyen <ttn@gnu.org> writes:

> () Michael Heerdegen <michael_heerdegen@web.de>
> () Tue, 07 Feb 2017 21:22:30 +0100
>
>          (let* ((insert-default-directory nil)
>                 (input (read-directory-name
>                         (format "Dir (default %s): "
>                                 (or source-directory
>                                     default-directory)))))
>
> Should this be moved into the ‘interactive’ form?

Yes, that would be appropriate.  Well... this snipped was quickly
written, I posted it just for reference.  But it would be better indeed.

>
>            (if (string= input "")
>                (expand-file-name (or source-directory
>                                      default-directory))
>              input))
>
> You can probably call ‘read-directory-name’ w/ some combination
> of DIR, DEFAULT-DIRNAME and INITIAL args to have it produce the
> same result.

Hmm, I avoided INITIAL because I prefer to start with an empty
minibuffer.


> Thien-Thi Nguyen -----------------------------------------------
>  (defun responsep (query)
>    (pcase (context query)
>      (`(technical mailing-list) t)
        ^

You can use just a quote here instead of backquote, but it doesn't make
a difference when you run that code ;-)


Regards,

Michael.



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

* Re: How to apply (multi file) patches conveniently
  2017-02-08 22:34           ` Michael Heerdegen
@ 2017-02-09 17:49             ` Thien-Thi Nguyen
  0 siblings, 0 replies; 20+ messages in thread
From: Thien-Thi Nguyen @ 2017-02-09 17:49 UTC (permalink / raw)
  To: help-gnu-emacs

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


() Michael Heerdegen <michael_heerdegen@web.de>
() Wed, 08 Feb 2017 23:34:50 +0100

   >  (defun responsep (query)
   >    (pcase (context query)
   >      (`(technical mailing-list) t)
           ^
   You can use just a quote here instead of backquote, but it
   doesn't make a difference when you run that code ;-)

Thanks.  Good catch.  I've contrived a reason to use backquote.
It makes even more sense now.  M-x praise-pcase RET  :-D

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2017-02-09 17:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-06 12:13 How to apply (multi file) patches conveniently Michael Heerdegen
2017-02-06 15:49 ` Eli Zaretskii
2017-02-07 16:48   ` Michael Heerdegen
2017-02-07 17:19     ` Nick Dokos
2017-02-07 17:52       ` Michael Heerdegen
2017-02-07 19:45         ` Nick Dokos
2017-02-07 22:42         ` Robert Thorpe
2017-02-07 20:23     ` tomas
2017-02-07 20:42       ` Michael Heerdegen
2017-02-07 21:57         ` tomas
2017-02-07 19:31   ` Michael Heerdegen
2017-02-07 20:03     ` Eli Zaretskii
2017-02-07 20:22       ` Michael Heerdegen
2017-02-07 20:42         ` Eli Zaretskii
2017-02-07 20:50           ` Michael Heerdegen
2017-02-08  9:48         ` Thien-Thi Nguyen
2017-02-08 22:34           ` Michael Heerdegen
2017-02-09 17:49             ` Thien-Thi Nguyen
2017-02-07 14:25 ` Stefan Monnier
2017-02-07 16:51   ` Michael Heerdegen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.