本文介绍了在包装线的末尾摆脱反斜杠(用于复制粘贴)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想没有显示,所以我的文字模式中的Emacs会在包装线的末尾放置一个\字符(反斜杠)可以从这样的窗口复制粘贴到另一个窗口中,而不会在粘贴的文本中找到\。



我确定有一个简单的解决方案,但是我找不到(在线,也不在emacs手册中)。最近似乎是禁止远端的小箭头






从其中的所有答复和链接中消失,这是我最终用于emacs(22.1.1 )包含在Mac OS X 10.8.3中。它的作品很棒再次感谢所有的帮助!

  ;;复制到Mac剪贴板(用于复制文本包裹的'\'线
(defun copy-to-mac-clipboard()
将当前选定的区域复制到Mac剪贴板(用于包装'\\\ \\'b $ b(交互式)
(if(>( - (region-end)(region-beginning))0)
(progn
-on-region(region-beginning)(region-end)pbcopy)
(消息区域复制到Mac剪贴板(%d chars)( - (region-end)(region-beginning)))
(if(和transient-mark-mode mark-active)
(deactivate-mark)))
(progn
(消息no region active))
))

;;把它放在Mw旁边,这是kill-ring-save(复制到emacs剪贴板)
(全局设置键\Me'copy- to-mac-clipboard)


解决方案

这些\\ $)东西是plac在我们所说的边缘中,令人遗憾的是,Emacs目前不允许您以文本模式运行时控制边缘。我认为Angus指出的答案是迄今为止最好的。



OTOH,对于您的具体问题,除了在GUI模式下运行Emacs,您可能可以让Emacs直接与桌面的剪贴板(而不是让终端模拟器)进行通信,从而解决这个问题,并且即使没有显示也可以复制文本。



X11下有一个 xclip.el 包,有人发布了一个补丁(尚未集成),使其在Mac OS X下工作。


Emacs in text-mode puts a \ character (backslash) at the end of a wrapped line.

I would like to not have that displayed, so I can copy-paste from such a window into another one, without getting the \ in the pasted text.

I'm sure there is an easy solution for this, but I couldn't find it (neither online, nor in the emacs manual). The closest seems to be Disable little arrows on far end of line.


Distilled from all the replies and links therein, this is what I ended up using for emacs (22.1.1) included in Mac OS X 10.8.3. It works great. Thanks again for all the help!

;; copy to Mac clipboard (for copying text the wrapped '\' lines                                                       
(defun copy-to-mac-clipboard ()
  "Copy currently selected region to Mac clipboard (useful for wrapped '\\' lines)"
  (interactive)
  (if (> (- (region-end) (region-beginning)) 0)
      (progn
        (shell-command-on-region (region-beginning) (region-end) "pbcopy")
        (message "region copied to Mac clipboard (%d chars)" (- (region-end) (region-beginning)))
        (if (and transient-mark-mode mark-active)
           (deactivate-mark)))
    (progn
      (message "no region active"))
    ))

;; put this next to M-w, which is kill-ring-save (copy to emacs clipboard)                                             
(global-set-key "\M-e" 'copy-to-mac-clipboard)
解决方案

These \ (and $) thingies are placed in what we call "the fringe". And sadly, Emacs does not currently let you control the fringe when running in text mode. I think the answer pointed out by Angus is "the best we have" so far.

OTOH, for your specific problem, other than running Emacs in GUI mode, you might be able to let Emacs communicate directly with your desktop's clipboard (rather than let the terminal emulator), which then solves this problem as well as letting you copy text even if it's not displayed.

There is the xclip.el package for that under X11, and someone has posted a patch (not yet integrated) to make it work under Mac OS X as well.

这篇关于在包装线的末尾摆脱反斜杠(用于复制粘贴)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 07:20