public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Oleksandr Gavenko <gavenko@bifit.com.ua>
To: cygwin@cygwin.com
Subject: Re: Using Cygwin Emacs
Date: Wed, 25 May 2011 08:34:00 -0000	[thread overview]
Message-ID: <4DDCBEEF.7080106@bifit.com.ua> (raw)
In-Reply-To: <BANLkTim20f-zm=m3iZj-fdMsFW3QrvT8CA@mail.gmail.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

  parent reply	other threads:[~2011-05-25  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16  1:28 Sayth Renshaw
2011-05-16  2:27 ` Ken Brown
2011-05-25  8:34 ` Oleksandr Gavenko [this message]
2011-05-16  4:35 Sayth Renshaw
2011-05-16  7:27 ` Markus Hoenicka
2011-05-16 10:14 ` Ken Brown
2011-05-16 17:21   ` Lee Maschmeyer
2011-05-16 17:38     ` Ken Brown

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDCBEEF.7080106@bifit.com.ua \
    --to=gavenko@bifit.com.ua \
    --cc=cygwin@cygwin.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.
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).