Table of Contents
- 1. Spacemacs
- 1.1. spacemacs file
- 1.2. project file
- 1.3. Open shell Windows
- 1.4. Emacs Base
- 1.4.1. Automatically delete unused package
- 1.4.2. Auto indent indent-region
- 1.4.3. di Red-mode
- 1.5. Configure Emacs To use the local ELPA library
- 1.5.1. Method 1
- 1.5.2. Method 2
/ul>
- 1.6 cannot start Pythonshell
- 2. Python
- 2.1. Builtin fuction
2.2. See methods for Python built-in functions
- 2.3. A test is not a unit test if:
- 3. Network problems
- 3.1. Using Lanter N and set up the GIT agent to resolve the Gitgub clone slow problem.
- 3.1.1. Lantern
- 3.1.2. started git proxy
- 4. rsync Sync Elpa Library
- 4.1. Download Windows client
- 4.2. Add the client Bin directory to the environment variable
4.3. Synchronizing the Elpa library
- 4.4. Adding automatic synchronization Tasks
1 Spacemacs1.1. spacemacs file1.2 Project Files
Create a new empty file under the project root directory:
. Projectile
1.3 Open Shell Windows
Hm-x Eshell m-x Shell
1.4 Emacs Basics1.4.1 Automatically delete unused package
M-x Package-autoremove
1.4.2 Auto Indent indent-region
C-m-\ automatically indents the selected code or indents all code
1.4.3 Dired-mode
+: Create a directory c-x c-f: Add a file G: Refresh directory C: Copy file D: Tag Delete file x: Execute all tags
1.5 Configuring Emacs to use the local ELPA library
After synchronizing the Elpa library to local, you want to let Emacs use the local library.
1.5.1 Method 1
Add the following code at the beginning of the. Emacs.d/init.el
(require ' package) (setq package-enable-at-startup nil) (setq package-archives ' (("~/.emacs.d/ mirror-elpa/melpa/") (" ~/.emacs.d/mirror-elpa/org/") ("~/.emacs.d/mirror-elpa/gnu/" )))
1.5.2 Method 2
If you are using Spacemacs, add the following code to the Defun dotspacemacs/user-init function under Windows using absolute path, format is//?/drive letter/folder, or you can put the image into your c:\users\< Your user name >\appdata\roaming directory and you can then use a path like ~/elpa-mirror/melpa/
(setq configuration-layer--elpa-archives ' (("//?/f:/elpa-mirror/melpa/") ("org-cn" "//?/f:/elpa-mirror/org/") ("//?/f:/elpa-mirror/gnu/" )))
Unable to start Pythonshell in 1.6 emacs
Every time you start a python shell, it's an error
Unknown option:--usage:c:\users\xxxxx\appdata\local\programs\python\python36-32\python.exe [option] ... [-C cmd |-M mod | file |-] [Arg] ... Try ' python-h ' for more information. Process Python exited abnormally with code 2
Workaround, M-x Customize-group, then enter the Python carriage return and find the Python shell interpreter args. Then change to-I, left state and select Save for future session. In the case of spacemacs, you need to write the parameters in the. spacemacs file into the dotspacemacs-configuration-layers python variable.
: Variables python-test-runner ' (nose pytest) "-I ")
2 python2.1 Builtin Fuction2.2 Ways to view Python built-in functions
Dir (__builtins__)
2.3 A test is not a unit test if:
- Read or write from the filesystem
- Read or write from the network
- Read or write from a database
- Cannot run tests in parallel
- Test suite depends on a environment configuration
- The execution order of the tests is important to make all tests passes
- Test is run not fast
3 Network problems3.1 use lantern and set up a git agent to solve the Gitgub clone slow problem. 3.1.1 Lantern
First, you need to download lantern, which is the link
3.1.2 STARTED git agent
Git currently supports three kinds of protocols git://, ssh://, and/HTTP, and its proxy configuration is different: Core.gitproxy for git://protocol, Http.proxy for the/HTTP protocol, ssh://Protocol agent needs to configure the SSH The Proxycommand parameter. All protocols are proxied using SSH tunneling
- Configuration of the GIT protocol
- Proxy port for Lantern:
HTTP (s) proxy server): 127.0.0.1:54932 socket Proxy: 127.0.0.1:54931 If you're not sure, double-clicking Lantern opens a Web page, clicks Settings, advanced Settings, The proxy configuration for the lantern is displayed.
- Download the Connect tool
Using the Https://bitbucket.org/gotoh/connect tool for proxy conversions, the distributions are generally packaged as Proxy-connect or Connect-proxy. After opening the link above, click Downloads at the bottom left of the page. Click Connect-1.104-win32-msvc.zip to download to local. Unzip the file and add the directory where the file Connect.exe to the path of the environment variable. Open the CMD Command window and enter connect enter. If prompted:
Connect---Simple relaying command via proxy. Version 1.104usage:c:\program Files\git\mingw64\bin\connect.exe [-dnhst45] [-P local-port] [-H proxy-server[: Port]] [-s [[email protected]]socks-server[:p ORT]] [-t proxy-server[:p ORT]] [-c Telnet-proxy-command] Host Port
Indicates that the configuration is correct.
- Create a Socks5proxywrapper file
#!/bin/"[email protected]"
- Configure Git to modify the. gitconfig file in your home directory, if not, create a new
[Core] Gitproxy = ~/socks5proxywrapper
Or
Export git_proxy_command= "~/socks5proxywrapper"
- Configuration of the SSH protocol
- Create a ~/soks5proxyssh file
#!/bin/proxycommand="[email protected]"
- Configure Git to use the wrapper
git_ssh="~/socks5proxyssh"
Of course, you can also directly configure the ~/.ssh/config Proxycommand
- Configuration of the HTTP protocol
Modify the. gitconfig file in your home directory, if not, create a new
[HTTP] #这里是因为 Git uses Libcurl to provide HTTP support proxy = socks5://127.0.0.1:54931
- All protocols use HTTP proxies
On the basis of the previous section, the/path/to/socks5proxywrapper file was changed to
#!/bin/shconnect-h 192.168.1.100:8080 "[Email protected]"
- HTTP protocol Configuration
[http] proxy = http://127.0.0.1:54931
- Enable proxies for domain names
The Gitproxy parameter provides a * for * structure, specifically looking at the core.gitproxy part of the man Git-config.
4 rsync sync Elpa Library4.1 Download Windows client
Connection Address
4.2 Adding the Client bin directory to the environment variable
- Unzip the installation package to any location.
- Add the client path to the path variable right-click on the computer Properties advanced system settings Advanced "Environment variables"
Locate the path variable of the system variable and click the Edit button. WINDOWS10 System Click New, enter the client's Bin directory absolute path (such as: F:\rsync\bin), click OK. Windows other versions of the system, add the path to the last value.
4.3 synchronizing Elpa libraries
Rsync-avzp–delete rsync://mirrors.tuna.tsinghua.edu.cn/elpa//cygdrive/f/elpa-mirror
The-delete option indicates that the data on the client is exactly the same as the server side, and if there are files that do not exist on the server in the Linuxsirhome directory, it is deleted. The ultimate goal is to make the data on the Linuxsirhome directory fully consistent with the server, so be careful when using it, it is best not to use the directory that has important numbers as the local update directory, otherwise it will delete all your data;/cygdrive/f/elpa-mirror To synchronize to a local directory. Configuration file in the write path when the format to be converted, for example, I put the directory in the F-disk, then write/cygdrive/f/your directory
The entire image accounts for about 1 Gb,emacs-china rsync address: rsync://elpa.emacs-china.org/elpa/downstream Tsinghua Mirrors's Elpa image also provides the Rsync service, the address is: rsync: The mirrors.tuna.tsinghua.edu.cn/elpa/upstream GNU Elpa and Melpa provide the Rsync service with addresses such as: rsync://elpa.gnu.org/elpa/rsync:// melpa.org/packages/
4.4 Adding automatic synchronization Tasks
Add synchronization commands to the Task List in window for automatic synchronization
- Save the synchronization command to a text file that ends in cmd
- Adding a task schedule to a window, different systems, a little differently. Windows Xp/server 2003: Start-Up, Control Panel, Task Scheduler, open Add Task Scheduler, next Windows 7/ Server 2008: Start, Control Panel, Administrative Tools, Task Scheduler, Windows 10, enter Task Scheduler in run to open the Task Scheduler panel in general, fill in the task name, set the synchronization interval in the trigger, and specify the file to execute in the action.
created:2017-08-23 Wednesday 08:08
Spacemacs and Python learning-the record of the pit