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: Re: shell-command in Windows 7 Date: Sat, 15 Apr 2017 23:33:39 +0200 Message-ID: <443ba983-11b5-95a9-3dc4-590937f5ad27@gmail.com> References: <40b3fe49-18cb-c7bc-5792-98e0a7c7c8e6@gmail.com> <3c7fb354-4818-a7b9-3129-7ecceaafd804@gmail.com> <29712869-8b2a-11e4-ddaf-3b417947aa70@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 1492292068 32276 195.159.176.226 (15 Apr 2017 21:34:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 15 Apr 2017 21:34:28 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cc: "help-gnu-emacs@gnu.org" To: John Mastro Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 15 23:34:22 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 1czVKo-0008GE-GP for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Apr 2017 23:34:22 +0200 Original-Received: from localhost ([::1]:58125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czVKs-0004Yf-RZ for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Apr 2017 17:34:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czVKG-0004YZ-SG for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 17:33:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czVKD-0003Cq-Nx for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 17:33:48 -0400 Original-Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:34665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1czVKD-0003BX-Ho for help-gnu-emacs@gnu.org; Sat, 15 Apr 2017 17:33:45 -0400 Original-Received: by mail-wr0-x232.google.com with SMTP id z109so66061495wrb.1 for ; Sat, 15 Apr 2017 14:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=DekUUjRLr4bJJSrVgbF1desb3AHN0a/dsrEwSfHzUVc=; b=VE/HmZ3O5aUvZ0mF96K8yhUJyaGlOEdAfjRTGMuPcyJL2O/b2W9gImRUEDYk/hxXyp Db+GrdKZSxwPQ6qnjcJ+rLeHXtNmsRV08UH8fq0PhNk1JUDOKGAo8T5+R86c+FDPFFYi pU0TIC1E1HTUNN8tYoq13IYtObW6ccfTQF53+e5muPNhNU2W50rwo40Lb7pIVEs1VJwa JlapHowxT87UjRpVo3nL/29vNf3Hyj6jZtvin3J0fdlZGvOvt1l1uHVTjRPNY9jqdwNs 5wsu0nM4xGqVpgzdT5cfJKU8cnaVKMZ48oIunv/6xb47pCy0HID6n9t6w9kBwMhLc/nD p5Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=DekUUjRLr4bJJSrVgbF1desb3AHN0a/dsrEwSfHzUVc=; b=Ebm8KSRzPrYl+7gb4itOAw/KlzyIhcxzN6Z+lO1VWO7h4cK+nh/n7S+ReIzYkTnDgr 6tsnGFTF7RUG5tnDxzQ63dWNccXlfTlFBvRuSEDqDkzPvnzfEimExTkx+2sGMlQqk3Cn PJzC6j1uUGpESY3t+z+d/1lkepiwRV/wpoOSMlIKBQ4wTLtjsf1fb/waqq82a5t1g1D/ SpIUmnayd50qzvTqlLmpL9sSHCBjXIhfQQX6TZrZEv1tPWTe0vIkKlwpXXBRifPEIvZK N+ooiLe2y3c0toIdif8TcqdLHhb2oPD/TvGTDmYV8TaxjJ1Wersu3EBy7Hfi02RkWq5I 6tvA== X-Gm-Message-State: AN3rC/6KS4xP2+CeojTMEt8cKh/2kY9fI3pMVJVImMApCGbAYS8ignW4 XqPHObEmSHVRnzz71c8= X-Received: by 10.223.135.153 with SMTP id b25mr5132801wrb.170.1492292024273; Sat, 15 Apr 2017 14:33:44 -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 l68sm7823493wrc.52.2017.04.15.14.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Apr 2017 14:33:43 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::232 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:112781 Archived-At: I was under the impression that setup-cygwin.el was needed to run a Cygwin shell within Emacs. I'll admit that I set Cygwin-Emacs up by mechanically following the first set of instructions I found online. As with everything there are apparently many different ways of getting the same result. Am 4/15/2017 um 10:08 PM schrieb John Mastro: > John Mastro wrote: >> 42 147 wrote: >>> setup-cygwin.el is perfectly compatible with the code that John Mastro >>> suggested (which works better than what I had previously anyway). I need >>> setup-cygwin.el to run cygwin in Emacs. No way I'll stop loading it! >> I've been using native Windows builds of Emacs together with Cygwin for >> several years now. (Eli recommends against it for very sensible reasons, >> but I haven't found anything better and it works well enough for me). >> >> During that time, I've never used setup-cygwin.el. I don't even know >> what it does, so I could be missing out, but I wanted to mention that >> (at least in my use case) setup-cygwin.el isn't necessary to use Cygwin >> with Emacs. > I should mention that I do have some home-grown Cygwin-related settings > though. > > I do not claim this is the best or right way to do it, but it's what I > ended up with over time, so I'll share it FWIW. > > (defvar cygwin-path-directories > '("/bin" "/usr/bin" "/usr/local/bin" > "/Windows" "/ProgramData/Oracle/Java/javapath")) > > (defun cygwinize-file-name (name) > (if (string-match "\\`\\([A-Za-z]\\):\\(/\\|\\\\\\)" name) > (let* ((drive (match-string 1 name)) > (sep (match-string 2 name)) > (more (substring name (match-end 2)))) > (concat (if (member drive '("c" "C")) "" (concat "/" drive)) > "/" > (if (equal sep "\\") > (replace-regexp-in-string "\\\\" "/" more) > more))) > name)) > > (defun init-for-cygwin () > (let* ((home (cygwinize-file-name (or (getenv "HOME") > (error "HOME not defined")))) > (home/bin (concat home > (unless (string-suffix-p "/" home) "/") > "bin")) > (path (cons home/bin cygwin-path-directories))) > (setenv "PATH" (mapconcat #'identity path ":")) > (setq exec-path (mapcar (lambda (dir) (concat "c:" dir)) path)) > (let ((shell (or (executable-find "zsh") > (executable-find "bash") > (error "Can't find zsh or bash")))) > (setq shell-file-name shell) > (setq explicit-shell-file-name shell) > (setq ediff-shell shell) > (setq null-device "/dev/null") > (setenv "SHELL" shell)))) > > (when (and (eq system-type 'windows-nt) > (file-executable-p "c:/bin/bash.exe")) > (init-for-cygwin))