From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to build the C language environment in Emacs?
Date: Fri, 09 Jan 2015 21:21:01 +0200 [thread overview]
Message-ID: <87bnm7ahgi.fsf@gavenkoa.example.com> (raw)
In-Reply-To: m2lhljc2np.fsf@fastmail.fm
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 "!<symlink>\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!
next prev parent reply other threads:[~2015-01-09 19:21 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-03 4:34 How to build the C language environment in Emacs? Liu Shengyu
2015-01-03 9:04 ` Quanyang Liu
2015-01-03 14:50 ` Grant Rettke
2015-01-06 19:08 ` Ken Goldman
2015-01-03 15:19 ` Filipp Gunbin
2015-01-09 19:21 ` Oleksandr Gavenko [this message]
2015-01-03 17:08 ` Óscar Fuentes
2015-01-06 19:05 ` Ken Goldman
[not found] ` <mailman.17367.1420571149.1147.help-gnu-emacs@gnu.org>
2015-01-07 1:41 ` Emanuel Berg
2015-01-07 2:21 ` Quanyang Liu
2015-01-07 4:35 ` Óscar Fuentes
[not found] ` <mailman.17392.1420605430.1147.help-gnu-emacs@gnu.org>
2015-01-07 4:55 ` Emanuel Berg
2015-01-07 14:16 ` Óscar Fuentes
[not found] ` <mailman.17407.1420640515.1147.help-gnu-emacs@gnu.org>
2015-01-07 15:53 ` Will Parsons
2015-01-07 17:48 ` Rusi
2015-01-07 18:08 ` Óscar Fuentes
2015-01-07 18:12 ` Eli Zaretskii
[not found] ` <mailman.17388.1420597359.1147.help-gnu-emacs@gnu.org>
2015-01-07 3:36 ` Emanuel Berg
2015-01-07 19:37 ` Bob Proulx
2015-01-07 19:58 ` Marcin Borkowski
2015-01-08 2:36 ` Eric Abrahamsen
2015-01-07 22:34 ` Robert Thorpe
2015-01-07 19:01 ` Ken Goldman
2015-01-03 11:10 ` Eli Zaretskii
[not found] <mailman.17149.1420274187.1147.help-gnu-emacs@gnu.org>
2015-01-03 8:45 ` Pascal J. Bourguignon
2015-01-03 17:48 ` Emanuel Berg
[not found] <mailman.17437.1420670116.1147.help-gnu-emacs@gnu.org>
2015-01-07 22:59 ` Pascal J. Bourguignon
2015-01-08 10:23 ` Nicolas Richard
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bnm7ahgi.fsf@gavenkoa.example.com \
--to=gavenkoa@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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).