[emacs] emacs设置python code的indent
装python-mode的包
https://gitlab.com/python-mode-devs/python-mode/tree/master
python-mode
emacswiki文档
emacswiki文档里的配置方法是这样提供的
https://www.emacswiki.org/emacs/IndentingPython
(add-hook 'python-mode-hook
(lambda ()
(setq-default indent-tabs-mode t)
(setq-default tab-width 4)
(setq-default py-indent-tabs-mode t)
(add-to-list 'write-file-functions 'delete-trailing-whitespace)))
我的配置
通过实践,并阅读了python-mode.el的源码,发现上面的配置并不生效。
应如下配置:
(add-hook 'python-mode-hook
(lambda ()
(setq-default py-indent-offset 8)
(setq-default py-indent-tabs-mode t)))
可能不好使。。。。。 TOBE continue。。。
update @ 2019-01-23
上面的配置,果然不好使。然后我就自己研究了一下。
首先删除了melpa中的python-mode包。因为emacs自带一个python mode在python.el中。
通过查询help信息可以查到
C^x + h + v + python-mode
通过阅读源码,分析出如下的配置信息:
(add-hook 'python-mode-hook
(lambda ()
(setq indent-tabs-mode t)
(whitespace-mode t)
(display-line-numbers-mode t)
(fci-mode t)))
通过测试,可以生效。
另外,后三行是我自有的配置,与本文主题无关。
结案。
[emacs] emacs设置python code的indent的更多相关文章
- Emacs as a Python IDE(转)
赋闲脱产的半年里,自己用C++/Java/Lisp胡乱写了几万行的代码,到了现在的公司,给OpenStack项目贴牛皮藓,反倒是Python用得最多.作为公司里面唯一的Emacser(没准也是 公司里 ...
- 安装Emacs并设置racket环境
最近在阅读sicp这本书,书中的代码是使用scheme实现的.之前阅读的时候是使用Dr.Racket来完成写练习的,可我觉得与其这样,不如一步到位,使用emacs+lisp解释器来的比较快. 安装em ...
- 如何在Windows系统中设置Python程序定时运行
文章出处:http://blog.csdn.net/wwy11/article/details/51100432 首先,我们肯定是要用到Windows下的[计划任务]功能 之后点击右侧的[创建基本任务 ...
- 【Python】Part I 设置Python环境
01 设置Python环境 02 破解WingIDE (1)下载专业版wingide http://wingware.com/downloads/wing-pro/6.0.11-1/binaries& ...
- PEP 8 – Style Guide for Python Code
原文:PEP 8 – Style Guide for Python Code PEP:8 题目:Python代码风格指南 作者:Guido van Rossum, www.yszx11.cnBarry ...
- Exploring Python Code Objects
Exploring Python Code Objects https://late.am/post/2012/03/26/exploring-python-code-objects.html Ins ...
- 机器学习算法实现(R&Python code)
Machine Learning Algorithms Machine Learning Algorithms (Python and R) 明天考试,今天就来简单写写机器学习的算法 Types Su ...
- How to run Python code from Sublime
How to run Python Code from Sublime,and How to run Python Code with input from sublime Using Sublime ...
- PyCharm设置Python版本
PyCharm默认会使用虚拟的Python解释器,即使没有安装也能够运行Python代码,但有强迫症的程序员一定不能忍受Project中存在这么多的文件目录 设置Python版本 File->S ...
随机推荐
- Linux shell 脚本总结
在中括号中,判断变量的值, 加不加双引号的问题? -z 判断 变量的值,是否为空: zero = 0 - 变量的值,为空,返回0,为true - 变量的值,非空,返回1,为false -n 判断变量的 ...
- uni-app调用原生的文件系统管理器(可选取附件上传)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Sharding-JDBC
1.官网文档:https://shardingsphere.apache.org/document/legacy/3.x/document/cn/manual/sharding-jdbc/usage/ ...
- 饮冰三年-人工智能-Python-20 Python线程、进程、线程
进程:最小的数据单元 线程:最小的执行单元 一: 1:线程1 import threading #线程 import time def Music(): print("Listen Musi ...
- Jmeter性能测试之Monitor监控(四)
使用Jmeter(该篇文章使用的版本最高为3.1, 3.1+的版本存在兼容性问题)做性能测试, 要监控服务器硬件资源消耗情况, 可以使用扩展插件完成. 1. 服务端插件下载agent, 点击这里 , ...
- SQL insert
INSERT INTO 插入语句 INSERT INTO语句用于在表中插入新记录. 可以用两种方式编写INSERT INTO语句. 第一种方法指定列名和要插入的值: 1 2 INSERT INTO t ...
- BeanPostProcessors (for example: not eligible for auto-proxying),报错解决
最近遇到个问题,springmvc项目debug启动失败 debug启动会卡住不动,run模式启动正常 debug启动输出到下面这行之后,就不会继续输出了 -- :: [INFO]- Bean 'da ...
- [转]Windows下安装storm-0.9.1
来源:https://www.cnblogs.com/liuruitao/p/4669657.html Windows下安装storm-0.9.1的详细步骤如下: 1.确定已经正确安装JDK1.6或J ...
- BZOJ3160 万径人踪灭 字符串 多项式 Manachar FFT
原文链接http://www.cnblogs.com/zhouzhendong/p/8810140.html 题目传送门 - BZOJ3160 题意 给你一个只含$a,b$的字符串,让你选择一个子序列 ...
- 3.基于梯度的攻击——PGD
PGD攻击原论文地址——https://arxiv.org/pdf/1706.06083.pdf 1.PGD攻击的原理 PGD(Project Gradient Descent)攻击是一种迭代攻击,可 ...