-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemacs-coding.html
More file actions
122 lines (101 loc) · 4.31 KB
/
emacs-coding.html
File metadata and controls
122 lines (101 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-05-18 三 19:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Emacs使用</title>
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="org-html-themes/src/bigblow_theme/css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="org-html-themes/src/bigblow_theme/css/bigblow.css"/>
<link rel="stylesheet" type="text/css" href="org-html-themes/src/bigblow_theme/css/hideshow.css"/>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/jquery-ui-1.10.2.min.js"></script>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/jquery.localscroll-min.js"></script>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/jquery.scrollTo-1.4.3.1-min.js"></script>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/jquery.zclip.min.js"></script>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/bigblow.js"></script>
<script type="text/javascript" src="org-html-themes/src/bigblow_theme/js/hideshow.js"></script>
<script type="text/javascript" src="org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
</head>
<body>
<div id="content" class="content">
<h1 class="title">Emacs使用</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#org92a89e4">1. 文本文件显示异常( 中文utf-8编码 )</a></li>
<li><a href="#orge1388ff">2. flycheck 入门</a></li>
<li><a href="#orgc8ff467">3. 快捷键查看</a></li>
<li><a href="#org8c884bd">4. 标签页</a></li>
</ul>
</div>
</div>
<div id="outline-container-org92a89e4" class="outline-2">
<h2 id="org92a89e4"><span class="section-number-2">1.</span> 文本文件显示异常( 中文utf-8编码 )</h2>
<div class="outline-text-2" id="text-1">
<p>
emacs 打开包含中文的文本文件后中文显示为8进制
但在vim等编辑器中却显示正常
</p>
<p>
用下面的命令可以将读取编码硬换成 <code>utf-8</code> , 但指标不治本, 下次打开显示依然异常.
</p>
<pre class="example">
M-x revert-buffer-with-coding-system
utf-8-unix
</pre>
<p>
网上有人遇到类似的问题, 据说是因为文件中包含了空字节,导致文件被识别成了二进制文件. 而emacs的默认行为是 “进行空字节检测” ,这就导致了文本文件被识别成了二进制的数据文件.( file命令显示为data类型, 而不是XX编码的文本文件 )
</p>
<p>
解决思路有二:
</p>
<ul class="org-ul">
<li>要么关闭emacs的"空字节检测" : <code>(setq inhibit-null-byte-detection t )</code></li>
<li>要么去除文本文件中的空字节: <code>sed -i s/"\x0"// FILE.TXT</code></li>
</ul>
<p>
<b>参考</b>
</p>
<ul class="org-ul">
<li><a href="https://emacs.stackexchange.com/questions/21467/getting-no-conversion-nil-encoding-each-time-when-opening-a-file-which-should">https://emacs.stackexchange.com/questions/21467/getting-no-conversion-nil-encoding-each-time-when-opening-a-file-which-should</a></li>
<li><a href="https://lists.gnu.org/archive/html/emacs-devel/2018-11/msg00071.html">https://lists.gnu.org/archive/html/emacs-devel/2018-11/msg00071.html</a></li>
</ul>
</div>
</div>
<div id="outline-container-orge1388ff" class="outline-2">
<h2 id="orge1388ff"><span class="section-number-2">2.</span> flycheck 入门</h2>
<div class="outline-text-2" id="text-2">
<p>
显示所有问题:
flycheck-list-errors
</p>
</div>
</div>
<div id="outline-container-orgc8ff467" class="outline-2">
<h2 id="orgc8ff467"><span class="section-number-2">3.</span> 快捷键查看</h2>
<div class="outline-text-2" id="text-3">
<p>
C-h b
c-h k
</p>
</div>
</div>
<div id="outline-container-org8c884bd" class="outline-2">
<h2 id="org8c884bd"><span class="section-number-2">4.</span> 标签页</h2>
<div class="outline-text-2" id="text-4">
<p>
c-x t b/0/1/2
</p>
<p>
c-m-space
</p>
</div>
</div>
</div>
</body>
</html>