Ispell in Emacs

Ispell-buffer

Ispell-buffer如果没有错显示"spell-checking done",否则就在屏幕上显示可选择拼写“At the top of the screen, Ispell opens a small window that displays alternative spellings, numbered starting with 0. The mini-buffer says C-h or ? for more options, SPC to leave unchanged, character to replace word.”

i        可以将单词加入大Private dictionary, 默认是.ispell_<language> in your directory.

u        insert the word in your dictionary in lowercase.

r        to replace a word yourself. "Replacement for: new-word RET" 手动设置为new-word中的内容

R        Ispell start a query-replace, "Query-replacement for old-word: new-word RET" 进入到查询匹配了。然后你就可以使用!,Space等命令实现无询问替换。

a        to skip over it, a is accept. ignore a misspelled word for the rest of the session for all buffer

A        one subtle difference: it tells Ispell to accept this word for this session but only in this buffer

Space    ignore a misspell word

C-u M-$  for resume


Checking a single word

M-$      "That doesn't look right " for ispell-word


Completing a word

M-Tab    "How is that spelled?" for ispell-complete-word


Flyspell

flyspell highlights misspelled words and checkingexisting text.

M-x flyspell-mode RET    check text,Fly appears on the mode line.

M-x flyspell-prog-mode   designed for programmer, highlight misspellings only in comments or strings.

M-x flyspell-buffer RET  To check existing text. like Ispell-buffer. but it will underline all the suspected words


flyspell-buffer vs ispell-buffer

flyspell-buffer will spell-checks the entire buffer, and underline the misspell words. but ispell-buffer move to unrecognized words-> a screen have proper name -> the next unrecognized word


如何查看Private directory

上面i 命令的时候已经说了它会在.ispell_<language>文件中,但是有的 时候他会默认在.aspell.language.pws中,因为在Emacs中执行命令ispell-check-version 你会发现它内部实际上时通过Aspell来检查的。如果这样的话,你最好通过命令$ sudo find / -mount  -name '.aspell*' 最终你会发现它是文件/home/ryu/.aspell.en.pws


Word Abbreviations


Dynamic Abbreviation

  Dynamic abbreviation come to rescue long technical words in your paper. you simply type a few letter and give command M-/(for dabbrev-expand),Emacs insert the nearest word that start with that string.

  比如你现在输入了单词 interesting .... invertebrates; 现在如果你输入in M-/, in就会自动变为离他最近的以in开头的invertebrates,如果继续按M-/它就会变为interesting.


Word Abbreviation Mode

  Let you define abbreviation for special words and phrases.

  When you define abbreviations, never use abbreviations that are words in Emacs.because expansion takes place without asking.

  如果你仅仅想这个简写在text-mode下生效的话,定义它为local, 另一方面如果你想让他在任何mode都生效的话,定义为global. Remember: abbreviation are local to modes. not to files or buffers.


Trying word abbreviations for one session

procedure:

1:M-x abbrev-mode RET Abbrev appears on the mode line.and type the abbreviation you want. then:

    C-x a i g or C-x a-    for add-inverse-global

    C-x a i l              for add-inverse-local

比如CL -> Common lisp . 然后每次你输入CL然后敲入空格或标点的话,都会自动变为Common lisp.

2: exit Emacs, it ask if you want to save the abbreviation in .abbrev_defs. y for yes.

3: abbreviation work only in buffers where you enter abbrev mode, 简写的自动转换只会在副模式包含abbrev的buffer中生效。


Deleting a word abbreviation

M-x list-abbrev RET  display the list. 然后可以用编辑命令进行删除了,比如C-k删除一行。你最好别对它进行添加行,修改行操作。容易出错。

M-x edit-abbrev RET  edit the list.    

执行完上面中的任何一个操作,M-x write-abbrev-file      save file


disabling word abbreviation

M-x kill-all-abbrevs RET   disables for current session

read-abbrev-file           delete this line in your .emacs file for startup.


Abbreviation and capitalization

先记清下面三组概念 abbreviation : 是你加入这个简写时的字符组合。 definition:是你想要替换成的字符串。you type 就是你现在敲入的形式。abbreviation 与 you type进行匹配的时候时不区分大小写的。现在关键是看后面两个的形式,它们决定了最后展开为的形式。

1:如果定义包含一个大写字母的话,不论你现在敲入的格式,它都会展开成你定义时的形式。如果输入的都是大写例外,这个时候它等价与下面2.c情况。

2: 如果你定义的都是小写。

   a:现在你输入的都是小写,展开成都是小写。

   b:现在你输入的只要有一个为大写,展开形式的第一个字母大写。

   c:如果你输入的都是大写形式,如果abbrev-all-caps为T,展开的都是大写形式,否则展开的是所有的单词第一个字母都大写。

如果你定义的时候包含任何一个大写字母的话,当你再输入的时候,


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值