Emacs使用

Table of Contents

快捷键

操作描述 快捷键 命令名
输入命令 M-x execute-extended-command
退出程序 C-x C-c save-buffers-kill-terminal
放弃当前输入 C-g keyboard-quit
光标向上一行(方向键上) C-p previous-line
光标向下一行(方向键下) C-n next-line
光标向左一个字符(方向键左) C-b backward-char
光标向右一个字符(方向键右) C-f forward-char
光标向左移动一个词 M-b backward-word
光标向右移动一个词 M-f forward-word
光标移至行首 C-a move-beginning-of-line
光标移至行尾 C-e move-end-of-line
光标移动到一行缩进的开头 M-m back-to-indentation
光标移至句首 M-a backward-sentence
光标移至句尾 M-e forward-sentence
光标移至文件开头 M-< beginning-of-buffer
光标移至文件结尾 M-> end-of-buffer
光标移动至窗口的中间、最上、最下 M-r move-to-window-line-top-bottom
删除光标右侧字符 C-d delete-char
移除光标右侧词 M-d kill-word
移除光标左侧词 M- backward-kill-word
移除右侧直到句子结尾 M-k kill-sentence
移除右侧直到行尾 C-k kill-line
设置标记以选择区域 C-SPC set-mark-command
复制区域 M-w kill-region-save
移除区域 C-w kill-region
插入已移除文本 C-y yank
插入历史移除文本 M-y yank-pop
撤回 C-/ 或 C-_ 或 C-x u undo
跳转到上一标记 C-x C-SPC 或 C-u C-SPC pop-global-mark
跳转到行号 M-g M-g goto-line
重复 C-u universal-argument
向下一页 C-v scroll-up-command
向上一页 M-v scroll-down-command
移动页面使得光标在中央/最上方/最下方 C-l recenter-top-bottom
向后搜索 C-s isearch-forward
向前搜索 C-r isearch-backward
交换前后字符 C-t transpose-chars
交换前后词 M-t transpose-words
交换前后两行 C-x C-t transpose-lines
在下方新建一行 C-o open-line
删除连续空行为一个空行 C-x C-o delete-blank-lines
将后面的词变为小写 M-l downcase-word
将后面的词变为大写 M-u upcase-word
将后面的词变为首字母大写 M-c capitalize-word
简要描述快捷键功能 C-h c describe-key-briefly
描述快捷键功能 C-h k describe-key
描述函数功能 C-h f describe-function
描述变量 C-h v describe-variable
列出含某一关键词的命令 C-h a apropos-command
列出含某一关键词的符号的文档 C-h d apropos-documentation
帮助的帮助 C-h ? help-for-help

eww

Emacs浏览器及快捷键

`M-x eww` //进入浏览器

快捷键

按键	函数	作用
q	eww-quit	退出eww
g	eww-reload	重载该页面
G    eww             打开新链接
w	eww-copy-page-url	拷贝当前URL到kill ring
d	eww-download	下载光标所在的URL,下载的目录存在变量`eww-download-directory`中,默认为~/Downloads
l	eww-back-url	回退上一个URL
r	eww-forward-url	前进到下一个URL
R	read						阅读模式
H	eww-list-histories	显示浏览历史
b	eww-add-bookmark	加书签
B	eww-list-bookmarks	显示书签列表
&	eww-browse-with-external-browser	使用外部浏览器打开当前浏览的URL,外部浏览器由变量`shr-external-browser`决定
v	eww-view-source	查看页面源代码
C	eww-cookie-list	列示Cookie

% + m //查找标记文件
Alt + ! //输入shell命令
C-h m //查看快捷键
C-h e //查看emacs回显

设置eww搜索引擎

加载外部el文件并执行el的方法

emacsclient -n --eval "(load-file \"publish-config.el\")"

publish-config.el

(require 'ox-publish)
(setq org-publish-project-alist
      '(("orgfiles"
	 :base-directory "~/www/orgs/"
	 :publishing-directory "~/www/htmls/"
	 :base-extension "org"
	 :exclude "^_[[:word:]-]*.org"
	 :recursive t
	 :publishing-function org-html-publish-to-html
	 :headline-levels 6    ;; org-export-headline-levels
	 :language "zh"        ;; org-export-default-language
	 :section-numbers nil  ;; org-export-with-section-numbers
	 :with-planning t      ;; org-export-with-planning
	 :with-priority t      ;; org-export-with-priority ;
	 ;;  :with-tags not-in-toc ;; org-export-with-tags
	 :with-toc t           ;; org-export-with-toc
	 :html-doctype "html5"
	 :html-head-include-default-style nil ;; org-html-head-include-default-style
	 :html-head-include-scripts nil ;; org-html-head-include-scripts
	 :html-checkbox-type unicode  ;; org-html-checkbox-type
	 ;; :html-link-home "index.html"  ;; org-html-link-home
	 ;; :html-link-up "uUP"          ;; org-html-link-up
	 :html-validation-link "<a href=\"http://beian.miit.gov.cn/\">hello-world</a>"
	 )))

(defun ykyk-site-html()
  (interactive)
  (org-publish-all))

(ykyk-site-html)

关于导出html缓存

  • org-publish-use-timestamps-flag 默认值 t,即默认使用缓存。缓存文件默认存放在 ~/.org-timestamps/orgfiles.cache
  • 每次调用 org-publish-all 方法导出html时,先读取缓存文件,查看是否需要 Skipping unmodified file
  • 若要不使用缓存,强制导出html,可以设置 org-publish-use-timestamps-flag 的值为 nil。这样就不会读取缓存文件了,而是直接重新导出项目下所有的org文件为html文件

eg

 1: (defun ykyk-site-html-local()
 2:   (interactive)
 3:   (progn
 4:     (setq org-publish-use-timestamps-flag t)
 5:     (ykyk-jobs-menu "1")
 6:     (org-publish-all)
 7:     (message "local-ok")))
 8: 
 9: (defun ykyk-site-html-local-force()
10:   (interactive)
11:   (progn
12:     (setq org-publish-use-timestamps-flag nil)
13:     (ykyk-jobs-menu "1")
14:     (org-publish-all)
15:     (message "local-ok")))

资源

Date: 2022-02-07 Mon 09:24