.emacs-my
changeset 746 f7ce19afa666
parent 745 81e7f065031c
child 747 dd1d88804512
--- a/.emacs-my	Sun Oct 23 22:48:06 2011 +0300
+++ b/.emacs-my	Mon Oct 24 01:47:47 2011 +0300
@@ -312,6 +312,23 @@
   (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
   )
 
+(when (eq window-system 'w32)
+  ;; Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
+  ;; 'gnutls-cli' run with '-s' opt and process wait for SIGALRM.
+  ;; But build-in native Emacs 'kill' command can not send such Cygwin
+  ;; specific sygnal. So 'starttls-negotiate-gnutls' function infinitely
+  ;; wait for 'gnutls-cli' output.
+  (defadvice signal-process (around cygwin (process sigcode))
+    "Use 'kill.exe' instead build-in Emacs 'kill'."
+    (if (eq sigcode 'SIGALRM)
+        (shell-command
+         (format "kill.exe -s SIGALRM %d"
+                 (if (processp process) (process-id process) process)))
+      ad-do-it
+      ))
+  (ad-activate 'signal-process)
+  )
+
 (ansi-color-for-comint-mode-on)
 
 (setq explicit-bash-args '("-i"))