Skip to content
This repository

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

Merged
merged 1 commit into from over 2 years ago

2 participants

Kefu Chai Min RK
Kefu Chai

fix "--colors=" option in py-python-command-args. otherwise ipython is launched with "-i --colors LightBG" arguments.

Min RK
Owner

How does this differ from existing PR #757?

Kefu Chai

PR #757 tells if user specifies his/her own color scheme by looking at the py-python-command-args as my patch does. That's correct. But if user follows the the new syntax, it won't work as expect. Because:

(member "--colors" py-python-command-args)

fails to match --colors=LightBG. while my patch matches the arguments with (string-match "^--colors=*" x) where string-match matches the elements in the argument list with a regular expression of ^--color=* . That's the right way to go, IMHO.

Other than this, we are basically the same. And I am sending PR #765 in which I replace all tab with four spaces.

Kefu Chai

just re-submitted PR #766 which is better formatted and more concise.

Min RK
Owner

You don't need to keep reissuing pull requests, they are not static. If you push again to the same branch, it will change the pull request. You can clobber existing changes with push -f.

Kefu Chai

thanks a lot. minrk. =)

I just pushed the latest commit.

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"))
2
Min RK Owner
minrk added a note September 06, 2011

While you are fixing args, you might fix '-pylab' to '--pylab'. '-pylab' is technically allowed, but throws a deprecation warning, because it doesn't match the existing pattern.

thanks. fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Kefu Chai fix "--colors=<color>" option in py-python-command-args. otherwise ip…
…ython is launched with "-i --colors LightBG" arguments.
4d5cb6d
Min RK
Owner

Okay, then I'll go ahead and merge, as this seems straightforward and useful.

Min RK minrk merged commit db29245 into from September 06, 2011
Min RK minrk closed this September 06, 2011
Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
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 ip…
…ython is launched with "-i --colors LightBG" arguments.
4d5cb6d
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 13 additions and 12 deletions. Show diff stats Hide diff stats

  1. 25  docs/emacs/ipython.el
25  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,18 @@ 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)
221  
-      (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"))))))
  220
+    (unless (delq nil
  221
+                  (mapcar (lambda (x) (eq (string-match "^--colors=*" x) 0))
  222
+                          py-python-command-args))
  223
+      (push (format "--colors=%s"
  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")))
  231
+            py-python-command-args))
231 232
     (unless (equal ipython-backup-of-py-python-command py-python-command)
232 233
       (setq ipython-backup-of-py-python-command py-python-command))
233 234
     (setq py-python-command ipython-command))
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.