delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/25/04:34:32

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Oleksandr Gavenko <gavenko AT bifit DOT com DOT ua>
Subject: Re: Using Cygwin Emacs
Date: Wed, 25 May 2011 11:33:51 +0300
Lines: 94
Message-ID: <4DDCBEEF.7080106@bifit.com.ua>
References: <BANLkTim20f-zm=m3iZj-fdMsFW3QrvT8CA AT mail DOT gmail DOT com>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
In-Reply-To: <BANLkTim20f-zm=m3iZj-fdMsFW3QrvT8CA@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 16.05.2011 4:27, Sayth Renshaw wrote:
> Before I venture down this path are there many people using
> this package? Is it advantageous to use this package(cygwin)?
Advantage is in full integration of Emacs and Cygwin tools.
Watching this list I found that many people use Cygwin Emacs package.

> Or is there not much upside to a user using the default 23.2 zip package?
I use native GNU Emacs. It's GIU look more pretty and Emacs understand
Windows-style path is good thing when you need "goto-error" feature
for MSVC compiler, etc...

With "cygwin-mount.el" native Emacs understand Cygwin-style path.

Also I use:

(when (eq system-type 'windows-nt)
   ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 
'shell-quote-argument'
   ;; quoted by double '\' chars, this cause failure.
   (defun shell-quote-argument (argument)
     (concat "'" argument "'")
     )
   ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
   (setq null-device "/dev/null")
   )
;; Use shell from Cygwin/MinGW.
(setq shell-file-name "bash")
(setenv "SHELL" "/bin/bash")
(setq explicit-bash-args '("-i"))
(setq explicit-sh-args '("-i"))

and some utils like "hg" require wrapper to make it .exe. Just compile:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define MAX_STR_LEN  500

int main(int argc, char **argv)
{
     char cmd[MAX_STR_LEN] = "";
     char **cmdarg = malloc((argc+1) * sizeof(char *));
     char *start, *end;

     start = strrchr(*argv, '/');
     if (start)
         start++;
     else
         start = *argv;
     end = strrchr(start, '.');
     if (end) {
         memcpy(cmd, start, end - start);
         cmd[end - start] = '\0';
     } else
         strcpy(cmd, start);
     for (int i = 0; i < argc; i++)
         cmdarg[i] = argv[i];
     cmdarg[argc] = NULL;

     return execvp(cmd, cmdarg);
}

and take name to executable as shell/perl/python/... script
with ".exe" suffix.

Also I have troubles with quoting of " and {. For example
to make vc-hg.el work properly I patch it:

--- vc-hg.el	2011-01-08 19:45:14.000000000 +0200
+++ vc-hg-new.el	2011-03-17 17:20:26.187500000 +0200
@@ -218,7 +218,7 @@
  			 vc-hg-program nil t nil
  			 "--config" "alias.parents=parents"
  			 "--config" "defaults.parents="
-			 "parents" "--template" "{rev}" (file-relative-name file)))
+			 "parents" "--template" "\\{rev\\}" (file-relative-name file)))
                      ;; Some problem happened.  E.g. We can't find an `hg'
                      ;; executable.
                      (error nil)))))))
@@ -324,7 +324,7 @@
  (defun vc-hg-revision-table (files)
    (let ((default-directory (file-name-directory (car files))))
      (with-temp-buffer
-      (vc-hg-command t nil files "log" "--template" "{rev} ")
+      (vc-hg-command t nil files "log" "--template" "\\{rev\\} ")
        (split-string
         (buffer-substring-no-properties (point-min) (point-max))))))


That's all you need to friend native Emacs with Cygwin.

I am happy with this setup for 3 year with native Emacs from 22.1 to 23.3.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019