Since I've started using Emacs on Windows, there was one little problem irritating my mind everyday -- by default, GNU Emacs 22 separates kill-ring and Windows clipboard contents, making it REALLY hard to use clipboard -- you can paste text by only pressing mouse-3 (the wheel) on editor window, and you can copy text only by selecting it with your mouse -- no handy C-y, no integration with kill ring.
So I did a little "investigation". There are two variables controlling mentioned integration -- interprogram-cut-function and interprogram-paste-function (described in emacs online documentation, which see). First of which holds function used to send killed text to clipboard, and the second one holds function used to get fresh clipboard text back from clipboard and put it to kill-ring. More to that, file w32-fns.el in your emacs site-lisp tree contains the next (as well as definitions for those functions -- x-select-text and x-get-selection-value):
(setq interprogram-cut-function 'x-select-text)
(setq interprogram-paste-function 'x-get-selection-value)
But for some reason this file isn't loaded on Emacs startup. So, what should we do is to add some loading code to our dotemacs file (do not forget to wrap-n-protect it with some kind of Win32-only conditional -- `(Windows body ...)' macro in my case):
(Windows
(load "w32-fns"))
Voila! Now text from clipboard goes right to the kill-ring and vice versa.
Subscribe to:
Post Comments (Atom)
2 comments:
I haven't seen that problem at all, using CVS versions of Emacs 22 or precompiled binaries. Which version are you using?
Maybe it's just bad fate, but both my Windows and Linux boxes has just the same problem. Can't tell you Windows version of Emacs (not there now), but on Linux (Ubuntu Feisty Fawn) I have 22.0.91.1
Post a Comment