Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1751271
  • 博文数量: 100
  • 博客积分: 10122
  • 博客等级: 上将
  • 技术积分: 4092
  • 用 户 组: 普通用户
  • 注册时间: 2005-07-04 20:28
文章分类

全部博文(100)

文章存档

2010年(2)

2009年(28)

2008年(70)

我的朋友

分类: LINUX

2008-08-14 04:56:35

目的是将整个文件拷贝的 kill-ring,而且如果设置了 x-select-enable-clipboard 的话,就会同时拷贝到 X 的剪贴板了。 这个函数是为了解决我无法正常使用 xclip 操作 X 的剪贴板而弄的,其他情形似乎用不着。
;; copy file to kill-ring
(defun my-copy-file-to-kill-ring (filename)
(interactive "fCopy this file to kill-ring:")
(let ((buf (generate-new-buffer "*my-copy-file-to-kill-ring*"))
(pbeg)
(pend))
(with-current-buffer buf
(set 'pbeg (point))
(insert-file-contents filename)
(end-of-buffer)
(set 'pend (point))
(kill-ring-save pbeg pend))
(kill-buffer buf)))

阅读(1159) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~