因爲emacs自己就是emacs lisp編寫的,因此在emacs中一個命令其實就是一個函數。html
(defun helm-M-x (_arg &optional command-name) "Preconfigured `helm' for Emacs commands. It is `helm' replacement of regular `M-x' `execute-extended-command'. Unlike regular `M-x' emacs vanilla `execute-extended-command' command, the prefix args if needed, can be passed AFTER starting `helm-M-x'. When a prefix arg is passed BEFORE starting `helm-M-x', the first `C-u' while in `helm-M-x' session will disable it. You can get help on each command by persistent action."
快捷鍵 | 命令 | 說明 |
---|---|---|
M-! | shell-command |
使用系統shell 運行命令並輸出到buffer "Shell Command Output" |
M- | shell-command-on-region |
運行Shell命令並輸出到編輯區域 |
M-x | helm-M-x |
運行emacs命令 |
- | term |
打開buffer "terminal",運行終端 |
- | eshell |
建立一個交互式的Elisp shell。 |
能夠經過設置shell-file-name
變量的值來改變默認shellnode
(setq shell-file-name "/bin/bash")
eshell的用法shell
快速入門bash
掌握基本語法規則後就應該多看人家寫的代碼!
利用edebug更好更快地理解代碼
假如想要知道打開文件是怎麼操做的。session
首先定位函數的代碼。函數
已知快捷鍵C-x C-f
。依次鍵入C-h k C-x C-f
。
而後就會顯示函數的信息,點擊helm-files.el
就能看到代碼。工具
若是不知道快捷鍵,則鍵入C-h a
,利用命令的名稱來搜索可能的選項。debug
(defun helm-find-files (arg) "Preconfigured `helm' for helm implementation of `find-file'. Called with a prefix arg show history if some. Don't call it from programs, use `helm-find-files-1' instead. This is the starting point for nearly all actions you can do on files." (interactive "P") (let* ((hist (and arg helm-ff-history (helm-find-files-history))) (smart-input (or hist (helm-find-files-initial-input))) (default-input (expand-file-name (helm-current-directory))) (input (cond (helm-find-file-ignore-thing-at-point default-input) ((and (eq major-mode 'org-agenda-mode) org-directory (not smart-input)) (expand-file-name org-directory)) ((and (eq major-mode 'dired-mode) smart-input) (file-name-directory smart-input)) ((and (not (string= smart-input "")) smart-input)) (t default-input))) (input-as-presel (null (nth 0 (file-attributes input)))) (presel (helm-aif (or hist (and input-as-presel input) (buffer-file-name (current-buffer)) (and (eq major-mode 'dired-mode) smart-input)) (if helm-ff-transformer-show-only-basename (helm-basename it) it)))) (set-text-properties 0 (length input) nil input) (helm-find-files-1 input (and presel (null helm-ff-no-preselect) (concat "^" (regexp-quote presel))))))
將光標放到函數名上,鍵入 C-u C-M-x
可添加中斷入口。M-x edebug-mod
開啓後會在菜單欄多出edebug的選項。code
使用命令C-x C-f
便會觸發中斷。regexp
n
可單步執行
這是一個很方便的工具。不一樣於M-x
只能調用命令,IELM能夠使用lisp語言,對於實現emacs擴展實在是太便捷了!
更多更詳細的內容仍是得看文檔!!