Skip to content
This repository

fix "--colors=<color>" option in py-python-command-args. #765

Closed
wants to merge 1 commit into from

1 participant

Kefu Chai
Kefu Chai

fix "--colors=" option in py-python-command-args. otherwise python fails to launch with "-i --colors LightBG" arguments.

Kefu Chai fix "--colors=<color>" option in py-python-command-args. otherwise py…
…thon fails to launch with "-i --colors LightBG" arguments.
7cadf9a
Kefu Chai

sorry, I changed something not in this commit. closing this PR.

Kefu Chai tchaikov closed this September 06, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 07, 2011
Kefu Chai fix "--colors=<color>" option in py-python-command-args. otherwise py…
…thon fails to launch with "-i --colors LightBG" arguments.
7cadf9a
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 21 additions and 19 deletions. Show diff stats Hide diff stats

  1. 40  docs/emacs/ipython.el
40  docs/emacs/ipython.el
@@ -36,7 +36,7 @@
36 36
 ;; always in ``pylab`` mode with hardcoded light-background colors, you can
37 37
 ;; use::
38 38
 ;;
39  
-;; (setq py-python-command-args '("-pylab" "--colors" "LightBG"))
  39
+;; (setq py-python-command-args '("-pylab" "--colors=LightBG"))
40 40
 ;;
41 41
 ;;
42 42
 ;; NOTE: This mode is currently somewhat alpha and although I hope that it
@@ -217,17 +217,19 @@ the second for a 'normal' command, and the third for a multiline command.")
217 217
     (setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *"
218 218
           py-shell-input-prompt-2-regexp "^   [.][.][.]+: *" )
219 219
     ;; select a suitable color-scheme
220  
-    (unless (member "--colors" py-python-command-args)
  220
+    (unless (delq nil
  221
+          (mapcar (lambda (x) (eq (string-match "^--colors=*" x) 0))
  222
+              py-python-command-args))
221 223
       (setq py-python-command-args
222  
-            (nconc py-python-command-args
223  
-                   (list "--colors"
224  
-                         (cond
225  
-                           ((eq frame-background-mode 'dark)
226  
-                            "Linux")
227  
-                           ((eq frame-background-mode 'light)
228  
-                            "LightBG")
229  
-                           (t ; default (backg-mode isn't always set by XEmacs)
230  
-                            "LightBG"))))))
  224
+            (cons (format "--colors=%s"
  225
+              (cond
  226
+               ((eq frame-background-mode 'dark)
  227
+                "Linux")
  228
+               ((eq frame-background-mode 'light)
  229
+                "LightBG")
  230
+               (t ; default (backg-mode isn't always set by XEmacs)
  231
+                "LightBG")))
  232
+          py-python-command-args)))
231 233
     (unless (equal ipython-backup-of-py-python-command py-python-command)
232 234
       (setq ipython-backup-of-py-python-command py-python-command))
233 235
     (setq py-python-command ipython-command))
@@ -243,7 +245,7 @@ buffer already exists."
243 245
       ad-do-it
244 246
     (setq comint-input-ring-file-name
245 247
           (if (string-equal py-python-command ipython-command)
246  
-              (concat (or (getenv "IPYTHONDIR") "~/.ipython") "/history")
  248
+              (concat (or (getenv "IPYTHON_DIR") "~/.ipython") "/history")
247 249
             (or (getenv "PYTHONHISTORY") "~/.python-history.py")))
248 250
     (comint-read-input-ring t)
249 251
     (let ((buf (current-buffer)))
@@ -263,8 +265,8 @@ buffer already exists."
263 265
   "HACK: if `py-shell' is not active or ASYNC is explicitly desired, fall back
264 266
   to python instead of ipython."
265 267
   (let ((py-which-shell (if (and (comint-check-proc "*Python*") (not async))
266  
-			    py-python-command
267  
-			  ipython-backup-of-py-python-command)))
  268
+                py-python-command
  269
+              ipython-backup-of-py-python-command)))
268 270
     ad-do-it))
269 271
 (ad-activate 'py-execute-region)
270 272
 
@@ -347,12 +349,12 @@ in the current *Python* session."
347 349
                           (setq ugly-return (concat ugly-return string))
348 350
                           (delete-region comint-last-output-start
349 351
                                          (process-mark (get-buffer-process (current-buffer)))))))))
350  
-	;(message (format "#DEBUG pattern: '%s'" pattern))
  352
+    ;(message (format "#DEBUG pattern: '%s'" pattern))
351 353
         (process-send-string python-process
352 354
                               (format ipython-completion-command-string pattern))
353 355
         (accept-process-output python-process)
354  
-	
355  
-	;(message (format "DEBUG return: %s" ugly-return))
  356
+    
  357
+    ;(message (format "DEBUG return: %s" ugly-return))
356 358
         (setq completions
357 359
               (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
358 360
         (setq completion-table (loop for str in completions
@@ -473,10 +475,10 @@ matches last process output."
473 475
         (text (ansi-color-filter-apply (buffer-substring start-marker end-marker))))
474 476
    ;; XXX if `text' matches both pattern, it MUST be the last prompt-2
475 477
    (when (and (string-match py-shell-input-prompt-2-regexp text)
476  
-	      (not (string-match "\n$" text)))
  478
+          (not (string-match "\n$" text)))
477 479
      (with-current-buffer (ipython-get-indenting-buffer)
478 480
        (setq ipython-indentation-string
479  
-	     (buffer-substring (point-at-bol) (point))))
  481
+         (buffer-substring (point-at-bol) (point))))
480 482
      (goto-char end-marker)
481 483
      (insert ipython-indentation-string)
482 484
      (setq ipython-indentation-string nil))))
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.