怎么使用原生 Android 版本的 Emacs: Difference between revisions
Tags: Mobile edit Mobile web edit |
|||
| (53 intermediate revisions by the same user not shown) | |||
| Line 25: | Line 25: | ||
== 文件夹 == | == 文件夹 == | ||
怎么让原生安卓版本的 Emacs 访问你的安卓里的文件夹呢? | |||
<syntaxhighlight lang="elisp"> | <syntaxhighlight lang="elisp"> | ||
# 授予管理所有文件的权限 | # 授予管理所有文件的权限 | ||
| Line 34: | Line 34: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == 字体 == | ||
怎么让原生安卓版本的 Emacs 识别并正常显示中文字体,而不是 16 进制的字符块呢? | |||
首先,去下载某个字体。 | |||
其次,把它复制进原生安卓版本的 Emacs 的私有目录下的 fonts 文件夹。 | |||
<syntaxhighlight lang="elisp"> | <syntaxhighlight lang="elisp"> | ||
M-x mkdir RET fonts | |||
M-x copy-file RET /sdcard/Downloads/NotoSansSC-Regular.ttf RET ~/fonts/NotoSansSC-Regular.ttf RET | |||
</syntaxhighlight> | </syntaxhighlight> | ||
再次,验证 Emacs 是否看到了你复制进去的字体。 | |||
<syntaxhighlight lang="elisp"> | <syntaxhighlight lang="elisp"> | ||
(insert | |||
"\n" | |||
(mapconcat | |||
#'identity | |||
(seq-filter (lambda (font) | |||
(or (string-match-p "SC" font) | |||
(string-match-p "wqy" font) | |||
(string-match-p "WenQuanYi" font))) | |||
(font-family-list)) | |||
"\n") | |||
"\n") | |||
</syntaxhighlight> | </syntaxhighlight> | ||
最后,在 ~/.emacs.d/init.el 里调用该字体。 | 最后,在 ~/.emacs.d/init.el 里调用该字体。 | ||
| Line 56: | Line 67: | ||
(set-language-environment "UTF-8") | (set-language-environment "UTF-8") | ||
(set-face-attribute 'default nil :height | ;; 因为屏幕素质不同,字体设计时字高不同,emacs 也不一定按屏幕真实 DPI 来渲染 | ||
(set-fontset-font t 'han "Noto Sans SC: | ;; 所以追求数学上相近的比如都 30pt 没用 | ||
;; 得看不同屏幕上的实际观感来确定中英文的不同 pt | |||
(set-face-attribute 'default nil :height 240) ;; 单位 1/10 pt | |||
(set-fontset-font t 'han (font-spec :family "Noto Sans SC" :size 40)) ;; 单位 1 pt | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== 美化 == | |||
<syntaxhighlight lang="elisp"> | |||
(setq inhibit-startup-message t) | |||
(setq make-backup-files nil) ;; 禁止生成 xxx~ | |||
(setq auto-save-default nil) ;; 禁止生成 #xxx# | |||
(setq create-lockfiles nil) | |||
(menu-bar-mode -1) | |||
(tool-bar-mode -1) | |||
(scroll-bar-mode -1) | |||
(global-auto-revert-mode t) | |||
(setq suggest-key-bindings 10) ;十秒后建议才消失 | |||
(add-hook 'dired-mode-hook 'dired-hide-details-mode t) | |||
(defalias 'yes-or-no-p 'y-or-n-p) | |||
;; 之前我一直在纠结 Emacs 处理安卓公开目录如 /storage/sdcard0/Emacs 时会导致 Find file 有长长的路径。洗把脸发现嫌弃路径长我自己写个短路径不就行了吗 | |||
(setq initial-buffer-choice (lambda () (dired "/sdcard/a/"))) | |||
</syntaxhighlight> | </syntaxhighlight> | ||