Emacs Lisp与Shell的交互[转]
http://jamsa.javaeye.com/blog/169891
关键字: emacs lisp elisp
一直以来对于w3m、tramp、dired等与shell关系密切的mode不是很了解,没有仔细读过代码。但总觉得应该是调用shell命令,再将shell命令的输出重定向到emacs中进行处理。今天在网上看到了相关的方法:
- 调用shell命令
- (defun zj-open-directory-with-explorer ()
- "在windows中用explorer浏览当前目录"
- (interactive)
- (shell-command "explorer.exe .")
- (browse-url "")
- )
(defun zj-open-directory-with-explorer ()
"在windows中用explorer浏览当前目录"
(interactive)
(shell-command "explorer.exe .")
(browse-url "")
)
- 处理shell命令输出
- (defun zj-display-directory-files ()
- "执行shell命令并处理它的输出。这里为显示当前目录下的文件"
- (interactive)
- (message (shell-command-to-string "ls -l"))
- )
(defun zj-display-directory-files ()
"执行shell命令并处理它的输出。这里为显示当前目录下的文件"
(interactive)
(message (shell-command-to-string "ls -l"))
)
阅读(1013) | 评论(0) | 转发(0) |