Emacs: 删除当前 buffer 对应的文件

一个小函数, 把当前正在访问的 buffer 对应的文件删除 (放到回收站).

1:  (defun delete-this-file ()
2:    "Delete (move to trash) the file that is associated with the
3:  current buffer."
4:    (interactive)
5:    (let ((filename (buffer-file-name)))
6:      (delete-file filename t)
7:      (kill-buffer)))

eval 之后, 按 M-x delete-this-file 即可.

Happy Hacking!

Date: 2013-08-17

Author: 任文山 (Ren Wenshan)

Org version 7.9.3d with Emacs version 24

Validate XHTML 1.0

1 thought on “Emacs: 删除当前 buffer 对应的文件

  1. Pingback: 链接推荐 —— 2013年8月 | 肉山博客 (Wenshan's Blog)