##// END OF EJS Templates
add autoexec option
vivainio -
Show More
@@ -26,17 +26,12 b' ip = IPython.ipapi.get()'
26
26
27 import os
27 import os
28
28
29 def main():
29 def main():
30 # Handy tab-completers for %cd, %run, import etc.
30
31 # Try commenting this out if you have completion problems/slowness
32 # import ipy_stock_completers
33
34 # uncomment if you want to get ipython -p sh behaviour
31 # uncomment if you want to get ipython -p sh behaviour
35 # without having to use command line switches
32 # without having to use command line switches
36
37 # import ipy_profile_sh
33 # import ipy_profile_sh
38
34
39
40 # Configure your favourite editor?
35 # Configure your favourite editor?
41 # Good idea e.g. for %edit os.path.isfile
36 # Good idea e.g. for %edit os.path.isfile
42
37
@@ -62,13 +57,22 b' def main():'
62 #import_all("os sys")
57 #import_all("os sys")
63 #execf('~/_ipython/ns.py')
58 #execf('~/_ipython/ns.py')
64
59
60
61 # -- prompt
65 # A different, more compact set of prompts from the default ones, that
62 # A different, more compact set of prompts from the default ones, that
66 # always show your current location in the filesystem:
63 # always show your current location in the filesystem:
67
64
68 #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
65 #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
69 #o.prompt_in2 = r'.\D: '
66 #o.prompt_in2 = r'.\D: '
70 #o.prompt_out = r'[\#] '
67 #o.prompt_out = r'[\#] '
71
68
69 # Try one of these color settings if you can't read the text easily
70 # autoexec is a list of IPython commands to execute on startup
71 #o.autoexec.append('%colors LightBG')
72 #o.autoexec.append('%colors NoColor')
73 #o.autoexec.append('%colors Linux')
74
75
72 # some config helper functions you can use
76 # some config helper functions you can use
73 def import_all(modules):
77 def import_all(modules):
74 """ Usage: import_all("os sys") """
78 """ Usage: import_all("os sys") """
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2919 2007-12-31 14:45:55Z vivainio $
9 $Id: iplib.py 2930 2008-01-11 07:03:11Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -591,6 +591,7 b' class InteractiveShell(object,Magic):'
591 auto_alias = ()
591 auto_alias = ()
592 self.auto_alias = [s.split(None,1) for s in auto_alias]
592 self.auto_alias = [s.split(None,1) for s in auto_alias]
593
593
594
594 # Produce a public API instance
595 # Produce a public API instance
595 self.api = IPython.ipapi.IPApi(self)
596 self.api = IPython.ipapi.IPApi(self)
596
597
@@ -601,9 +602,12 b' class InteractiveShell(object,Magic):'
601 self.builtins_added = {}
602 self.builtins_added = {}
602 # This method will add the necessary builtins for operation, but
603 # This method will add the necessary builtins for operation, but
603 # tracking what it did via the builtins_added dict.
604 # tracking what it did via the builtins_added dict.
605
606 #TODO: remove this, redundant
604 self.add_builtins()
607 self.add_builtins()
605
608
606
609
610
607
611
608 # end __init__
612 # end __init__
609
613
@@ -710,6 +714,10 b' class InteractiveShell(object,Magic):'
710
714
711 self.hooks.late_startup_hook()
715 self.hooks.late_startup_hook()
712
716
717 for cmd in self.rc.autoexec:
718 #print "autoexec>",cmd #dbg
719 self.api.runlines(cmd)
720
713 batchrun = False
721 batchrun = False
714 for batchfile in [path(arg) for arg in self.rc.args
722 for batchfile in [path(arg) for arg in self.rc.args
715 if arg.lower().endswith('.ipy')]:
723 if arg.lower().endswith('.ipy')]:
@@ -6,7 +6,7 b' Requires Python 2.1 or better.'
6
6
7 This file contains the main make_IPython() starter function.
7 This file contains the main make_IPython() starter function.
8
8
9 $Id: ipmaker.py 2913 2007-12-31 12:42:14Z vivainio $"""
9 $Id: ipmaker.py 2930 2008-01-11 07:03:11Z vivainio $"""
10
10
11 #*****************************************************************************
11 #*****************************************************************************
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
@@ -190,6 +190,7 b" object? -> Details about 'object'. ?object also works, ?? prints more."
190 autoedit_syntax = 0,
190 autoedit_syntax = 0,
191 autoindent = 0,
191 autoindent = 0,
192 automagic = 1,
192 automagic = 1,
193 autoexec = [],
193 banner = 1,
194 banner = 1,
194 c = '',
195 c = '',
195 cache_size = 1000,
196 cache_size = 1000,
@@ -1,3 +1,12 b''
1 2008-01-11 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
4 of ipython commands to be run when IPython has started up
5 (just before running the scripts and -c arg on command line).
6
7 * ipy_user_conf.py: Added an example on how to change term
8 colors in config file (through using autoexec).
9
1 2008-01-10 Ville Vainio <vivainio@gmail.com>
10 2008-01-10 Ville Vainio <vivainio@gmail.com>
2
11
3 * Prompts.py (set_p_str): do not crash on illegal prompt strings
12 * Prompts.py (set_p_str): do not crash on illegal prompt strings
General Comments 0
You need to be logged in to leave comments. Login now