From: Kaushal Modi <kaushal.modi@gmail.com>
To: npostavs@users.sourceforge.net
Cc: phst@google.com, 26378@debbugs.gnu.org
Subject: bug#26378: 26.0.50; Hitting 'n' during ediff gives Error
Date: Thu, 06 Apr 2017 12:23:42 +0000 [thread overview]
Message-ID: <CAFyQvY2PNP+uCxckY1xEi3nb4u78v88E2A_+ywuS5wBgGnnDGA@mail.gmail.com> (raw)
In-Reply-To: <87zifuv3q5.fsf@users.sourceforge.net>
[-- Attachment #1: Type: text/plain, Size: 4121 bytes --]
Hi Noam,
Thanks for the comments.
How does this look?
From 99e290cec79754d8d92ec6dcf3c58594782a677b Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Wed, 5 Apr 2017 17:16:33 -0400
Subject: [PATCH] Check that file argument is a string
* lisp/vc/ediff-diff.el (ediff-exec-process): Check that the argument
passed to `file-local-copy' is a string (Bug#26378). Also fix
the existing comment for this function, and convert it to its
doc-string.
---
lisp/vc/ediff-diff.el | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el
index cfa08ef360..3b2a85afdd 100644
--- a/lisp/vc/ediff-diff.el
+++ b/lisp/vc/ediff-diff.el
@@ -1134,12 +1134,22 @@ ediff-setup-diff-regions3
))
-;; Execute PROGRAM asynchronously, unless OS/2, Windows-*, or DOS, or
unless
-;; SYNCH is non-nil. BUFFER must be a buffer object, and must be alive.
The
-;; OPTIONS arg is a list of options to pass to PROGRAM. It may be a blank
-;; string. All elements in FILES must be strings. We also delete nil from
-;; args.
(defun ediff-exec-process (program buffer synch options &rest files)
+ "Execute the diff PROGRAM.
+
+The PROGRAM output is sent to BUFFER, which must be a live buffer
+object.
+
+The PROGRAM is executed asynchronously unless `system-type' is
+`windows-nt' or `ms-dos', or unless SYNCH is non-nil.
+
+OPTIONS is a string of space-separated options to pass to PROGRAM. It
+may be a blank string.
+
+FILES is a list of filenames to pass to PROGRAM. This list may
+contain a nil element too.
+
+nil and \"\" elements in OPTIONS and FILES are ignored."
(let ((data (match-data))
;; If this is a buffer job, we are diffing temporary files
;; produced by Emacs with ediff-coding-system-for-write, so
@@ -1151,8 +1161,9 @@ ediff-exec-process
args)
(setq args (append (split-string options)
(mapcar (lambda (file)
- (file-name-unquote
- (or (file-local-copy file) file)))
+ (when (stringp file)
+ (file-name-unquote
+ (or (file-local-copy file) file))))
files)))
(setq args (delete "" (delq nil args))) ; delete nil and "" from
arguments
;; the --binary option, if present, should be used only for buffer jobs
--
2.11.0
On Wed, Apr 5, 2017 at 7:21 PM <npostavs@users.sourceforge.net> wrote:
> Now that we're looking at the whole thing, I have a few more comments.
>
> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
> > + "Execute the diff PROGRAM.
> > +
> > +The PROGRAM output is sent to BUFFER, which must be a buffer object,
> > +and must be alive.
>
> It would flow a bit better to say "which must be a live buffer object".
>
I agree.
> > +
> > +The PROGRAM is executed asynchronously unless the OS is OS/2,
> > +Windows-*, or DOS, or unless SYNCH is non-nil.
>
> I don't see any reference to OS/2 in the code, so I think we should just
> drop it.
Makes sense.
> And I'm not sure what the "-*" in "Windows-*" means;
It means Windows-95, Windows NT, Windows 8, Windows 10, etc.
> I think
> we should just say "unless `system-type' is `windows-nt' or `ms-dos'".
>
I am fine with that.
> > +
> > +OPTIONS is a list of options to pass to PROGRAM. It may be a blank
> > +string.
>
> This seems to be wrong, OPTIONS is not a list. It should say "OPTIONS
> is a string of space-separated options to pass to PROGRAM".
>
You are right; making that change.
> > +
> > +An element in FILES must be either a string or nil.
> > +
> > +We also delete nil and \"\" from all arguments."
>
> I think these last 2 sentences should be combined into something like:
>
> "FILES is a list of filenames to pass to PROGRAM; nil and \"\" elements
> are ignored."
>
I have tweaked this part slightly (see patch in this email). Based on the
code, nil and "" elements will be removed from a concatenated list of
OPTIONS and FILES; not just FILES.
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 7270 bytes --]
next prev parent reply other threads:[~2017-04-06 12:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 20:57 bug#26378: 26.0.50; Hitting 'n' during ediff gives Error Kaushal Modi
2017-04-05 21:03 ` Kaushal Modi
2017-04-05 21:20 ` Kaushal Modi
2017-04-05 21:53 ` Noam Postavsky
2017-04-05 22:36 ` Kaushal Modi
2017-04-05 23:23 ` npostavs
2017-04-06 12:23 ` Kaushal Modi [this message]
2017-04-06 12:45 ` npostavs
2017-04-06 14:36 ` Kaushal Modi
2017-04-06 23:38 ` npostavs
2017-04-07 14:09 ` Kaushal Modi
2017-04-07 22:31 ` npostavs
2017-04-08 14:58 ` Philipp Stephani
2017-04-10 19:36 ` Kaushal Modi
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=CAFyQvY2PNP+uCxckY1xEi3nb4u78v88E2A_+ywuS5wBgGnnDGA@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=26378@debbugs.gnu.org \
--cc=npostavs@users.sourceforge.net \
--cc=phst@google.com \
/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).