mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 02:31:03 -08:00
Merge from origin/emacs-29
212e30f678; Fix byte-compilation warnings in c-ts-mode.el1f2214dabdSkip over whitespace in annotation-top-cont check (bug#63...7e136c51f6Update zh-CN tutorial translationd3ca0b3aa2; * lisp/progmodes/c-ts-mode.el: Fix comments and doc str...c6f15c2486; Fix last change.b9e06330f7; * etc/NEWS: Followup to bug#62720.b33d25f596; Minor improvements in doc strings of package-upgrade co...c3a61870b9Fix eglot.texi # Conflicts: # etc/NEWS
This commit is contained in:
commit
e155df7da7
7 changed files with 146 additions and 98 deletions
|
|
@ -1275,9 +1275,15 @@ pop up special buffers that can be used to inspect the communications
|
|||
between the Eglot and language server. In many cases, this will
|
||||
indicate the problems or at least provide a hint.
|
||||
|
||||
@menu
|
||||
* Performance::
|
||||
* Getting the latest version::
|
||||
* Reporting bugs::
|
||||
@end menu
|
||||
|
||||
@node Performance
|
||||
@section Performance
|
||||
@cindex performance
|
||||
@cindex performance problems, with Eglot
|
||||
A common and easy-to-fix cause of performance problems is the length
|
||||
of the Eglot events buffer because it represent additional work that
|
||||
Eglot must do. After verifying Eglot is operating correctly but
|
||||
|
|
@ -1293,23 +1299,26 @@ configuration}).
|
|||
|
||||
@node Getting the latest version
|
||||
@section Getting the latest version
|
||||
@cindex updating Eglot
|
||||
@cindex upgrading Eglot
|
||||
|
||||
To install the latest Eglot on an Emacs version that does not bundle
|
||||
To install the latest Eglot in an Emacs version that does not bundle
|
||||
Eglot, use @kbd{M-x package-install}.
|
||||
|
||||
Often, a newer Eglot version exists that has fixed a longstanding bug,
|
||||
has more LSP features, or just better support for a particular
|
||||
language server. Recent Eglot versions can self-update via the
|
||||
command @kbd{M-x eglot-update}. This will replace any currently
|
||||
installed version with the newest one available from the ELPA archives
|
||||
has more LSP features, or just better supports a particular language
|
||||
server. Recent Eglot versions can self-update via the command
|
||||
@kbd{M-x eglot-update}. This will replace any currently installed
|
||||
version with the newest one available from the ELPA archives
|
||||
configured in @code{package-archives}.
|
||||
|
||||
You may update though other methods, such as @code{package-install},
|
||||
@code{use-package}, @code{list-packages} or the newer
|
||||
@code{package-update}. However, do read the docstrings of these
|
||||
commands, as some may not work in exactly the same way across Emacs
|
||||
versions, meaning your configuration may be not portable.
|
||||
You can also update Eglot through other methods, such as
|
||||
@code{use-package} (@pxref{Installing packages,,, use-package,
|
||||
use-package User Manual}), @code{package-install},
|
||||
@code{list-packages} or the newer @code{package-upgrade}
|
||||
(@pxref{Packages,,, emacs, GNU Emacs Manual}). However, do read the
|
||||
docstrings of the command you intend to use before you use it, as some
|
||||
of them may not work in exactly the same way across Emacs versions,
|
||||
meaning your configuration may be not portable.
|
||||
|
||||
@node Reporting bugs
|
||||
@section Reporting bugs
|
||||
|
|
|
|||
|
|
@ -1845,11 +1845,16 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'.
|
|||
+++
|
||||
*** New command 'package-upgrade'.
|
||||
This command allows you to upgrade packages without using 'M-x
|
||||
list-packages'.
|
||||
list-packages'. A package that comes with the Emacs distribution can
|
||||
only be upgraded after you install, once, a newer version from ELPA
|
||||
via the package-menu displayed by 'list-packages'.
|
||||
|
||||
+++
|
||||
*** New command 'package-upgrade-all'.
|
||||
This command allows upgrading all packages without any queries.
|
||||
A package that comes with the Emacs distribution will only be upgraded
|
||||
by this command after you install, once, a newer version of that
|
||||
package from ELPA via the package-menu displayed by 'list-packages'.
|
||||
|
||||
+++
|
||||
*** New commands 'package-recompile' and 'package-recompile-all'.
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ META 键(有时候用 EDIT 或 ALT 来标示)。为了避免每次都要写
|
|||
ESC 键。
|
||||
|
||||
重要提示:要退出 Emacs,请用 C-x C-c(两个连续的组合键)。
|
||||
要退出一个正在运行中的命令,请用 C-g。
|
||||
要中断一个正在输入的命令,请用 C-g。
|
||||
下文中左边顶行的“>>”字样用来提示你尝试键盘命令。比如:
|
||||
<<Blank lines inserted around following line by help-with-tutorial>>
|
||||
[本页当中特意留出一些空白是出于教学目的,请继续往后阅读]
|
||||
【本页当中特意留出一些空白是出于教学目的,请继续往后阅读】
|
||||
>> 现在输入 C-v (查看下一屏文字)移动到下一屏。
|
||||
(别紧张,在输入字符 v 的同时注意要按住 CONTROL 键)
|
||||
从现在开始,每读完当前一屏你都需要这样做一次。
|
||||
|
|
@ -26,12 +26,17 @@ META 键(有时候用 EDIT 或 ALT 来标示)。为了避免每次都要写
|
|||
值得注意的是,当你从上一屏滚到下一屏时,中间会有两行的重复;这样做是为
|
||||
了维持滚屏的连续性,方便你顺畅、连续地阅读。
|
||||
|
||||
这是 Emacs 教程文本的一个经过少量修改的副本。不久后我们会让你尝试不同
|
||||
的命令来修改此文本。若你在我们提到这些命令前修改了文本,不要担心;这就
|
||||
叫做“编辑”,而这就是 Emacs 存在的根本原因。
|
||||
|
||||
用编辑器,开门第一件事就是学会在文字中移动。你已经知道了 C-v 可以向下移
|
||||
动一屏,要往上移,请用 M-v (也就是按住 META 键,然后输入v,如果你没有
|
||||
META、EDIT 或 ALT 键那么就先按 <ESC> 再按 v)。
|
||||
|
||||
>> 试试 M-v,然后再试试 C-v,来回遛几次。
|
||||
|
||||
若你知道其他移动文本的方式,也可以在这里试试。
|
||||
|
||||
* 小结(SUMMARY)
|
||||
-----------------
|
||||
|
|
@ -101,7 +106,7 @@ P 代表 previous(上一行),N 代表 next(下一行),B 代表 backw
|
|||
|
||||
如果你嫌一个字符一个字符地挪光标太慢,你还可以一个词一个词地跳。M-f
|
||||
(META-f) 可以将光标往前移动一个词,而 M-b 则是往后移。【这里的“词”指
|
||||
英文单词,对中文来说,则是指移动到下一个标点符号。】
|
||||
英文单词,对中文来说,则是指移动到下一个空格或标点符号。】
|
||||
|
||||
>> 试试 M-f 和 M-b。
|
||||
|
||||
|
|
@ -132,8 +137,8 @@ P 代表 previous(上一行),N 代表 next(下一行),B 代表 backw
|
|||
C-f 向右移动一个字符
|
||||
C-b 向左移动一个字符
|
||||
|
||||
M-f 向右移动一个词【对中文是移动到下一个标点符号】
|
||||
M-b 向左移动一个词【对中文是移动到上一个标点符号】
|
||||
M-f 向右移动一个词【对中文是移动到下一个空格或标点符号】
|
||||
M-b 向左移动一个词【对中文是移动到上一个空格或标点符号】
|
||||
|
||||
C-n 移动到下一行
|
||||
C-p 移动到上一行
|
||||
|
|
@ -160,24 +165,25 @@ M-comma(META 逗号)。
|
|||
然后再按几次 M-v 回到这里。
|
||||
|
||||
如果你的键盘上有方向键的话,也可以用它们来移动光标。不过我们有三个理由
|
||||
推荐你学习 C-b 、C-f 、C-n 、和 C-p:(1)它们在任何键盘上都能用。(2)
|
||||
当你熟练使用 Emacs 之后,你会发现用这些组合键比用方向键要快得多,因为你
|
||||
的手不需要离开打字区。(3)一旦你习惯了使用这些组合键,你也可以很容易地
|
||||
适应其它更高级的光标移动命令。
|
||||
推荐你学习 C-b 、C-f 、C-n 、和 C-p:(1)它们在任何终端(terminal)上
|
||||
都能用。(2)当你熟练使用 Emacs 之后,你会发现用这些组合键比用方向键要
|
||||
快得多,因为你的手不需要离开打字区。(3)一旦你习惯了使用这些组合键,
|
||||
你也可以很容易地适应其它更高级的光标移动命令。
|
||||
|
||||
大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的作
|
||||
用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方法
|
||||
是:先输入 C-u,然后输入数字作为参数,最后再输入命令。如果你有META (或
|
||||
EDIT 或 ALT)键,那么还有另一种办法:按住 META 键不放,然后输入数字。不
|
||||
过我们还是建议你用 C-u,因为它在任何终端机上都能用。这种数字参数也称为
|
||||
“前缀参数”,意思是说这个参数是先于使用它的命令而输入的。
|
||||
大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的
|
||||
作用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方
|
||||
法是:先输入 C-u,然后输入数字作为参数,最后再输入命令。如果你有
|
||||
META(或EDIT 或 ALT)键,那么还有另一种办法:按住 META 键不放,然后输
|
||||
入数字。不过我们还是建议你用 C-u,因为它在任何终端上都能用。这种数字参
|
||||
数也称为“前缀参数”(prefix argument),意思是说这个参数是先于使用它的
|
||||
命令而输入的。
|
||||
|
||||
举例来说, C-u 8 C-f 会向前移动 8 个字符。
|
||||
|
||||
>> 为 C-n 或者 C-p 指定一个数字参数,这样你可以只用一个命令就把光标移动
|
||||
到本行的附近。
|
||||
|
||||
虽然大部分命令把数字参数解释为其重复次数,但是也有些命令例外,它们将数
|
||||
虽然大部分命令把数字参数解读为其重复次数,但是也有些命令例外,它们将数
|
||||
字参数另做它用。比如有些命令(我们目前还没学到)仅仅将前缀参数作为一个
|
||||
标志――只要给出有一个前缀参数,不管其值为何,它都会改变命令的功能。
|
||||
|
||||
|
|
@ -235,8 +241,8 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
|
|||
|
||||
C-x 1 只保留一个窗格(也就是关掉其它所有窗格)。
|
||||
|
||||
也就是先按 CONTROL-x 然后再按 1。C-x 1 会保留光标所在的窗格,并将其扩大
|
||||
到整个屏幕,同时关掉所有其它的窗格。
|
||||
也就是先按 CONTROL-x 然后再按数字 1。C-x 1 会保留光标所在的窗格,并将
|
||||
其扩大到整个屏幕,同时关掉所有其它的窗格。
|
||||
|
||||
>> 把光标移到本行然后输入 C-u 0 C-l。
|
||||
|
||||
|
|
@ -266,9 +272,10 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
|
|||
不用担心文件被修改,你做什么都没关系,这里就是专给你练习用的。
|
||||
|
||||
如果一行文字很长、超出了窗格的宽度,显示不下的部分会在紧邻的下一行继续
|
||||
显示。如果你使用的是图形界面,文本区域两边的狭窄区域(左右“边缘”)会出
|
||||
现小小的转弯箭头,表明这是某一行的接续显示。如果你使用的是文本终端,接
|
||||
续显示由屏幕最右边一列的一个反斜线(“\”)来表示。
|
||||
显示,称为接续行(continuation line)。如果你使用的是图形界面,文本区
|
||||
域两边的狭窄区域(左右“边缘”)会出现小小的转弯箭头,表明这是某一行的接
|
||||
续显示。如果你使用的是文本终端,接续显示由屏幕最右边一列的一个“\”来表
|
||||
示。
|
||||
|
||||
>> 输入文字,一直到屏幕的右边界,然后继续。
|
||||
你会看到一个接续行出现。
|
||||
|
|
@ -286,7 +293,9 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
|
|||
|
||||
<Return> 是一个特殊的键,因为按下这个键后,得到的可能不仅仅是一个换行
|
||||
符。根据周围文本的不同,Emacs 可能会在换行符之后插入一些空白字符,这样,
|
||||
当你在新的一行开始打字时,文本会自动与前一行对齐。
|
||||
当你在新的一行开始打字时,文本会自动与前一行对齐。我们称这种行为(在按
|
||||
这个按键时不只是插入其对应字符)为“electric”,可以理解为“通电的,自动
|
||||
的”。
|
||||
|
||||
>> 这是一个自动缩进的例子。
|
||||
在这一行的末尾输入 <Return>。
|
||||
|
|
@ -338,7 +347,8 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
|
|||
了。】重新插入被移除的文字称为“召回(yank)”。一般而言,那些可能消除很
|
||||
多文字的命令会把消除掉的文字记录下来(它们被设定成了“可召回”),而那些
|
||||
只消除一个字符或者只消除空白的命令就不会记录被消除的内容(自然你也就无
|
||||
法召回了)。
|
||||
法召回了)。<DEL> 和 C-d 在无前缀参数的情况下进行“删除”,而有前缀参数
|
||||
时则改用“移除”。
|
||||
|
||||
>> 移动光标到一非空白行的行头,然后输入 C-k 移除那一行上的文字。
|
||||
|
||||
|
|
@ -350,10 +360,11 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
|
|||
C-k 会把两行以及它们的换行符移除;而如果只是输入 C-k 两次显然不是这个结
|
||||
果。
|
||||
|
||||
重新插入被移除的文字恢复的动作称为“召回(yanking)”。(就好像把别人从你身边
|
||||
移走的东西又猛力地拉回来。)你可以在你删除文字的地方召回,也可以在别的
|
||||
地方召回,还可以多次召回同样的文字以得到它的多个拷贝。很多其它的编辑器
|
||||
把移除和召回叫做“剪切”和“粘贴” (详情可见 Emacs 使用手册里的术语表)。
|
||||
【重新插入被移除的文字恢复的动作称为“召回(yanking)”,就好像把别人
|
||||
从你身边移走的东西又猛力地拉回来。】你可以在你删除文字的地方召回,也
|
||||
可以在别的地方召回,还可以多次召回同样的文字以得到它的多个拷贝。很多其
|
||||
它的编辑器把移除和召回叫做“剪切”和“粘贴” (详情可见 Emacs 使用手册里的
|
||||
术语表)。
|
||||
|
||||
召回的命令是 C-y。它会在光标所在处插入你最后移除的文字。
|
||||
|
||||
|
|
@ -372,8 +383,8 @@ C-y 就可以把它们都召回。
|
|||
C-y 可以召回最近一次移除的内容,那如何召回前几次移除的内容呢?它们当然
|
||||
没有丢,你可以用 M-y 来召回它们。在用 C-y 召回最近移除的文字之后,紧接
|
||||
着再按 M-y 就可以召回再前一次被移除的内容,再按一次 M-y 又可以召回再上
|
||||
一次的……连续使用 M-y 直到找到你想要召回的东西,然后什么也不用做,继续
|
||||
编辑就行了。
|
||||
一次的内容……连续使用 M-y 直到找到你想要召回的东西,然后什么也不用做,
|
||||
继续编辑就行了。
|
||||
|
||||
如果连续按 M-y 很多次,你可能会回到起始点,也就是最近移除的文字。
|
||||
【看得出这实际上是一个环。】
|
||||
|
|
@ -401,14 +412,16 @@ C-/,你会把以前的命令也依次撤销。
|
|||
|
||||
>> 用 C-k 将这一行移除,然后输入 C-/ ,它会再次出现。
|
||||
|
||||
C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在
|
||||
某些终端上,输入 C-/ 实际上向 Emacs 发送的是 C-_ 。
|
||||
另外, C-x u 和 C-/ 完全一样,但是按起来有些麻烦。
|
||||
C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在某些
|
||||
终端上,你可以不按 shift 键(即 C--)。在某些终端上,输入 C-/ 实际上向
|
||||
Emacs 发送的是 C-_ 。另外, C-x u 和 C-/ 完全一样,但是按起来有些麻烦。
|
||||
|
||||
数字参数对于 C-/ 、 C-_ 和 C-x u 的意义是执行撤销的重复次数。
|
||||
|
||||
你可以撤销文字的删除,就像你能撤销文字的移除一样。删除与移除的区别只在
|
||||
于你是否能召回被影响的文字;对于撤销来说没有区别。
|
||||
|
||||
* 文件(FILE)
|
||||
* 文件(FILES)
|
||||
--------------
|
||||
|
||||
想保存工作成果就要记得存盘,否则一旦退出 Emacs 你编辑的文字就会丢失。要
|
||||
|
|
@ -435,14 +448,14 @@ Emacs 会提示你输入文件名。你输入的文件名会出现在屏幕最
|
|||
行被称为小缓冲(minibuffer),在小缓冲里你可以使用通常的 Emacs 编辑命令
|
||||
来编辑文件名。
|
||||
|
||||
在小缓冲里输入文件名(其实输入其它东西也一样)时可以用 C-g 取消。
|
||||
在小缓冲里输入文件名(其实输入其它东西也一样)时可以用 C-g 取消这个命令。
|
||||
|
||||
>> 输入 C-x C-f,然后输入 C-g
|
||||
这会关掉小缓冲,同时也会取消使用小缓冲的 C-x C-f 命令。
|
||||
当然了,你也没有找任何文件。
|
||||
当然了,你也没有找到任何文件。
|
||||
|
||||
用 <Return> 结束文件名的输入。之后,小缓冲会消失,C-x C-f 将会去寻找你
|
||||
指定的文件。小缓冲在 C-x C-f 命令结束之后也会消失。
|
||||
当你写完要寻找的文件名时,用 <Return> 结束文件名的输入。之后,小缓冲会
|
||||
消失,C-x C-f 将会去寻找你指定的文件。
|
||||
|
||||
文件被显示在了屏幕上,你可以开始编辑了。存盘用这条命令:
|
||||
|
||||
|
|
@ -453,20 +466,21 @@ Emacs 会提示你输入文件名。你输入的文件名会出现在屏幕最
|
|||
【对许多人来说,这是一个烦人的特性,关掉文件备份可以用如下命令:
|
||||
M-x customize-variable <Return> make-backup-files <Return>】
|
||||
|
||||
存盘结束后,Emacs 会显示写入文件的文件名。你最好养成经常存盘的习惯,这
|
||||
可以减少系统崩溃和死机给你带来的损失(也可参见下面的“自动保存”一节)。
|
||||
存盘结束后,Emacs 会显示写入文件的文件名。【你最好养成经常存盘的习惯,
|
||||
这可以减少系统崩溃和死机给你带来的损失(也可参见下面的“自动保存”一
|
||||
节)。】
|
||||
|
||||
>> 输入 C-x C-s TUTORIAL.cn <Return> 。
|
||||
这将会把该指南保存为一个名为 TUTORIAL.cn 的文件,并且在屏幕的下方显
|
||||
示一条消息:“Wrote ...TUTORIAL.cn”。
|
||||
示一条消息:“Wrote TUTORIAL.cn”。
|
||||
|
||||
你不但可以寻找一个已有的文件来查看或编辑,还可以寻找一个不存在的文件。
|
||||
实际上这正是 Emacs 创建新文件的方法:找到不存在的新文件。事实上,只有
|
||||
在存盘的时候,Emacs 才会真正创建这个文件。而在这之后的一切就跟编辑一个
|
||||
已有文件没有区别了。
|
||||
实际上这正是 Emacs 创建新文件的方法:找到不存在的新文件,它一开始是空
|
||||
的,然后你就可以开始插入文本。事实上,只有在存盘的时候,Emacs 才会真正
|
||||
创建这个文件。而在这之后的一切就跟编辑一个已有文件没有区别了。
|
||||
|
||||
|
||||
* 缓冲区(BUFFER)
|
||||
* 缓冲区(BUFFERS)
|
||||
------------------
|
||||
|
||||
你可以用 C-x C-f 找到并打开第二个文件,但第一个文件仍然在 Emacs 中。要
|
||||
|
|
@ -495,7 +509,7 @@ C-x C-f 是一种办法。不过还有一个更简单的办法,那就是用 C-
|
|||
然后输入 C-x b TUTORIAL.cn <Return> 回到这里。
|
||||
|
||||
大多数情况下,缓冲区与跟其对应的文件是同名的(不包括目录名),不过这也
|
||||
不是绝对的。用 C-x C-b 得到的缓冲区列表总是显示缓冲区名。
|
||||
不是绝对的。因此用 C-x C-b 得到的缓冲区列表总是显示缓冲区名与文件名。
|
||||
|
||||
缓冲区未必有对应文件。显示缓冲区列表的缓冲区(叫做“*Buffer List*”)就
|
||||
是这样。这个 TUTORIAL.cn 缓冲区起初没有对应的文件,但是现在有了,因为
|
||||
|
|
@ -516,8 +530,8 @@ C-x C-f 是一种办法。不过还有一个更简单的办法,那就是用 C-
|
|||
|
||||
C-x s 保存多个缓冲区
|
||||
|
||||
C-x s 会找出所有已被修改但尚未存盘的缓冲区,然后向你逐个询问:是否需要
|
||||
存盘?
|
||||
C-x s 会找出所有访问文件的、且已被修改但尚未存盘的缓冲区,然后向你逐个
|
||||
询问:是否需要存盘此文件?
|
||||
|
||||
>> 插入一行文字,然后输入 C-x s。
|
||||
它应该会问你,是否要储存名为 TUTORIAL.cn 的缓冲区?
|
||||
|
|
@ -554,7 +568,9 @@ C-x 的扩展命令有很多,下面列出的是你已经学过的:
|
|||
|
||||
C-x C-f 寻找文件。
|
||||
C-x C-s 保存文件。
|
||||
C-x s 保存多个缓冲区。
|
||||
C-x C-b 列出缓冲区。
|
||||
C-x b 切换缓冲区。
|
||||
C-x C-c 离开 Emacs。
|
||||
C-x 1 关掉其它所有窗格,只保留一个。
|
||||
C-x u 撤销。
|
||||
|
|
@ -608,10 +624,10 @@ replace-string(字符串替换)这个命令,它会把一个字符串替换
|
|||
|
||||
状态栏显示了 Emacs 的状态和你正在编辑的文字的一些信息。
|
||||
|
||||
你应该知道文件名的意思吧?就是你找到的那个文件嘛。-NN%-- 显示的是光标在
|
||||
全文中的位置。如果位于文件的开头,那么就显示 --Top-- 而不是 --00%--;如
|
||||
果位于文件的末尾,就显示 --Bot--。如果文件很小,一屏就足以显示全部内容,
|
||||
那么状态栏会显示 --All--。
|
||||
你应该知道文件名的意思吧?就是你找到的那个文件嘛。NN% 显示的是光标在
|
||||
全文中的位置。如果位于文件的开头,那么就显示 Top 而不是 0%;如
|
||||
果位于文件的末尾,就显示 Bot。如果文件很小,一屏就足以显示全部内容,
|
||||
那么状态栏会显示 All。
|
||||
|
||||
“L” 和其后的数字给出了光标所在行的行号。
|
||||
|
||||
|
|
@ -723,7 +739,10 @@ C-s 是向前搜索,C-r 是向后搜索。不过手别这么快!别着急试
|
|||
* 多窗格(MULTIPLE WINDOWS)
|
||||
----------------------------
|
||||
|
||||
Emacs 的迷人之处很多,能够在屏幕上同时显示多个窗格就是其中之一。
|
||||
Emacs 的迷人之处很多,能够在屏幕上同时显示多个窗格就是其中之一。(请注
|
||||
意在 Emacs 里的“窗口(frame)”与“窗格(window)”的定义可能与其他应用程
|
||||
序不同,详见Emacs 手册里的术语表。)【另见此教程末尾的翻译章节的术语译
|
||||
词对照表。】
|
||||
|
||||
>> 移动光标到这一行,然后输入 C-l C-l。
|
||||
|
||||
|
|
@ -782,13 +801,13 @@ Emacs 可以创建多个窗口。窗口由许多窗格以及菜单、滚动条
|
|||
在图形界面下,多个窗口可以同时显示出来。在文本终端中,只能同时显示一个
|
||||
窗口。
|
||||
|
||||
>> 输入 M-x make-frame <Return>。
|
||||
>> 输入 C-x 5 2。
|
||||
可以看到一个新的窗口出现在了你的屏幕上。
|
||||
|
||||
你可以在新的窗口里做最初的窗口里可以做的任何事情。第一个窗口没有什么特
|
||||
别的。
|
||||
|
||||
>> 输入 M-x delete-frame <Return>.
|
||||
>> 输入 C-x 5 0。
|
||||
这个命令将会关闭选中的窗口。
|
||||
|
||||
你也可以通过图形系统来关闭某个窗口(通常是在窗口上面的某个角落里的一个
|
||||
|
|
@ -853,9 +872,9 @@ Emacs 可以创建多个窗口。窗口由许多窗格以及菜单、滚动条
|
|||
|
||||
还有一些其它有用的 C-h 命令:
|
||||
|
||||
C-h f 解释一个函数。需要输入函数名。
|
||||
C-h x 解释一个命令。需要输入命令名。
|
||||
|
||||
>> 试试看,输入 C-h f previous-line <Return>。
|
||||
>> 试试看,输入 C-h x previous-line <Return>。
|
||||
Emacs 会给出它所知道的所有有关“实现 C-p 命令功能的函数”的信息。
|
||||
|
||||
C-h v 用来显示 Emacs 变量的文档。Emacs 变量可以被用来“定制 Emacs 的行
|
||||
|
|
@ -905,15 +924,15 @@ Dired 能够在一个缓冲区里列出一个目录下的所有文件(可以
|
|||
|
||||
Emacs 使用手册里还有许许多多的精彩功能等着你来了解。
|
||||
|
||||
* 安装包裹(INSTALLING PACKAGES)
|
||||
* 安装软件包(INSTALLING PACKAGES)
|
||||
---------------------------
|
||||
|
||||
Emacs 社区著作了许多持有扩展性的包裹(packages),其中包括对各种语言的
|
||||
支持、色彩鲜艳的主题、用于集成外部程序的包裹,等等。
|
||||
Emacs 社区著作了许多持有扩展性的软件包(packages),其中包括对各种语言
|
||||
的支持、色彩鲜艳的主题、用于集成外部程序的软件包,等等。
|
||||
|
||||
使用 M-x list-packages 便可浏览存在的包裹。这个命令显示的界面中可以安
|
||||
装和卸载包裹,以及查看包裹的简介。Emacs 使用手册中有对包裹管理更详细的
|
||||
介绍。
|
||||
使用 M-x list-packages 便可浏览所有可安装的软件包。这个命令显示的界面
|
||||
中可以安装和卸载软件包,以及查看软件包的简介。Emacs 使用手册中有对软件
|
||||
包管理更详细的介绍。
|
||||
|
||||
* 总结(CONCLUSION)
|
||||
--------------------
|
||||
|
|
@ -929,6 +948,7 @@ Emacs 社区著作了许多持有扩展性的包裹(packages),其中包括
|
|||
|
||||
翻译:孙一江 <sunyijiang@gmail.com>
|
||||
维护:薛富侨 <xfq.free@gmail.com>
|
||||
余睿杰 <ruijie@netyu.xyz>
|
||||
校对:水木社区(www.newsmth.net)Emacs 板众多网友及众多 Emacs 中文用户
|
||||
|
||||
Emacs 快速指南(Tutorial)早有两个刘昭宏的中文译本,繁简各一。其简体版本
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Maintainer: Ognyan Kulev <ogi@tower.3.bg>
|
|||
* TUTORIAL.cn:
|
||||
Author: Sun Yijiang <sunyijiang@gmail.com>
|
||||
Maintainer: Xue Fuqiao <xfq.free@gmail.com>
|
||||
Ruijie Yu <ruijie@netyu.xyz>
|
||||
|
||||
* TUTORIAL.cs:
|
||||
Author: Milan Zamazal <pdm@zamazal.org>
|
||||
|
|
|
|||
|
|
@ -2266,8 +2266,9 @@ had been enabled."
|
|||
"Upgrade package NAME if a newer version exists.
|
||||
|
||||
Currently, packages which are part of the Emacs distribution
|
||||
cannot be upgraded that way. Use `i' after `M-x list-packages' to
|
||||
upgrade to an ELPA version first."
|
||||
cannot be upgraded that way. To enable upgrades of such a
|
||||
package using this command, first upgrade the package to a
|
||||
newer version from ELPA by using `\\<package-menu-mode-map>\\[package-menu-mark-install]' after `\\[list-packages]'."
|
||||
(interactive
|
||||
(list (completing-read
|
||||
"Upgrade package: " (package--upgradeable-packages) nil t)))
|
||||
|
|
@ -2304,7 +2305,11 @@ If QUERY, ask the user before upgrading packages. When called
|
|||
interactively, QUERY is always true.
|
||||
|
||||
Currently, packages which are part of the Emacs distribution are
|
||||
not upgraded that way. Use `i' after `M-x list-packages' to
|
||||
not upgraded by this command. To enable upgrading such a package
|
||||
using this command, first upgrade the package to a newer version
|
||||
from ELPA by using `\\<package-menu-mode-map>\\[package-menu-mark-install]' after `\\[list-packages]'.
|
||||
|
||||
Use `i' after `M-x list-packages' to
|
||||
upgrade to an ELPA version first."
|
||||
(interactive (list (not noninteractive)))
|
||||
(package-refresh-contents)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@
|
|||
(declare-function treesit-node-prev-sibling "treesit.c")
|
||||
(declare-function treesit-node-first-child-for-pos "treesit.c")
|
||||
(declare-function treesit-node-next-sibling "treesit.c")
|
||||
(declare-function treesit-parser-set-included-ranges "treesit.c")
|
||||
(declare-function treesit-query-compile "treesit.c")
|
||||
|
||||
;;; Custom variables
|
||||
|
||||
|
|
@ -971,24 +973,25 @@ if `c-ts-mode-emacs-sources-support' is non-nil."
|
|||
(or (treesit-add-log-current-defun)
|
||||
(c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point))))
|
||||
|
||||
;;; FOR_EACH_TAIL fix
|
||||
;;; Support for FOR_EACH_* macros
|
||||
;;
|
||||
;; FOR_EACH_TAIL (and FOR_EACH_TAIL_SAFE) followed by a unbracketed
|
||||
;; body will mess up the parser, which parses the thing as a function
|
||||
;; declaration. We "fix" it by adding a shadow parser, emacs-c (which
|
||||
;; is just c but under a different name). We use emacs-c to find each
|
||||
;; FOR_EACH_TAIL with a unbracketed body, and set the ranges of the C
|
||||
;; parser so that it skips those FOR_EACH_TAIL's. Note that we only
|
||||
;; ignore FOR_EACH_TAIL's with a unbracketed body. Those with a
|
||||
;; bracketed body parses more or less fine.
|
||||
;; FOR_EACH_TAIL, FOR_EACH_TAIL_SAFE, FOR_EACH_FRAME etc., followed by
|
||||
;; an unbracketed body will mess up the parser, which parses the thing
|
||||
;; as a function declaration. We "fix" it by adding a shadow parser
|
||||
;; for a language 'emacs-c' (which is just 'c' but under a different
|
||||
;; name). We use 'emacs-c' to find each FOR_EACH_* macro with a
|
||||
;; unbracketed body, and set the ranges of the C parser so that it
|
||||
;; skips those FOR_EACH_*'s. Note that we only ignore FOR_EACH_*'s
|
||||
;; with a unbracketed body. Those with a bracketed body parse more
|
||||
;; or less fine.
|
||||
|
||||
(defvar c-ts-mode--for-each-tail-regexp
|
||||
(rx "FOR_EACH_" (or "TAIL" "TAIL_SAFE" "ALIST_VALUE"
|
||||
"LIVE_BUFFER" "FRAME"))
|
||||
"A regexp matching all the FOR_EACH_TAIL variants.")
|
||||
"A regexp matching all the variants of the FOR_EACH_* macro.")
|
||||
|
||||
(defun c-ts-mode--for-each-tail-body-matcher (_n _p bol &rest _)
|
||||
"A matcher that matches the first line after a FOR_EACH_TAIL.
|
||||
"A matcher that matches the first line after a FOR_EACH_* macro.
|
||||
For BOL see `treesit-simple-indent-rules'."
|
||||
(when c-ts-mode-emacs-sources-support
|
||||
(save-excursion
|
||||
|
|
@ -1005,10 +1008,10 @@ For BOL see `treesit-simple-indent-rules'."
|
|||
@for-each-tail)
|
||||
(:match ,c-ts-mode--for-each-tail-regexp
|
||||
@_name))))
|
||||
"Query that finds the FOR_EACH_TAIL with a unbracketed body.")
|
||||
"Query that finds a FOR_EACH_* macro with an unbracketed body.")
|
||||
|
||||
(defvar-local c-ts-mode--for-each-tail-ranges nil
|
||||
"Ranges covering all the FOR_EACH_TAIL's in the buffer.")
|
||||
"Ranges covering all the FOR_EACH_* macros in the buffer.")
|
||||
|
||||
(defun c-ts-mode--reverse-ranges (ranges beg end)
|
||||
"Reverse RANGES and return the new ranges between BEG and END.
|
||||
|
|
@ -1031,7 +1034,7 @@ parser parse the whole buffer."
|
|||
(nreverse new-ranges))))
|
||||
|
||||
(defun c-ts-mode--emacs-set-ranges (beg end)
|
||||
"Set ranges for the C parser to skip some FOR_EACH_TAIL's.
|
||||
"Set ranges for the C parser to skip some FOR_EACH_* macros.
|
||||
BEG and END are described in `treesit-range-rules'."
|
||||
(let* ((c-parser (treesit-parser-create 'c))
|
||||
(old-ranges c-ts-mode--for-each-tail-ranges)
|
||||
|
|
@ -1158,6 +1161,8 @@ BEG and END are described in `treesit-range-rules'."
|
|||
( assignment constant escape-sequence label literal)
|
||||
( bracket delimiter error function operator property variable))))
|
||||
|
||||
(defvar treesit-load-name-override-list)
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode c-ts-mode c-ts-base-mode "C"
|
||||
"Major mode for editing C, powered by tree-sitter.
|
||||
|
|
@ -1179,7 +1184,7 @@ in your configuration."
|
|||
|
||||
(when (treesit-ready-p 'c)
|
||||
;; Add a fake "emacs-c" language which is just C. Used for
|
||||
;; skipping FOR_EACH_TAIL, see `c-ts-mode--emacs-set-ranges'.
|
||||
;; skipping FOR_EACH_* macros, see `c-ts-mode--emacs-set-ranges'.
|
||||
(setf (alist-get 'emacs-c treesit-load-name-override-list)
|
||||
'("libtree-sitter-c" "tree_sitter_c"))
|
||||
;; If Emacs source support is enabled, make sure emacs-c parser is
|
||||
|
|
@ -1202,7 +1207,7 @@ in your configuration."
|
|||
(setq-local treesit-defun-tactic 'top-level)
|
||||
(treesit-major-mode-setup)
|
||||
|
||||
;; Emacs source support: handle DEFUN and FOR_EACH_TAIL gracefully.
|
||||
;; Emacs source support: handle DEFUN and FOR_EACH_* gracefully.
|
||||
(when c-ts-mode-emacs-sources-support
|
||||
(setq-local add-log-current-defun-function
|
||||
#'c-ts-mode--emacs-current-defun-name)
|
||||
|
|
|
|||
|
|
@ -468,7 +468,10 @@ compilation and evaluation time conflicts."
|
|||
(save-excursion
|
||||
(goto-char (c-point 'iopl))
|
||||
(and
|
||||
(eq (char-after) ?\[)
|
||||
(eq (save-excursion
|
||||
(skip-chars-forward " \t\n")
|
||||
(char-after))
|
||||
?\[)
|
||||
(save-excursion
|
||||
(c-go-list-forward)
|
||||
(and (eq (char-before) ?\])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue