From 313748d47ee7eb378f68b563dc2f5c9e25501290 2006-03-13 07:30:31
From: fperez
Date: 2006-03-13 07:30:31
Subject: [PATCH] - Small manual update about Emacs
- Close http://www.scipy.net/roundup/ipython/issue57 with provided patch.


---

diff --git a/doc/ChangeLog b/doc/ChangeLog
index 629e6bf..01ed4d1 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,14 @@
+2006-03-13  Fernando Perez  <Fernando.Perez@colorado.edu>
+
+	* Manual: thanks to a tip on proper color handling for Emacs, by
+	Eric J Haywiser <ejh1-AT-MIT.EDU>.
+	
+	* ipython.el: close http://www.scipy.net/roundup/ipython/issue57
+	by applying the provided patch.  Thanks to Liu Jin
+	<m.liu.jin-AT-gmail.com> for the contribution.  No problems under
+	XEmacs/Linux, I'm trusting the submitter that it actually helps
+	under win32/GNU Emacs.  Will revisit if any problems are reported.
+
 2006-03-12  Fernando Perez  <Fernando.Perez@colorado.edu>
 
 	* IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
diff --git a/doc/ipython.el b/doc/ipython.el
index 36e7b35..6a71230 100644
--- a/doc/ipython.el
+++ b/doc/ipython.el
@@ -6,7 +6,7 @@
 ;; URL:           http://ipython.scipy.org
 ;; Compatibility: Emacs21, XEmacs21
 ;; FIXME: #$@! INPUT RING
-(defconst ipython-version "$Revision: 565 $"
+(defconst ipython-version "$Revision: 1211 $"
   "VC version number.")
 
 ;;; Commentary 
@@ -305,6 +305,9 @@ in the current *Python* session."
       (interactive)
       (let* ((ugly-return nil)
              (sep ";")
+             (python-process (or (get-buffer-process (current-buffer))
+                                 ;XXX hack for .py buffers
+                                 (get-process py-which-bufname)))
              ;; XXX currently we go backwards to find the beginning of an
              ;; expression part; a more powerful approach in the future might be
              ;; to let ipython have the complete line, so that context can be used
@@ -325,10 +328,9 @@ in the current *Python* session."
                           (delete-region comint-last-output-start 
                                          (process-mark (get-buffer-process (current-buffer)))))))))
                                         ;(message (format "#DEBUG pattern: '%s'" pattern))
-        (process-send-string  (or (get-buffer-process (current-buffer))
-                                  (get-process py-which-bufname)) ;XXX hack for .py buffers
+        (process-send-string python-process 
                               (format ipython-completion-command-string pattern))
-        (accept-process-output (get-buffer-process (current-buffer)))
+        (accept-process-output python-process)
                                         ;(message (format "DEBUG return: %s" ugly-return))
         (setq completions 
               (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
@@ -354,6 +356,9 @@ in the current *Python* session."
     (interactive)
     (let* ((ugly-return nil)
            (sep ";")
+           (python-process (or (get-buffer-process (current-buffer))
+                                        ;XXX hack for .py buffers
+                               (get-process py-which-bufname)))
            ;; XXX currently we go backwards to find the beginning of an
            ;; expression part; a more powerful approach in the future might be
            ;; to let ipython have the complete line, so that context can be used
@@ -371,10 +376,9 @@ in the current *Python* session."
                     (lambda (string) 
                       (setq ugly-return (concat ugly-return string))
                       "")))))
-      (process-send-string  (or (get-buffer-process (current-buffer))
-                                (get-process py-which-bufname)) ;XXX hack for .py buffers
+      (process-send-string python-process 
                             (format ipython-completion-command-string pattern))
-      (accept-process-output (get-buffer-process (current-buffer)))
+      (accept-process-output python-process)
       (setq completions 
             (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
                                         ;(message (format "DEBUG completions: %S" completions))
diff --git a/doc/manual_base.lyx b/doc/manual_base.lyx
index 0c92b33..d00b2c9 100644
--- a/doc/manual_base.lyx
+++ b/doc/manual_base.lyx
@@ -1663,7 +1663,8 @@ this means that your terminal doesn't properly handle color escape sequences.
  
 \layout Standard
 
-You can try using a different terminal emulator program.
+You can try using a different terminal emulator program (Emacs users, see
+ below).
  To permanently set your color preferences, edit the file
 \family typewriter 
  $HOME/.ipython/ipythonrc 
@@ -1834,10 +1835,8 @@ Once you put these files in your Emacs path, all you need in your
 .emacs
 \family default 
  file is:
-\layout Standard
-
+\layout LyX-Code
 
-\family typewriter 
 (require 'ipython)
 \layout Standard
 
@@ -1849,6 +1848,17 @@ C-c\SpecialChar ~
 \family default 
 , etc.
  
+\layout Standard
+
+If you happen to get garbage instead of colored prompts as described in
+ the previous section, you may need to set also in your 
+\family typewriter 
+.emacs
+\family default 
+ file:
+\layout LyX-Code
+
+(setq ansi-color-for-comint-mode t)
 \layout Subsubsection*
 
 Notes