From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleksandr Gavenko Newsgroups: gmane.emacs.help Subject: Re: How to build the C language environment in Emacs? Date: Fri, 09 Jan 2015 21:21:01 +0200 Organization: Oleksandr Gavenko , http://gavenkoa.users.sf.net Message-ID: <87bnm7ahgi.fsf@gavenkoa.example.com> References: <54a773933fe5_@_imoxion.com> <86k314me0k.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1420831298 19780 80.91.229.3 (9 Jan 2015 19:21:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Jan 2015 19:21:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 09 20:21:31 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y9f7j-00041O-41 for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Jan 2015 20:21:31 +0100 Original-Received: from localhost ([::1]:51915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9f7i-0007y6-C3 for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Jan 2015 14:21:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9f7V-0007xu-DG for help-gnu-emacs@gnu.org; Fri, 09 Jan 2015 14:21:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9f7S-0000Km-CQ for help-gnu-emacs@gnu.org; Fri, 09 Jan 2015 14:21:17 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:48165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9f7S-0000Kc-1T for help-gnu-emacs@gnu.org; Fri, 09 Jan 2015 14:21:14 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y9f7Q-0003r5-4V for help-gnu-emacs@gnu.org; Fri, 09 Jan 2015 20:21:12 +0100 Original-Received: from 46.211.79.104 ([46.211.79.104]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Jan 2015 20:21:12 +0100 Original-Received: from gavenkoa by 46.211.79.104 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Jan 2015 20:21:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 142 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 46.211.79.104 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:qFy2lc0DTMe8Oi9FwPxIQhM1+EI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101978 Archived-At: On 2015-01-03, Filipp Gunbin wrote: >> On Sat, Jan 03 2015 at 12:34:59 +0800, Liu Shengyu wrote: >> >> well...IIRC, using Emacs in windows is terrible... > > Very usable on Cygwin. I've worked in it for years. I ever use native Emacs with 'cygwin-mount!! Because I used to use MS VS toolchain and Cygwin Emacs can't understand Windows path at all... See my http://sourceforge.net/u/gavenkoa/dot-emacs/ci/default/tree/.emacs-my Here some tricks (may be outdated, I sat at Windows host last time 3 year ago) which integrate native Emacs and Cygwin: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "shell, bash, Cygwin, MSYS") (defvar my-use-windows-shell nil "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like commands. If nil, 'sh' will be used." ) (defun follow-cygwin-symlink () "Follow new-style (and also UCS-16) Cygwin symlinks." (save-excursion (goto-char 0) (when (looking-at "!\xff\xfe") (find-alternate-file (substring (decode-coding-string (buffer-substring (match-end 0) (point-max)) 'utf-16-le) 0 -1) ; -1 for stripping final \0. )))) (defun my-dos2cygwin-path (path) "Convert DOS path to Cygwin according to current mount table." (interactive (list (read-directory-name "Enter DOS path: "))) (setq path (replace-regexp-in-string "\\\\" "/" (expand-file-name path))) (let ( (table cygwin-mount-table--internal) item prefix ) (while table (setq item (car table)) (setq prefix (concat "\\`" (regexp-quote (car item)))) (setq table (cdr table)) (when (string-match prefix path) (setq path (replace-regexp-in-string prefix (cdr item) path)) (setq table nil) ) ) path )) (when (eq system-type 'windows-nt) (ignore-errors (require 'cygwin-mount) (cygwin-mount-activate) ) (add-hook 'find-file-hook 'follow-cygwin-symlink) ;; 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") (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) (modify-coding-system-alist 'process "gnutls-cli" '(binary . binary)) ) (when (eq window-system 'w32) (add-to-list 'exec-suffixes ".py") (add-to-list 'exec-suffixes ".sh") (defun executable-find (command) (locate-file command exec-path exec-suffixes)) ) (ansi-color-for-comint-mode-on) (setq explicit-bash-args '("-i")) (setq explicit-sh-args '("-i")) (if (memq system-type '(windows-nt cygwin)) (setq ls-lisp-verbosity nil) (setq ls-lisp-verbosity '(links uid gid))) (when (featurep 'cygwin-mount) (setenv "INFOPATH" "/usr/share/info/:~/usr/share/info/:") ;; Redefine path-separator to UNIX to update Info-directory-list. (let ( (path-separator ":") ) (require 'info) (info-initialize) )) ;; Assume that cygwin-mount already activated. (when (featurep 'cygwin-mount) (let ( (path (expand-file-name "~")) ) (when (string-match "\\([c-z]\\):/" path) (setenv "MANPATH" (concat "/cygdrive/" (substring path 0 1) "/" (substring path 3) "/usr/share/man/:")) ) )) ;; I prefer EN man pages. (when (memq system-type '(windows-nt cygwin)) (setq manual-program "LANG=C man") ) (setq recentf-save-file "~/.recentf") (when (eq system-type 'cygwin) (setq recentf-save-file "~/.recentf-cygwin")) (setq desktop-base-file-name ".emacs.desktop") (setq desktop-base-lock-name ".emacs.desktop.lock") (when (eq system-type 'cygwin) (setq desktop-base-file-name ".emacs.desktop-cygwin") (setq desktop-base-lock-name ".emacs.desktop-cygwin.lock") ) -- Best regards!