最近几天在学习emacs lisp manual。看了一些基础语法,看到char-table的时候,不清楚这是个什么数据结构,还有用在什么地方。
问问题之前就看过这个回答了。感觉上像是个链表、又像个map。不过还是不知道这个东西在emacs中的实际应用。能举个栗子不?
ELISP> (type-of (standard-syntax-table))
char-table
ELISP> (type-of find-word-boundary-function-table)
char-table
Uses of char-tables include:
• Case tables (*note Case Tables::).
• Character category tables (*note Categories::).
• Display tables (*note Display Tables::).
• Syntax tables (*note Syntax Tables::).
你不是天天都在用吗 当你ctrl x ctrl f的时候 已经在用了
特种数据结构,用于一大片key(key是char)对应一个value的情况,比如可以用来储存grapheme break property
http://www.unicode.org/Public/10.0.0/ucd/auxiliary/GraphemeBreakProperty.txt
1 个赞
正好我开发doom-modeline
用到了char table,我来说说应用场景吧。Emacs 计算字符宽度时会用到char table,如果增加一些 unicode char (包括 icon),但没有正确设置 char table,计算长度时就会发生错误,默认是 1。
1 个赞