<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello,<br>
<br>
Question #1:<br>
<br>
<div class="codehilite" style="margin-top: 0px; margin-bottom: 0px;
color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size:
14px; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 20px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="p">(</span><span class="nb" style="color: rgb(153, 153, 153);">defun</span> <span class="nv" style="color: rgb(0, 128, 128);">haroogan/evil-paste-from-clipboard</span> <span class="p">()</span>
<span class="s" style="color: rgb(187, 136, 68);">"Paste text from system clipboard."</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">interactive</span><span class="p">)</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-paste-from-register</span> <span class="nv" style="color: rgb(0, 128, 128);">?+</span><span class="p">))</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-define-operator</span> <span class="nv" style="color: rgb(0, 128, 128);">haroogan/evil-yank-to-clipboard</span> <span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">beg</span> <span class="nv" style="color: rgb(0, 128, 128);">end</span> <span class="k" style="color: rgb(0, 64, 128);">type</span> <span class="nv" style="color: rgb(0, 128, 128);">yank-handler</span><span class="p">)</span>
<span class="s" style="color: rgb(187, 136, 68);">"Yank text to system clipboard."</span>
<span class="ss" style="color: rgb(187, 136, 68);">:move-point</span> <span class="no" style="color: rgb(0, 128, 128);">nil</span>
<span class="ss" style="color: rgb(187, 136, 68);">:repeat</span> <span class="no" style="color: rgb(0, 128, 128);">nil</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">interactive</span> <span class="s" style="color: rgb(187, 136, 68);">"<x><y>"</span><span class="p">)</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-yank</span> <span class="nv" style="color: rgb(0, 128, 128);">beg</span> <span class="nv" style="color: rgb(0, 128, 128);">end</span> <span class="k" style="color: rgb(0, 64, 128);">type</span> <span class="nv" style="color: rgb(0, 128, 128);">?+</span> <span class="nv" style="color: rgb(0, 128, 128);">yank-handler</span><span class="p">))</span>
</pre>
</div>
<p style="margin: 10px 0px; padding: 0px; word-wrap: break-word;
color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size:
14px; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 20px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">Paste works as intended. Yank works partly:</p>
<ul style="margin: 0px; list-style-type: disc; color: rgb(51, 51,
51); font-family: Arial, sans-serif; font-size: 14px; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 20px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">
<li style="margin: 10px 0px; padding: 0px; word-wrap: break-word;">after
yanking I can paste this text into other applications;</li>
<li style="margin: 10px 0px; padding: 0px; word-wrap: break-word;">but
I cannot paste it into the Emacs itself, i.e. by using<span
class="Apple-converted-space"> </span><code
style="font-family: monospace; font-size: 12px; line-height:
1.4; background-color: rgb(245, 245, 245); border: 1px solid
rgb(204, 204, 204); border-top-left-radius: 2px;
border-top-right-radius: 2px; border-bottom-right-radius: 2px;
border-bottom-left-radius: 2px; padding: 1px 3px;
background-position: initial initial; background-repeat:
initial initial;">haroogan/evil-paste-from-clipboard</code><span
class="Apple-converted-space"> </span>- it says that the<span
class="Apple-converted-space"> </span><code
style="font-family: monospace; font-size: 12px; line-height:
1.4; background-color: rgb(245, 245, 245); border: 1px solid
rgb(204, 204, 204); border-top-left-radius: 2px;
border-top-right-radius: 2px; border-bottom-right-radius: 2px;
border-bottom-left-radius: 2px; padding: 1px 3px;
background-position: initial initial; background-repeat:
initial initial;">kill-ring</code><span
class="Apple-converted-space"> </span>is empty; how come?</li>
<li style="margin: 10px 0px; padding: 0px; word-wrap: break-word;">furthermore,
bell rings when I'm yanking with this function - like if it was
an error - that's very strange too.<br>
</li>
</ul>
<p style="margin: 10px 0px; padding: 0px; word-wrap: break-word;
color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size:
14px; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 20px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">For the reference, in my<span class="Apple-converted-space"> </span><code
style="font-family: monospace; font-size: 12px; line-height:
1.4; background-color: rgb(245, 245, 245); border: 1px solid
rgb(204, 204, 204); border-top-left-radius: 2px;
border-top-right-radius: 2px; border-bottom-right-radius: 2px;
border-bottom-left-radius: 2px; padding: 1px 3px;
background-position: initial initial; background-repeat: initial
initial;">.vimrc</code><span class="Apple-converted-space"> </span>I
have the following:</p>
<div class="codehilite" style="color: rgb(51, 51, 51); font-family:
Arial, sans-serif; font-size: 14px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: 20px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="c" style="color: rgb(153, 153, 136); font-style: italic;">" Cut to the system clipboard.</span>
<span class="nb" style="color: rgb(153, 153, 153);">nnoremap</span> <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">x</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+x</span>
<span class="nb" style="color: rgb(153, 153, 153);">vnoremap</span> <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">x</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+x</span>
cnoremap <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">x</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+x</span>
<span class="c" style="color: rgb(153, 153, 136); font-style: italic;">" Yank to the system clipboard.</span>
<span class="nb" style="color: rgb(153, 153, 153);">nnoremap</span> <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">y</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+y</span>
<span class="nb" style="color: rgb(153, 153, 153);">vnoremap</span> <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">y</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+y</span>
cnoremap <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">y</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+y</span>
<span class="c" style="color: rgb(153, 153, 136); font-style: italic;">" Paste from the system clipboard.</span>
<span class="nb" style="color: rgb(153, 153, 153);">nnoremap</span> <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">p</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+p</span>
<span class="nb" style="color: rgb(153, 153, 153);">vnoremap</span> <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">p</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+p</span>
cnoremap <span class="p"><</span>C<span class="p">-</span><span class="k" style="color: rgb(0, 64, 128);">p</span><span class="p">></span> <span class="c" style="color: rgb(153, 153, 136); font-style: italic;">"+p</span>
</pre>
</div>
<p style="margin: 10px 0px; padding: 0px; word-wrap: break-word;
color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size:
14px; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 20px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">What's the best way to replicate this with Evil?</p>
Question #2:<br>
<br>
Evil provides the following function:<br>
<div class="codehilite" style="color: rgb(51, 51, 51); font-family:
Arial, sans-serif; font-size: 14px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: 20px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-define-command</span> <span class="nv" style="color: rgb(0, 128, 128);">evil-window-new</span> <span class="p">(</span><span class="nb" style="color: rgb(153, 153, 153);">count</span> <span class="nv" style="color: rgb(0, 128, 128);">file</span><span class="p">)</span>
<span class="s" style="color: rgb(187, 136, 68);">"Splits the current window horizontally</span>
<span class="s" style="color: rgb(187, 136, 68);">and opens a new buffer or edits a certain FILE."</span>
<span class="ss" style="color: rgb(187, 136, 68);">:repeat</span> <span class="no" style="color: rgb(0, 128, 128);">nil</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">interactive</span> <span class="s" style="color: rgb(187, 136, 68);">"P<f>"</span><span class="p">)</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">split-window</span> <span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">selected-window</span><span class="p">)</span> <span class="nb" style="color: rgb(153, 153, 153);">count</span><span class="p">)</span>
<span class="p">(</span><span class="k" style="color: rgb(0, 64, 128);">if</span> <span class="nv" style="color: rgb(0, 128, 128);">file</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-edit</span> <span class="nv" style="color: rgb(0, 128, 128);">file</span><span class="p">)</span>
<span class="p">(</span><span class="k" style="color: rgb(0, 64, 128);">let</span> <span class="p">((</span><span class="nv" style="color: rgb(0, 128, 128);">buffer</span> <span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">generate-new-buffer</span> <span class="s" style="color: rgb(187, 136, 68);">"*new*"</span><span class="p">)))</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">set-window-buffer</span> <span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">selected-window</span><span class="p">)</span> <span class="nv" style="color: rgb(0, 128, 128);">buffer</span><span class="p">)</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">with-current-buffer</span> <span class="nv" style="color: rgb(0, 128, 128);">buffer</span>
<span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-normal-state</span><span class="p">)))))</span></pre>
</div>
<br>
In my opinion the last line reveals a huge flaw.<br>
<br>
First of all, recently I've been writing a tiling window manager for
Emacs.<br>
Of course when I create new windows there, I create buffers as well
with the same<br>
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="nv" style="color: rgb(0, 128, 128);">generate-new-buffer</span></pre>
function.<br>
<br>
And of course as suggested by the<br>
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="nv" style="color: rgb(0, 128, 128);">evil-window-new</span></pre>
function presented above, one has to call <br>
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">with-current-buffer</span> <span class="nv" style="color: rgb(0, 128, 128);">buffer</span> <span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-normal-state</span><span class="p">))</span></pre>
so that Evil does not break here and works properly in this newly
created buffer.<br>
<br>
That's incredibly annoying for 2 reasons.<br>
First, now, for instance, my tiling window manager has to depend on
the Evil package just to make this little hack for those who wish to
use Evil with my tiling window manager (including myself).<br>
Second, you have already probably noticed that such buffers as Emacs
Help and friends do not work with Evil properly.<br>
And I suspect that the reason for that is the same simply because in
case of Emacs Help buffer you could no longer inject this hackish
call:<br>
<pre style="font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, monospace; font-size: 12px; line-height: 1.4; margin: 9px 0px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; overflow-x: auto; padding: 5px 10px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">with-current-buffer</span> <span class="nv" style="color: rgb(0, 128, 128);">buffer</span> <span class="p">(</span><span class="nv" style="color: rgb(0, 128, 128);">evil-normal-state</span><span class="p">))</span></pre>
<br>
I might be wrong with my implications, and I wish you could prove
that I am.<br>
I'm nowhere near an Emacs hacker, just learning (migrating from
Vim), but may I say that <tt>defadvice</tt> to me seems to be a
remedy to this problem?<br>
Anyway, please, share your thoughts on this topic, I really hope
that this can somehow be reimplemented in more robust way, so that
Evil has more seamless and natural integration with the whole Emacs
environment.<br>
<br>
Kind regards,<br>
Haroogan<br>
<br>
</body>
</html>