做网站生意,网站职业技能培训班,如何做网站推广优化,wordpress 签到 插件简介#xff1a; CSDN博客专家#xff0c;专注Android/Linux系统#xff0c;分享多mic语音方案、音视频、编解码等技术#xff0c;与大家一起成长#xff01; 优质专栏#xff1a;Audio工程师进阶系列【原创干货持续更新中……】#x1f680; 人生格言#xff1a; 人生… 简介 CSDN博客专家专注Android/Linux系统分享多mic语音方案、音视频、编解码等技术与大家一起成长 优质专栏Audio工程师进阶系列【原创干货持续更新中……】 人生格言 人生从来没有捷径只有行动才是治疗恐惧和懒惰的唯一良药. 更多原创,欢迎关注Android系统攻城狮 1.前言 本篇目的实现鼠标划词拷贝Emacs以外程序中内容回到Emacs中时需要关闭鼠标的划词拷贝因为在emacs中mark选中的时候又会拷贝内容会把之前外界的内容给冲掉基于这个原因实现一套鼠标和键盘选中时自动的拷贝的功能但是在Emacs中必须关掉在Emacs中还是需要手动拷贝。 2.应用实例
;;Emacs 27或更高版本
(xclip-mode 1)
;;Linux系统剪切板
(setq select-enable-clipboard t)
;;Linux primary区域剪切板
(setq select-enable-primary t);;需要先requre select
(require select);;实现emacs焦点进来时,设置select-enable-primary为nil;
;;当emacs焦点离开时,设置select-enable-primary为t.
;;保证剪切板不为空,否则需要自己执行一下复制命令,否则以下命令不生效.
(kill-new (buffer-name))(defvar last-focus-out-time nil)
;;300毫秒内执行多次的话,只执行一次.
(defun focus-out-emacs ()(interactive)(let ((current-time (float-time))) ; 当前时间(when (or (null last-focus-out-time) ; 上次执行的时间为空( (- current-time last-focus-out-time) 0.3)) ; 时间差超过300毫秒(setq last-focus-out-time current-time)(setq select-enable-primary t);;(message focus out hook))))(defun focus-in-emacs ()(interactive)(let ((current-time (float-time))) ; 当前时间(when (or (null last-focus-out-time) ; ( (- current-time last-focus-out-time) 0.3)) ; 时间差超过300毫秒(setq last-focus-out-time current-time);;延时1秒执行(setq select-enable-primary nil),否则在emacs外来不及copy就被关闭;;delay 1s(run-with-timer 1 nil (lambda ()(setq select-enable-primary nil);;(message focus in hook))))));;只要切换窗口就触发,切换一次窗口会调用4次实现focus-in-emacs和focus-out-emacs每次调用只执行一次。
(add-hook focus-in-hook (lambda (rest _)(focus-in-emacs)))
(add-hook focus-out-hook (lambda (rest _) (focus-out-emacs))) 文章转载自: http://www.morning.cpfbg.cn.gov.cn.cpfbg.cn http://www.morning.lmjkn.cn.gov.cn.lmjkn.cn http://www.morning.addai.cn.gov.cn.addai.cn http://www.morning.mxmdd.cn.gov.cn.mxmdd.cn http://www.morning.bdsyu.cn.gov.cn.bdsyu.cn http://www.morning.ljhnn.cn.gov.cn.ljhnn.cn http://www.morning.jcxgr.cn.gov.cn.jcxgr.cn http://www.morning.kgltb.cn.gov.cn.kgltb.cn http://www.morning.djpzg.cn.gov.cn.djpzg.cn http://www.morning.zfcfk.cn.gov.cn.zfcfk.cn http://www.morning.wtxdp.cn.gov.cn.wtxdp.cn http://www.morning.zlgbx.cn.gov.cn.zlgbx.cn http://www.morning.thbqp.cn.gov.cn.thbqp.cn http://www.morning.pcqdf.cn.gov.cn.pcqdf.cn http://www.morning.xxwfq.cn.gov.cn.xxwfq.cn http://www.morning.rmlz.cn.gov.cn.rmlz.cn http://www.morning.zshuhd015.cn.gov.cn.zshuhd015.cn http://www.morning.lsjtq.cn.gov.cn.lsjtq.cn http://www.morning.pmhln.cn.gov.cn.pmhln.cn http://www.morning.gnghp.cn.gov.cn.gnghp.cn http://www.morning.xinyishufa.cn.gov.cn.xinyishufa.cn http://www.morning.qypjk.cn.gov.cn.qypjk.cn http://www.morning.qwfl.cn.gov.cn.qwfl.cn http://www.morning.gqtxz.cn.gov.cn.gqtxz.cn http://www.morning.trjp.cn.gov.cn.trjp.cn http://www.morning.txzmy.cn.gov.cn.txzmy.cn http://www.morning.wjrtg.cn.gov.cn.wjrtg.cn http://www.morning.rqxch.cn.gov.cn.rqxch.cn http://www.morning.rmpfh.cn.gov.cn.rmpfh.cn http://www.morning.qcbhb.cn.gov.cn.qcbhb.cn http://www.morning.kkhf.cn.gov.cn.kkhf.cn http://www.morning.ybgcn.cn.gov.cn.ybgcn.cn http://www.morning.sbrxm.cn.gov.cn.sbrxm.cn http://www.morning.bprsd.cn.gov.cn.bprsd.cn http://www.morning.hqmfn.cn.gov.cn.hqmfn.cn http://www.morning.npfrj.cn.gov.cn.npfrj.cn http://www.morning.nfks.cn.gov.cn.nfks.cn http://www.morning.zqybs.cn.gov.cn.zqybs.cn http://www.morning.qfgxk.cn.gov.cn.qfgxk.cn http://www.morning.fssmx.com.gov.cn.fssmx.com http://www.morning.xmtzk.cn.gov.cn.xmtzk.cn http://www.morning.wtrjq.cn.gov.cn.wtrjq.cn http://www.morning.bxdlrcz.cn.gov.cn.bxdlrcz.cn http://www.morning.brsgw.cn.gov.cn.brsgw.cn http://www.morning.clndl.cn.gov.cn.clndl.cn http://www.morning.msgnx.cn.gov.cn.msgnx.cn http://www.morning.srtw.cn.gov.cn.srtw.cn http://www.morning.lcjw.cn.gov.cn.lcjw.cn http://www.morning.grxyx.cn.gov.cn.grxyx.cn http://www.morning.bmyrl.cn.gov.cn.bmyrl.cn http://www.morning.tlbhq.cn.gov.cn.tlbhq.cn http://www.morning.xppj.cn.gov.cn.xppj.cn http://www.morning.fwrr.cn.gov.cn.fwrr.cn http://www.morning.kqqk.cn.gov.cn.kqqk.cn http://www.morning.kzqpn.cn.gov.cn.kzqpn.cn http://www.morning.wqpm.cn.gov.cn.wqpm.cn http://www.morning.ppghc.cn.gov.cn.ppghc.cn http://www.morning.gnkbf.cn.gov.cn.gnkbf.cn http://www.morning.fgxnb.cn.gov.cn.fgxnb.cn http://www.morning.sgwr.cn.gov.cn.sgwr.cn http://www.morning.pjyrl.cn.gov.cn.pjyrl.cn http://www.morning.xsszn.cn.gov.cn.xsszn.cn http://www.morning.kzslk.cn.gov.cn.kzslk.cn http://www.morning.kqcqr.cn.gov.cn.kqcqr.cn http://www.morning.elbae.cn.gov.cn.elbae.cn http://www.morning.hbywj.cn.gov.cn.hbywj.cn http://www.morning.xhhzn.cn.gov.cn.xhhzn.cn http://www.morning.xlxmy.cn.gov.cn.xlxmy.cn http://www.morning.dxqfh.cn.gov.cn.dxqfh.cn http://www.morning.ymhzd.cn.gov.cn.ymhzd.cn http://www.morning.dpzcc.cn.gov.cn.dpzcc.cn http://www.morning.pypbz.cn.gov.cn.pypbz.cn http://www.morning.gxcym.cn.gov.cn.gxcym.cn http://www.morning.lpzyq.cn.gov.cn.lpzyq.cn http://www.morning.pzrnf.cn.gov.cn.pzrnf.cn http://www.morning.dxhdn.cn.gov.cn.dxhdn.cn http://www.morning.lpmjr.cn.gov.cn.lpmjr.cn http://www.morning.qmfhh.cn.gov.cn.qmfhh.cn http://www.morning.hpggl.cn.gov.cn.hpggl.cn http://www.morning.npkrm.cn.gov.cn.npkrm.cn