From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: shell-command in Windows 7 Date: Sat, 15 Apr 2017 11:30:48 +0300 Message-ID: <8360i6gjif.fsf@gnu.org> References: <40b3fe49-18cb-c7bc-5792-98e0a7c7c8e6@gmail.com> <125e7442-9006-2a09-f313-f2a30d69d67d@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1492245063 2649 195.159.176.226 (15 Apr 2017 08:31:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 15 Apr 2017 08:31:03 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 15 10:30:59 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1czJ6h-0000TD-9a for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Apr 2017 10:30:59 +0200 Original-Received: from localhost ([::1]:55886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czJ6g-0002GG-LR for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Apr 2017 04:30:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czJ6B-0002Fv-7Z for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 04:30:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czJ66-0006v5-9s for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 04:30:27 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czJ66-0006uy-6y for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 04:30:22 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4213 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1czJ65-0003ME-H3 for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 04:30:21 -0400 In-reply-to: <125e7442-9006-2a09-f313-f2a30d69d67d@gmail.com> (message from 42 147 on Sat, 15 Apr 2017 09:40:24 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112771 Archived-At: > From: 42 147 > Date: Sat, 15 Apr 2017 09:40:24 +0200 > > Two problems before: > > (1) I got the error message > > (Shell command failed with code 1 and no output) That's because you are using shell-command to invoke Explorer, which is a GUI program that continues to run in parallel with Emacs. You can ignore the exit status in this case. > Even when the files / programs / directories would open as desired. This > was still undesirable buggy behavior. > > (2) Each time I launched Emacs I had to switch to the other directory > string format to get back (1). This made no sense at all. To be specific: > > (a) "E:\\Program Files\\Mozilla Firefox\\firefox.exe" > > had to be switched to: > > (b) "E:/Program Files/Mozilla Firefox/firefox.exe" > > in the body of the code I cited in the first e-mail, if (a) was what I > had the previous Emacs launch. And (b) had to be switched back to (a) if > (b) was what I had the previous Emacs launch. That doesn't happen to me in "emacs -Q", so it's most probable some of your customizations that caused this. In particular, there's no "memory" in Emacs of the file names it used in invoking programs. Btw, please note that what you write above is somewhat inconsistent: (defun firefox () (interactive) (shell-command (concat "explorer " (replace-regexp-in-string "/" "\\\\" "E:\\Program Files\\Mozilla Firefox\\firefox.exe" t t)))) First, I needed to use "\\", not "\\\\" in my testing, otherwise I get an error. Second, I'm not sure what you are saying, exactly. Are you saying that in one session you needed to use this: (defun firefox () (interactive) (shell-command (concat "explorer " (replace-regexp-in-string "/" "\\" "E:/Program Files/Mozilla Firefox/firefox.exe" t t)))) and in the next you needed to use this: (defun firefox () (interactive) (shell-command (concat "explorer " (replace-regexp-in-string "\\\\" "/" "E:\\Program Files\\Mozilla Firefox\\firefox.exe" t t)))) ? That most probably means either some customization which records the file name somewhere, or some weird shell tricks you have on your system. I cannot reproduce this here.