From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: 42 147 Newsgroups: gmane.emacs.help Subject: shell-command in Windows 7 Date: Fri, 14 Apr 2017 10:53:22 +0200 Message-ID: <40b3fe49-18cb-c7bc-5792-98e0a7c7c8e6@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1492175846 12404 195.159.176.226 (14 Apr 2017 13:17:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Apr 2017 13:17:26 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 14 15:17:13 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 1cz168-0002xy-O8 for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Apr 2017 15:17:12 +0200 Original-Received: from localhost ([::1]:53266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cz16C-0006nl-Qm for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Apr 2017 09:17:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cywyx-0007Xx-K3 for help-gnu-emacs@gnu.org; Fri, 14 Apr 2017 04:53:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cywyu-00077z-Hp for help-gnu-emacs@gnu.org; Fri, 14 Apr 2017 04:53:31 -0400 Original-Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:36448) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cywyu-00077e-BG for help-gnu-emacs@gnu.org; Fri, 14 Apr 2017 04:53:28 -0400 Original-Received: by mail-wm0-x229.google.com with SMTP id o81so126643086wmb.1 for ; Fri, 14 Apr 2017 01:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=dUkFbewBlu4XU0Kh2yXlDJvT2wAL8x4MseMVzptaZtI=; b=Wrn75EnOS/6AEI2dX7YkrKlR8QhvKusl3Hh84GnJlNVq0UvFb6wkWnnJDjAVSKRaPr IDRMeyIxvWobYipwL2UYRJyQi3fgP/RPZA9go1zgNhYVhdmJLxu+88Z5sRmNIUmuxn2d 8RK5uAkLl3jtmloDN5xZQEoYzraBIJBVDOC6bc/OCXcllyREozhvre4bknF1Vx5x8CW9 0yfXXLd7BnEx0BF7Az89py7uDQjCWfI2moE8JoGXpJPn5ykyAvifCf7K1TLow6Jd9stT Y65GGXP+lc8gqKRSMbEGQqiQVbWwLfT/dcnxD1srMH0bt2fy2F17gn7MWoR/ow2e1IX4 CJLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=dUkFbewBlu4XU0Kh2yXlDJvT2wAL8x4MseMVzptaZtI=; b=U+IeUVg9zrUUzmCWLZabsZsAJDF1i7k3FAJbYCbONWk9DwUbqOfY/8VdWjlIJe+ruF GyyFBPz6JMmSqVfXAeL6tHSutZxHaYxTNlKYqcCfp+cxL0Fs1CVC0CyhJm1GSsC3K5ik omWMyIxx5RIa0Jxhmv57L2F+AIvRwuk6M/AvHIhP5AF+1gQEJCGwNB+Q2Ah2E2+eF9vP v8vji+P5jrQ7voIbJcCbFlh9vUc6X8wqdTS5nDEHAZ13g5Ry72v0LLJD5Lsl5KC8hQAD jnGvlrzjLIJ4+qjCEdjHIzvQ0LrXNSf/gWZnI7sRZvLqj2/QwQDrrcV1JBV7/Jcshy8R lKMg== X-Gm-Message-State: AN3rC/6iVoye5BXbXRsXjtLjJ40J08c35aaRZRroQ+Y6Lq5/dSs3+t6k UkDOeb0RTvksZCSyhfM= X-Received: by 10.28.40.198 with SMTP id o189mr29604957wmo.108.1492160006859; Fri, 14 Apr 2017 01:53:26 -0700 (PDT) Original-Received: from [192.168.2.195] (dslb-092-072-062-032.092.072.pools.vodafone-ip.de. [92.72.62.32]) by smtp.gmail.com with ESMTPSA id m21sm1924921wma.19.2017.04.14.01.53.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2017 01:53:26 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::229 X-Mailman-Approved-At: Fri, 14 Apr 2017 09:16:50 -0400 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:112762 Archived-At: I've been using this code to create functions that open files / folders within Emacs in Windows 7: (defun open-buffer-path () "Run explorer on the directory of the current buffer." (interactive) (shell-command (concat "explorer " (replace-regexp-in-string "/" "\\\\" (file-name-directory (buffer-file-name)) t t)))) (defun firefox () (interactive) (shell-command (concat "explorer " (replace-regexp-in-string "/" "\\\\" "E:\\Program Files\\Mozilla Firefox\\firefox.exe" t t)))) This worked fine for a while. Then I erased one of my older OSes on a different partition and created an NTFS partition for extra Windows 7 storage. This did not change the drive number of Windows 7 at all. But for some reason, after that repartitioning, the above code only works if I alternative between the two different directory string types. Thus if I had the above before, on system reboot, I have to replace it all with: (defun .emacs-open () "Run explorer on the directory of the current buffer." (interactive) (shell-command (concat "explorer " (replace-regexp-in-string "/" "\\\\" "E:/Users/John/AppData/Roaming/" t t)))) And vice-versa, otherwise Emacs is unable to open the file / directory I want, and just opens to the same default directory when I call each function. I created a workaround in which I press F12 to alternate between the two load files (I put these settings in a dedicated .el), but I'm very curious why this happens, and ideally a workaround like this would not be necessary.