Corinna Vinschen <[email protected]> writes: > Hi Volker, > > can you do me a favor? Can you have a look into the FAQ entries "Is > there a Cygwin port of GNU Emacs?" and the next one "What about NT > Emacs?" and suggest a rewrite? The information given in these two FAQ > entries is certainly outdated, but I'm not quite sure how to rephrase > them. What especially bugs me is the reference to X11 which, as far as > I know, is not correct for XEmacs.
Here are few improvements. Diff is against CVS. Jari >From 463f84b9937e93064d813ec22968c384b1525dad Mon Sep 17 00:00:00 2001 From: Jari Aalto <[email protected]> Date: Fri, 13 Feb 2009 20:52:05 +0200 Subject: [PATCH] faq-using.xml: Expand Emacs entries Is there a Cygwin port of GNU Emacs - Change URL to point to NT Emacs FAQ's entry 'Where can I get pre-compiled versions' instead of direct FTP link. What about NT Emacs? - Rewrite list setup - Add environment variables section - Offer two choices, A and B, where B introduces M-x my-bash function. Signed-off-by: Jari Aalto <[email protected]> --- faq-using.xml | 92 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 77 insertions(+), 15 deletions(-) diff --git a/faq-using.xml b/faq-using.xml index ea5caa9..fabde7d 100644 --- a/faq-using.xml +++ b/faq-using.xml @@ -809,10 +809,11 @@ Consider using XEmacs for now. <question><para>What about NT Emacs?</para></question> <answer> -<para>If you want GNU Emacs with a native Microsoft GUI interface, then -you can either use XEmacs (see below), or you can fetch a native NT Emacs -from <ulink url="http://ftp.gnu.org/pub/gnu/emacs/windows/">http://ftp.gnu.org/pub/gnu/emacs/windows/</ulink>. See also the README file you get from the -same place. +<para>If you want GNU Emacs with a native Microsoft GUI interface, +then you can either use XEmacs (see below), or native +NT Emacs: see section +<ulink url="http://www.gnu.org/software/emacs/windows/Getting-Emacs.html#Getting-Emacs">Where can I get pre-compiled versions?</ulink> in NT Emacs FAQ. + </para> <para>NT Emacs uses the Windows command shell by default. Since it is not a Cygwin application, it has no knowledge of Cygwin mounts. With those @@ -822,25 +823,86 @@ for the JDEE package (<ulink url="http://jdee.sunsite.dk/">http://jdee.sunsite.d settings are for Emacs 21.1: </para> <screen> + + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Initial setup + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; This assumes that Cygwin is installed in C:\cygwin (the ;; default) and that C:\cygwin\bin is not already in your ;; Windows Path (it generally should not be). - ;; + (setq exec-path (cons "C:/cygwin/bin" exec-path)) (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH"))) - ;; - ;; NT-emacs assumes a Windows command shell, which you change - ;; here. - ;; + + ;; LOGNAME and USER are expected in many Emacs packages + ;; Check these environment variables. + + (if (and (null (getenv "USER")) + ;; Windows includes variable USERNAME, which is copied to + ;; LOGNAME and USER respectively. + (getenv "USERNAME")) + (setenv "USER" (getenv "USERNAME"))) + + (if (and (getenv "LOGNAME") + ;; Bash shell defines only LOGNAME + (null (getenv "USER"))) + (setenv "USER" (getenv "LOGNAME"))) + + (if (and (getenv "USER") + (null (getenv "LOGNAME"))) + (setenv "LOGNAME" (getenv "USER"))) + + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; (A) M-x shell: This change M-x shell permanently + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; Would call Windows command interpreter. Change it. + (setq shell-file-name "bash") - (setenv "SHELL" shell-file-name) - (setq explicit-shell-file-name shell-file-name) - ;; - ;; This removes unsightly ^M characters that would otherwise - ;; appear in the output of java applications. - ;; + (setenv "SHELL" shell-file-name) + (setq explicit-shell-file-name shell-file-name) + + ;; Remove C-m (^M) characters that appear in output + (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) + + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; (B) *OR* call following function with M-x my-bash + ;; The M-x shell would continue to run standard Windows shell + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + (defun my-bash (&optional buffer) + "Run Cygwin Bash shell in optional BUFFER; default *shell-bash*." + (autoload 'comint-check-proc "comint") + (interactive + (let ((name "*shell-bash*")) + (if current-prefix-arg + (setq name (read-string + (format "Cygwin shell buffer (default %s): " name) + (not 'initial-input) + (not 'history) + name))) + (list name))) + (or buffer + (setq buffer "*shell-bash*")) + (if (comint-check-proc buffer) + (pop-to-buffer buffer) + (let* ((shell-file-name "bash") + (explicit-shell-file-name shell-file-name) + (explicit-sh-args '("--login" "-i")) + (explicit-bash-args explicit-sh-args) + (w32-quote-process-args ?\"));; Use Cygwin quoting rules. + (shell buffer) + ;; By default Emacs sends "\r\n", but bash wants plain "\n" + (set-buffer-process-coding-system 'undecided-dos 'undecided-unix) + ;; With TAB completion, add slash path separator, none to filenames + (make-local-variable 'comint-completion-addsuffix) + (setq comint-completion-addsuffix '("/" . "")) + ;; This variable is local to buffer + (setq comint-prompt-regexp "^[ \n\t]*[$] ?")))) + </screen> <para>If you want NT Emacs to understand Cygwin paths, get -- 1.5.6.5
