Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@tchaikov

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

@minrk
Owner

How does this differ from existing PR #757?

@tchaikov

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.

@tchaikov

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

@minrk
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.

@tchaikov

thanks a lot. minrk. =)

I just pushed the latest commit.

docs/emacs/ipython.el
@@ -36,7 +36,7 @@
;; always in ``pylab`` mode with hardcoded light-background colors, you can
;; use::
;;
-;; (setq py-python-command-args '("-pylab" "--colors" "LightBG"))
+;; (setq py-python-command-args '("-pylab" "--colors=LightBG"))
@minrk Owner
minrk added a note

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.

@tchaikov
tchaikov added a note

thanks. fixed.

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

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

@minrk minrk merged commit db29245 into ipython:master
@ellisonbg ellisonbg referenced this pull request from a commit
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
Commits on Sep 7, 2011
  1. @tchaikov

    fix "--colors=<color>" option in py-python-command-args. otherwise ip…

    tchaikov authored
    …ython is launched with "-i --colors LightBG" arguments.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 12 deletions.
  1. +13 −12 docs/emacs/ipython.el
View
25 docs/emacs/ipython.el
@@ -36,7 +36,7 @@
;; always in ``pylab`` mode with hardcoded light-background colors, you can
;; use::
;;
-;; (setq py-python-command-args '("-pylab" "--colors" "LightBG"))
+;; (setq py-python-command-args '("--pylab" "--colors=LightBG"))
;;
;;
;; 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.")
(setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *"
py-shell-input-prompt-2-regexp "^ [.][.][.]+: *" )
;; select a suitable color-scheme
- (unless (member "--colors" py-python-command-args)
- (setq py-python-command-args
- (nconc py-python-command-args
- (list "--colors"
- (cond
- ((eq frame-background-mode 'dark)
- "Linux")
- ((eq frame-background-mode 'light)
- "LightBG")
- (t ; default (backg-mode isn't always set by XEmacs)
- "LightBG"))))))
+ (unless (delq nil
+ (mapcar (lambda (x) (eq (string-match "^--colors=*" x) 0))
+ py-python-command-args))
+ (push (format "--colors=%s"
+ (cond
+ ((eq frame-background-mode 'dark)
+ "Linux")
+ ((eq frame-background-mode 'light)
+ "LightBG")
+ (t ; default (backg-mode isn't always set by XEmacs)
+ "LightBG")))
+ py-python-command-args))
(unless (equal ipython-backup-of-py-python-command py-python-command)
(setq ipython-backup-of-py-python-command py-python-command))
(setq py-python-command ipython-command))
Something went wrong with that request. Please try again.