- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是一次令人沮丧的精妙练习。出于某种原因,我的 python-mode/elpy 缓冲区总是有 intent-tabs-mode nil
.我使用的是 python 模式 6.2.3、elpy 1.32.0 和 emacs 25.2.2。我的 .emacs 文件包含:
;; =============================================================================
;; Trying to get indentation to be tabs of width 4 spaces in Python is a real
;; pain. For some unknown reason, unlike EVERY other progmode file in the distro
;; python.el contains this gem:
;;
;; 5480: (set (make-local-variable 'tab-width) 8)
;;
;; which clobbers any defaults you might have, no questoins asked. It also has
;; this wonderful nugget:
;;
;; 5481: (set (make-local-variable 'indent-tabs-mode) nil)
;;
;; Because someone wants to force using spaces (so wby bother forcing
;; tab-width?)
;; -----------------------------------------------------------------------------
;; Do this first. Because of the above, if you don't python.el will clobber
;; your attempts to customize this stuff.
(load "python-mode")
;; Now follow the instructions sprinked all over the Interwebs by the thousands
;; of people frustrated by the above clobbering.
(add-hook 'python-mode-hook
;; Don't forget lambda(), God forbid
(lambda ()
;; Now set the tab-width you really want here and cross your fingers
(setq tab-width 4)
;; And tell python-mode to use tabs. I know lots of folks hate on
;; tabs, but whatever.
(setq indent-tabs-mode t)
;; If you want to make sure you don't have trailing whitespaces
;; at the end of line, uncomment this.
;;(add-to-list 'write-file-functions 'delete-trailing-whitespace)
)
)
indent-tabs-mode
遗体
nil
.当然,仅在 python 模式下。来自
describe-variable
从 python 模式/elpy 缓冲区中:
indent-tabs-mode is a variable defined in ‘C source code’.
Its value is nil
Original value was t
Local in buffer config; global value is t
Automatically becomes buffer-local when set.
This variable is safe as a file local variable if its value
satisfies the predicate ‘booleanp’.
Documentation:
Indentation can insert tabs if this is non-nil.
You can customize this variable.
"Python-mode starts `indent-tabs-mode' with the value specified here, default is nil. "
:type 'boolean
:tag "py-indent-tabs-mode"
:group 'python-mode)
["indent-tabs-mode"
(setq indent-tabs-mode
(not indent-tabs-mode))
:help "Indentation can insert tabs if this is non-nil.
Use `M-x customize-variable' to set it permanently"
:style toggle :selected indent-tabs-mode]
(defun py-toggle-indent-tabs-mode ()
"Toggle `indent-tabs-mode'.
Returns value of `indent-tabs-mode' switched to. "
(interactive)
(when
(setq indent-tabs-mode (not indent-tabs-mode))
(setq tab-width py-indent-offset))
(when (and py-verbose-p (called-interactively-p 'any)) (message "indent-tabs-mode %s py-indent-offset %s" indent-tabs-mode py-indent-offset))
indent-tabs-mode)
(defun py-indent-tabs-mode (arg &optional iact)
"With positive ARG switch `indent-tabs-mode' on.
With negative ARG switch `indent-tabs-mode' off.
Returns value of `indent-tabs-mode' switched to. "
(interactive "p")
(if (< 0 arg)
(progn
(setq indent-tabs-mode t)
(setq tab-width py-indent-offset))
(setq indent-tabs-mode nil))
(when (and py-verbose-p (or iact (called-interactively-p 'any))) (message "indent-tabs-mode %s py-indent-offset %s" indent-tabs-mode py-indent-offset))
indent-tabs-mode)
(defun py-indent-tabs-mode-on (arg)
"Switch `indent-tabs-mode' on. "
(interactive "p")
(py-indent-tabs-mode (abs arg)(called-interactively-p 'any)))
(defun py-indent-tabs-mode-off (arg)
"Switch `indent-tabs-mode' off. "
(interactive "p")
(py-indent-tabs-mode (- (abs arg))(called-interactively-p 'any)))
;; unconditional Hooks
;; (orgstruct-mode 1)
(add-hook 'python-mode-hook
(lambda ()
(setq imenu-create-index-function py--imenu-create-index-function)
(setq indent-tabs-mode py-indent-tabs-mode)))
(remove-hook 'python-mode-hook 'python-setup-brm)
["indent-tabs-mode"
(setq indent-tabs-mode
(not indent-tabs-mode))
:help "Indentation can insert tabs if this is non-nil.
Use `M-x customize-variable' to set it permanently"
:style toggle :selected indent-tabs-mode]
["Tab indent"
(setq py-tab-indent
(not py-tab-indent))
:help "Non-nil means TAB in Python mode calls `py-indent-line'.Use `M-x customize-variable' to set it permanently"
:style toggle :selected py-tab-indent]
indent-tabs-mode
的任何 *.el 文件中找到的任何定义的每个版本。至
t
没有任何效果。
最佳答案
事实证明,对于某些版本的 python.el,您需要添加(是的!)另一个项目。这终于奏效了:
;; =============================================================================
;; Trying to get indentation to be tabs of width 4 spaces in Python is a real
;; pain. For some unknown reason, unlike EVERY other progmode file in the distro
;; python.el contains this gem:
;;
;; 5480: (set (make-local-variable 'tab-width) 8)
;;
;; which clobbers any defaults you might have, no questoins asked. It also has
;; this wonderful nugget:
;;
;; 5481: (set (make-local-variable 'indent-tabs-mode) nil)
;;
;; Because someone wants to force using spaces (so wby bother forcing
;; tab-width?)
;; -----------------------------------------------------------------------------
;; Do this first. Because of the above, if you don't python.el will clobber
;; your attempts to customize this stuff.
(load "python-mode")
;; Now follow the instructions sprinked all over the Interwebs by the thousands
;; of people frustrated by the above clobbering.
(add-hook 'python-mode-hook
;; Don't forget lambda(), God forbid
(lambda ()
;; Now set the tab-width you really want here and cross your fingers
(setq tab-width 4)
;; And tell python-mode to use tabs. I know lots of folks hate on
;; tabs, but whatever.
(setq indent-tabs-mode t)
;; Some verions of python.el use this, others don't
(setq py-indent-tabs-mode t)
;; If you want to make sure you don't have trailing whitespaces
;; at the end of line, uncomment this.
;;(add-to-list 'write-file-functions 'delete-trailing-whitespace)
)
)
关于emacs - emacs python-mode/elpy 中的制表符和空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60123265/
使用制表符 - 最初,当我构建表时,我可以在列定义中提供验证选项: {title:"Rating", field:"rating", editor:"input", validator:"requir
在 Notepad++ 中有一个非常方便的按钮,我可以按下它来查看空格、制表符和换行符所在的符号,这样我就可以看到哪些空格是由空格引起的,哪些是由制表符引起的。我可以在 emacs 中做到这一点吗?如
我在 .NET Windows 窗体应用程序中使用 RichTextBox 控件。我允许用户在文本框本身内按 TAB 键。但是,当我将 .Text 值保存在文本框中时,它将显示如下: "This[]i
我想知道如何使用 Interactive Demo 上使用的选择器来清除过滤器对于性别标题。 最佳答案 如果您询问如何向选择 header 过滤器添加空选项,则只需在 headerFilterPara
我有一个包含搜索结果的制表器。这是代码: var table = new Tabulator("#json-table", { layout:"fitDataFill", //init
我正在尝试构建一个可由用户修改的交互式表格。就我而言,原始数据集是本地对象数组。 制表符具有用于删除行的buttonCross选项,但它仅影响表格视觉效果。如何让它找到该行呈现的匹配对象并将其从表数据
我正在制作许多原始 html 表格并使用它们将它们转换为制表符 var table = new Tabulator("#main", { layout:"fitColumns", to
这个问题在这里已经有了答案: Any way for a combo box with 2 values per line? (3 个答案) 关闭 9 年前。 我有一个包含各种项目的 CSV 文件。
我是 JavaScript 的新手,目前正在学习如何使用 Tabulator(除此问题外它工作得很好)。 我想为每个列标题添加一个菜单按钮,然后打开一个下拉菜单。从此菜单中,用户应该能够选择“Grou
我正在尝试处理文本区域中的粘贴代码,并希望对粘贴到第一个非间距字符的内容进行左 trim 。我想采用以下代码: if (foo) { console.log(bar);
我预计 TAB 字符会比 SPACE 字符宽,但在 HTML5 canvas 中,它们是相同的。加上其他一些,这不是那么重要: var c=document.getElementById('mycan
在 shell(GNU bash,版本 4.2.47(1)-release (x86_64-suse-linux-gnu))中,当我点击自动完成选项卡时,“$”在之后被转义变量名称已完成,但如果没有完
我正在制作一个程序,我将从 mysql 表中的 txt 文件加载数据。我将创建具有特定字段的表,然后我将从其中的 txt 文件加载数据。我正在使用 java 来执行该程序。 我写的是下面的内容: pr
Tabulator 有一个名为Column Calculations 的模块。 我需要添加页面总和和总和 例如,我可以添加页脚来计算总和,但我无法添加可见行总和,或者换句话说当前页面的总和仅在同一时间
我不是 javascript 专家,所以我有一个简短的问题,有人知道如何在这里使用 JavaScript tabifier - http://www.barelyfitz.com/projects/t
这是我之前问题的延续(如果你好奇,请检查它们)。 我已经看到了隧道尽头的曙光,但还有最后一个问题。 出于某种原因,每一行都以制表符开头。 我怎样才能忽略第一个字符(在我的例子中是“制表符”(\t))?
请指教以下理解问题??? 我在我的 Linux 机器上输入:(以便通过 top 命令获取总内存) top -n1 | grep Mem: Mem: 2075024k total, 2059064
我该如何解决这个问题: 原因: java.lang.IllegalArgumentException: String [\t] with length 2 cannot be co
1.用法 \t 表示制表符,相当于制表符 前面的输出内容位数为8的倍数,\t将输出8个空格 前面的输出内容位数不是8的倍数,\t将补足8位 2.测试用例 少于8位 等于8位 大于8位
我正在尝试将 Tabulator v4.6.3 与 fitData 布局一起使用。这是我的代码: var table = new Tabulator("#cowTable", { da
我是一名优秀的程序员,十分优秀!