[IPython-user] ipython problems within Carbon Emacs on Leopard

kmt@ftm... kmt@ftm...
Sat Jan 12 19:59:51 CST 2008


I'm glad to hear Alexander Schmolck is getting a mac soon because I
fail to fix this by myself in a proper way (unfortunately I'm both
quite ignorant and lacking time).

I managed to hack something that works for me (both on Linux and Mac),
but it's quite ugly and I don't fully understand why it works.  What I
did was: 

1) My ugly-return included the formatted
   ipython-completion-command-string for some reason.  I had to get
   rid of it.

2) Somehow the ugly-return was coming partial and in an inconsistent
   way.  A combination of adding parameters to accept-process-output
   and debug messages to comint-preoutput-filter-functions seem to
   take care of this.  I have no idea exactly why but it works (in
   this particular combination).  I hate coding this way and hate to
   email it back to you in this form but have no choice since I'm not
   really an elisp programmer and I don't have much time to learn it
   at the moment.

Here's my patch, in case it's at all interesting:

*** ipython.el.ORIG	Fri Jan 11 19:10:41 2008
--- ipython.el	Sat Jan 12 20:43:36 2008
***************
*** 382,396 ****
             (completions nil)
             (completion-table nil)
             completion
!          (comint-preoutput-filter-functions
!           (append comint-preoutput-filter-functions 
!                   '(ansi-color-filter-apply
!                     (lambda (string) 
!                       (setq ugly-return (concat ugly-return string))
!                       "")))))
        (process-send-string python-process 
                              (format ipython-completion-command-string pattern))
!       (accept-process-output python-process)
        (setq completions 
              (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
                                          ;(message (format "DEBUG completions: %S" completions))
--- 382,400 ----
             (completions nil)
             (completion-table nil)
             completion
! 	   (comint-preoutput-filter-functions
! 	    (append comint-preoutput-filter-functions 
! 		    '(ansi-color-filter-apply
! 		      (lambda (string) 
! 			(setq ugly-return (concat ugly-return string))
! 			(message (format "DEBUG comint %S" ugly-return))
! 			(message "")
! 			"")))))
        (process-send-string python-process 
                              (format ipython-completion-command-string pattern))
!       (accept-process-output python-process 3 0 t)
!       (cond ((string-match (substring ipython-completion-command-string -10) ugly-return)
! 	     (setq ugly-return (substring ugly-return (match-end 0)))))
        (setq completions 
              (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
                                          ;(message (format "DEBUG completions: %S" completions))






More information about the IPython-user mailing list