all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ox-clip.el
@ 2016-06-29  1:43 John Kitchin
  2016-06-29  5:09 ` ox-clip.el Jiege Chen
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2016-06-29  1:43 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi everyone,

I extended the work I did here
http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
on copying formatted org-mode to other applications so it is
approximately cross-platform now. There is one command
`ox-clip-formatted-copy' that should copy a region in an org-file with
formatting to paste into other applications on Windows, Mac and Linux.

https://github.com/jkitchin/scimax/blob/master/ox-clip.el

Try it out!

-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-29  1:43 ox-clip.el John Kitchin
@ 2016-06-29  5:09 ` Jiege Chen
  2016-06-29 13:16   ` ox-clip.el John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Jiege Chen @ 2016-06-29  5:09 UTC (permalink / raw)
  To: emacs-orgmode

John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> Hi everyone,
> 
> I extended the work I did here
> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
> on copying formatted org-mode to other applications so it is
> approximately cross-platform now. There is one command
> `ox-clip-formatted-copy' that should copy a region in an org-file with
> formatting to paste into other applications on Windows, Mac and Linux.
> 
> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
> 
> Try it out!
> 

Impressive. I'd love ox-clip to be released in MELPA. Is that already done?


-- 
Jiegec

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-29  5:09 ` ox-clip.el Jiege Chen
@ 2016-06-29 13:16   ` John Kitchin
  2016-06-29 13:53     ` ox-clip.el Jiegec
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2016-06-29 13:16 UTC (permalink / raw)
  To: Jiege Chen; +Cc: emacs-orgmode

its not there yet. I would like some people to test it out a little
maybe? get some feedback on it. Then it will probably go to MELPA.

Jiege Chen writes:

> John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>> Hi everyone,
>> 
>> I extended the work I did here
>> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
>> on copying formatted org-mode to other applications so it is
>> approximately cross-platform now. There is one command
>> `ox-clip-formatted-copy' that should copy a region in an org-file with
>> formatting to paste into other applications on Windows, Mac and Linux.
>> 
>> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
>> 
>> Try it out!
>> 
>
> Impressive. I'd love ox-clip to be released in MELPA. Is that already done?


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-29 13:16   ` ox-clip.el John Kitchin
@ 2016-06-29 13:53     ` Jiegec
  2016-06-29 14:25       ` ox-clip.el John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Jiegec @ 2016-06-29 13:53 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]


I’m testing this in OS X. I can confirm this works though it seems to conflict with
some other packages here which constantly copy the selected region and then
overwrite the result of ox-clip. I have checked the output of textutil and use the 
same command in shell and that works. One feedback: are there internal functions
to manipulate the system clipboard? I am in favour of those instead of pbcopy.
As in mentioned in https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard>,
pbcopy sometimes does not work. The link above says ‘Under Yosemite 
(and later) pasteboard access seems to work fine without the program from 
this repository.’ but this is not true in my laptop in OS X El Capitan 10.11.5.

> On Jun 29, 2016, at 9:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 
> its not there yet. I would like some people to test it out a little
> maybe? get some feedback on it. Then it will probably go to MELPA.
> 
> Jiege Chen writes:
> 
>> John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>> Hi everyone,
>>> 
>>> I extended the work I did here
>>> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
>>> on copying formatted org-mode to other applications so it is
>>> approximately cross-platform now. There is one command
>>> `ox-clip-formatted-copy' that should copy a region in an org-file with
>>> formatting to paste into other applications on Windows, Mac and Linux.
>>> 
>>> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
>>> 
>>> Try it out!
>>> 
>> 
>> Impressive. I'd love ox-clip to be released in MELPA. Is that already done?
> 
> 
> -- 
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
> 


[-- Attachment #2: Type: text/html, Size: 3262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-29 13:53     ` ox-clip.el Jiegec
@ 2016-06-29 14:25       ` John Kitchin
  2016-06-30 10:19         ` ox-clip.el Jiegec
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2016-06-29 14:25 UTC (permalink / raw)
  To: Jiegec; +Cc: emacs-orgmode


Jiegec writes:

> I’m testing this in OS X. I can confirm this works though it seems to conflict with
> some other packages here which constantly copy the selected region and then
> overwrite the result of ox-clip.
What kind of package is that? None of the kill commands can use the
clipboard that ox-clip sends things too as far as I know. I don't see
how this is possible.

> I have checked the output of textutil and use the 
> same command in shell and that works. One feedback: are there internal functions
> to manipulate the system clipboard? I am in favour of those instead of
> pbcopy.

There are none that I know of (or I would have used them ;).

> As in mentioned in https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard>,
> pbcopy sometimes does not work. The link above says ‘Under Yosemite 
> (and later) pasteboard access seems to work fine without the program from 
> this repository.’ but this is not true in my laptop in OS X El Capitan
> 10.11.5.

That could be true. I don't have access to anything that modern yet. 

>
>> On Jun 29, 2016, at 9:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>> 
>> its not there yet. I would like some people to test it out a little
>> maybe? get some feedback on it. Then it will probably go to MELPA.
>> 
>> Jiege Chen writes:
>> 
>>> John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>>> Hi everyone,
>>>> 
>>>> I extended the work I did here
>>>> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
>>>> on copying formatted org-mode to other applications so it is
>>>> approximately cross-platform now. There is one command
>>>> `ox-clip-formatted-copy' that should copy a region in an org-file with
>>>> formatting to paste into other applications on Windows, Mac and Linux.
>>>> 
>>>> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
>>>> 
>>>> Try it out!
>>>> 
>>> 
>>> Impressive. I'd love ox-clip to be released in MELPA. Is that already done?
>> 
>> 
>> -- 
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>> 


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-29 14:25       ` ox-clip.el John Kitchin
@ 2016-06-30 10:19         ` Jiegec
  2016-06-30 12:13           ` ox-clip.el John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Jiegec @ 2016-06-30 10:19 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 5633 bytes --]

By reading nsselect.m, there is:

DEFUN ("ns-get-selection", Fns_get_selection,
       Sns_get_selection, 2, 2, 0,
       doc: /* Return text selected from some X window.
SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
\(Those are literal upper-case symbol names, since that's what X expects.)
TARGET-TYPE is the type of data desired, typically `STRING'.  */)
     (Lisp_Object selection_name, Lisp_Object target_type)
{
  Lisp_Object val = Qnil;

  check_window_system (NULL);
  CHECK_SYMBOL (selection_name);
  CHECK_SYMBOL (target_type);

  if (ns_get_pb_change_count (selection_name)
      == ns_get_our_change_count_for (selection_name))
      val = ns_get_local_selection (selection_name, target_type);
  if (NILP (val))
    val = ns_get_foreign_selection (selection_name, target_type);
  if (CONSP (val) && SYMBOLP (Fcar (val)))
    {
      val = Fcdr (val);
      if (CONSP (val) && NILP (Fcdr (val)))
        val = Fcar (val);
    }
  val = clean_local_selection_data (val);
  return val;
}

and It seems that it implements the selection API.

So we can use `gui-set-selection' and `gui-get-selection’.
And it works:

(gui-set-selection nil “hello”)
(gui-get-selection)
;=> “hello”

But the text to be copied here is in RTF, but Emacs
is hardcoded to copy texts. Damn. We have to use
pbcopy or to change Emacs internal code.

Now things go back to finding the culprit of
overwriting the clipboard. And I traced to
`evil-visual-update-x-selection’ called in 
`evil-visual-{pre,post}-command’. Oh I don’t understand
why evil does this. Disabling evil-mode works.

Then here comes another bug:

I’m testing on a Chinese org file. Here is the part:

*** Evil-Surround

[[https://github.com/timcharper/evil-surround][Evil-surround]] 是一个 Vim 上非常常用的插件改写的,使用它可以快速的将选中区域进行匹配的操作,例如选中区域两边同时进行添加或修改括号,引号等操作。

下载安装后使用下面的代码将其激活,

#+BEGIN_SRC emacs-lisp
(require 'evil-surround)
(global-evil-surround-mode)
#+END_SRC

简单的使用方法就是在选中所选区域后,使用  =S(= 来将选中区域包括在括号之中。如果想将括号改变成 ="= 可以在选中后使用 =cs("=

You can get the whole file in https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org <https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org>.

But pasting the formatted resulted this:



The encoding is wrong. Adding a ‘-inputencoding UTF-8’ fixes it.


Really cool! That’s what I want.

Any workaround for that unwanted evil behaviour? I rely on evil a lot. 


> On Jun 29, 2016, at 10:25 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 
> 
> Jiegec writes:
> 
>> I’m testing this in OS X. I can confirm this works though it seems to conflict with
>> some other packages here which constantly copy the selected region and then
>> overwrite the result of ox-clip.
> What kind of package is that? None of the kill commands can use the
> clipboard that ox-clip sends things too as far as I know. I don't see
> how this is possible.
> 
>> I have checked the output of textutil and use the 
>> same command in shell and that works. One feedback: are there internal functions
>> to manipulate the system clipboard? I am in favour of those instead of
>> pbcopy.
> 
> There are none that I know of (or I would have used them ;).
> 
>> As in mentioned in https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard> <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard>>,
>> pbcopy sometimes does not work. The link above says ‘Under Yosemite 
>> (and later) pasteboard access seems to work fine without the program from 
>> this repository.’ but this is not true in my laptop in OS X El Capitan
>> 10.11.5.
> 
> That could be true. I don't have access to anything that modern yet. 
> 
>> 
>>> On Jun 29, 2016, at 9:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>> 
>>> its not there yet. I would like some people to test it out a little
>>> maybe? get some feedback on it. Then it will probably go to MELPA.
>>> 
>>> Jiege Chen writes:
>>> 
>>>> John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>>>> Hi everyone,
>>>>> 
>>>>> I extended the work I did here
>>>>> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
>>>>> on copying formatted org-mode to other applications so it is
>>>>> approximately cross-platform now. There is one command
>>>>> `ox-clip-formatted-copy' that should copy a region in an org-file with
>>>>> formatting to paste into other applications on Windows, Mac and Linux.
>>>>> 
>>>>> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
>>>>> 
>>>>> Try it out!
>>>>> 
>>>> 
>>>> Impressive. I'd love ox-clip to be released in MELPA. Is that already done?
>>> 
>>> 
>>> -- 
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>> 
> 
> 
> -- 
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>

[-- Attachment #2.1: Type: text/html, Size: 23681 bytes --]

[-- Attachment #2.2: PastedGraphic-1.png --]
[-- Type: image/png, Size: 87945 bytes --]

[-- Attachment #2.3: PastedGraphic-2.png --]
[-- Type: image/png, Size: 84612 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-30 10:19         ` ox-clip.el Jiegec
@ 2016-06-30 12:13           ` John Kitchin
  2016-06-30 12:36             ` ox-clip.el Jiegec
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2016-06-30 12:13 UTC (permalink / raw)
  To: Jiegec; +Cc: emacs-orgmode

Thanks for the feedback.

I noticed at the bottom of `gui-set-selection': Note that on MS-Windows,
primary and secondary selections set by Emacs are not available to other
programs. It looks like Emacs won't support this out of the box soon ;)
>
> But the text to be copied here is in RTF, but Emacs
> is hardcoded to copy texts. Damn. We have to use
> pbcopy or to change Emacs internal code.

>
> Now things go back to finding the culprit of
> overwriting the clipboard. And I traced to
> `evil-visual-update-x-selection’ called in 
> `evil-visual-{pre,post}-command’. Oh I don’t understand
> why evil does this. Disabling evil-mode works.

That sounds "evil". How do you ever copy anything? I still don't really
understand why it is an issue for ox-clip unless what is really happening
is evil messes up the active region which is exported by org-mode. The
ox-clip command doesn't touch the emacs clipboard at all I think. It
only uses system commands to put stuff on the system clipboards (which
are not directly visible to emacs in the first place).

The ox-clip commands don't currently copy anything you can paste back
into emacs. I have debated doing that, but it adds a noticeable lag for
the copy command since an org-export is involved, and if you are pasting
back to emacs that is not needed.

A solution would be a new copy command that just does a regular copy all
the time, but with a prefix arg does a formatted copy for pasting
elsewhere. I just use two different key bindings now. M-w for copy, and
H-k for formatted copy.

>
> Then here comes another bug:
>
> I’m testing on a Chinese org file. Here is the part:
>
> *** Evil-Surround
>
> [[https://github.com/timcharper/evil-surround][Evil-surround]] 是一个 Vim 上非常常用的插件改写的,使用它可以快速的将选中区域进行匹配的操作,例如选中区域两边同时进行添加或修改括号,引号等操作。
>
> 下载安装后使用下面的代码将其激活,
>
> #+BEGIN_SRC emacs-lisp
> (require 'evil-surround)
> (global-evil-surround-mode)
> #+END_SRC
>
> 简单的使用方法就是在选中所选区域后,使用  =S(= 来将选中区域包括在括号之中。如果想将括号改变成 ="= 可以在选中后使用 =cs("=
>
> You can get the whole file in https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org <https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org>.
>
> But pasting the formatted resulted this:
>
>
>
> The encoding is wrong. Adding a ‘-inputencoding UTF-8’ fixes it.
>

I added this to the macOSX command. thanks for the solution!

>
> Really cool! That’s what I want.
>
> Any workaround for that unwanted evil behaviour? I rely on evil a lot. 
>
>
>> On Jun 29, 2016, at 10:25 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>> 
>> 
>> Jiegec writes:
>> 
>>> I’m testing this in OS X. I can confirm this works though it seems to conflict with
>>> some other packages here which constantly copy the selected region and then
>>> overwrite the result of ox-clip.
>> What kind of package is that? None of the kill commands can use the
>> clipboard that ox-clip sends things too as far as I know. I don't see
>> how this is possible.
>> 
>>> I have checked the output of textutil and use the 
>>> same command in shell and that works. One feedback: are there internal functions
>>> to manipulate the system clipboard? I am in favour of those instead of
>>> pbcopy.
>> 
>> There are none that I know of (or I would have used them ;).
>> 
>>> As in mentioned in https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard> <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard>>,
>>> pbcopy sometimes does not work. The link above says ‘Under Yosemite 
>>> (and later) pasteboard access seems to work fine without the program from 
>>> this repository.’ but this is not true in my laptop in OS X El Capitan
>>> 10.11.5.
>> 
>> That could be true. I don't have access to anything that modern yet. 
>> 
>>> 
>>>> On Jun 29, 2016, at 9:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>>> 
>>>> its not there yet. I would like some people to test it out a little
>>>> maybe? get some feedback on it. Then it will probably go to MELPA.
>>>> 
>>>> Jiege Chen writes:
>>>> 
>>>>> John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>>>>> Hi everyone,
>>>>>> 
>>>>>> I extended the work I did here
>>>>>> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
>>>>>> on copying formatted org-mode to other applications so it is
>>>>>> approximately cross-platform now. There is one command
>>>>>> `ox-clip-formatted-copy' that should copy a region in an org-file with
>>>>>> formatting to paste into other applications on Windows, Mac and Linux.
>>>>>> 
>>>>>> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
>>>>>> 
>>>>>> Try it out!
>>>>>> 
>>>>> 
>>>>> Impressive. I'd love ox-clip to be released in MELPA. Is that already done?
>>>> 
>>>> 
>>>> -- 
>>>> Professor John Kitchin
>>>> Doherty Hall A207F
>>>> Department of Chemical Engineering
>>>> Carnegie Mellon University
>>>> Pittsburgh, PA 15213
>>>> 412-268-7803
>>>> @johnkitchin
>>>> http://kitchingroup.cheme.cmu.edu
>>>> 
>> 
>> 
>> -- 
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ox-clip.el
  2016-06-30 12:13           ` ox-clip.el John Kitchin
@ 2016-06-30 12:36             ` Jiegec
  0 siblings, 0 replies; 8+ messages in thread
From: Jiegec @ 2016-06-30 12:36 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 7686 bytes --]

I’m quite confused with the difference between CLIPBOARD and PRIMARY
in X11 and in OS X. 

Evil calls `x-select-text’ in `evil-visual-{pre,post}-command’.

And here is the document of `x-select-text’:

x-select-text is an alias for ‘gui-select-text’ in ‘select.el’.

(x-select-text TEXT)

This function is obsolete since 25.1;
use ‘gui-select-text’ instead.

Select TEXT, a string, according to the window system.
if ‘select-enable-clipboard’ is non-nil, copy TEXT to the system’s clipboard.
If ‘select-enable-primary’ is non-nil, put TEXT in the primary selection.

MS-Windows does not have a "primary" selection.

So I set select-enable-clipboard to nil and now it works as expected —
`ox-clip' a region, when pasting in Libreoffice I get the formatted version,
when pasting in Emacs I get the original text.


> On Jun 30, 2016, at 8:13 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 
> Thanks for the feedback.
> 
> I noticed at the bottom of `gui-set-selection': Note that on MS-Windows,
> primary and secondary selections set by Emacs are not available to other
> programs. It looks like Emacs won't support this out of the box soon ;)
>> 
>> But the text to be copied here is in RTF, but Emacs
>> is hardcoded to copy texts. Damn. We have to use
>> pbcopy or to change Emacs internal code.
> 
>> 
>> Now things go back to finding the culprit of
>> overwriting the clipboard. And I traced to
>> `evil-visual-update-x-selection’ called in 
>> `evil-visual-{pre,post}-command’. Oh I don’t understand
>> why evil does this. Disabling evil-mode works.
> 
> That sounds "evil". How do you ever copy anything? I still don't really
> understand why it is an issue for ox-clip unless what is really happening
> is evil messes up the active region which is exported by org-mode. The
> ox-clip command doesn't touch the emacs clipboard at all I think. It
> only uses system commands to put stuff on the system clipboards (which
> are not directly visible to emacs in the first place).
> 
> The ox-clip commands don't currently copy anything you can paste back
> into emacs. I have debated doing that, but it adds a noticeable lag for
> the copy command since an org-export is involved, and if you are pasting
> back to emacs that is not needed.
> 
> A solution would be a new copy command that just does a regular copy all
> the time, but with a prefix arg does a formatted copy for pasting
> elsewhere. I just use two different key bindings now. M-w for copy, and
> H-k for formatted copy.
> 
>> 
>> Then here comes another bug:
>> 
>> I’m testing on a Chinese org file. Here is the part:
>> 
>> *** Evil-Surround
>> 
>> [[https://github.com/timcharper/evil-surround][Evil-surround] <https://github.com/timcharper/evil-surround][Evil-surround]>] 是一个 Vim 上非常常用的插件改写的,使用它可以快速的将选中区域进行匹配的操作,例如选中区域两边同时进行添加或修改括号,引号等操作。
>> 
>> 下载安装后使用下面的代码将其激活,
>> 
>> #+BEGIN_SRC emacs-lisp
>> (require 'evil-surround)
>> (global-evil-surround-mode)
>> #+END_SRC
>> 
>> 简单的使用方法就是在选中所选区域后,使用  =S(= 来将选中区域包括在括号之中。如果想将括号改变成 ="= 可以在选中后使用 =cs("=
>> 
>> You can get the whole file in https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org <https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org><https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org <https://github.com/emacs-china/Spacemacs-rocks/blob/master/README.org>>.
>> 
>> But pasting the formatted resulted this:
>> 
>> 
>> 
>> The encoding is wrong. Adding a ‘-inputencoding UTF-8’ fixes it.
>> 
> 
> I added this to the macOSX command. thanks for the solution!
> 
>> 
>> Really cool! That’s what I want.
>> 
>> Any workaround for that unwanted evil behaviour? I rely on evil a lot. 
>> 
>> 
>>> On Jun 29, 2016, at 10:25 PM, John Kitchin <jkitchin@andrew.cmu.edu <mailto:jkitchin@andrew.cmu.edu>> wrote:
>>> 
>>> 
>>> Jiegec writes:
>>> 
>>>> I’m testing this in OS X. I can confirm this works though it seems to conflict with
>>>> some other packages here which constantly copy the selected region and then
>>>> overwrite the result of ox-clip.
>>> What kind of package is that? None of the kill commands can use the
>>> clipboard that ox-clip sends things too as far as I know. I don't see
>>> how this is possible.
>>> 
>>>> I have checked the output of textutil and use the 
>>>> same command in shell and that works. One feedback: are there internal functions
>>>> to manipulate the system clipboard? I am in favour of those instead of
>>>> pbcopy.
>>> 
>>> There are none that I know of (or I would have used them ;).
>>> 
>>>> As in mentioned in https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard> <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard>> <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard><https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard <https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard>>>,
>>>> pbcopy sometimes does not work. The link above says ‘Under Yosemite 
>>>> (and later) pasteboard access seems to work fine without the program from 
>>>> this repository.’ but this is not true in my laptop in OS X El Capitan
>>>> 10.11.5.
>>> 
>>> That could be true. I don't have access to anything that modern yet. 
>>> 
>>>> 
>>>>> On Jun 29, 2016, at 9:16 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>>>> 
>>>>> its not there yet. I would like some people to test it out a little
>>>>> maybe? get some feedback on it. Then it will probably go to MELPA.
>>>>> 
>>>>> Jiege Chen writes:
>>>>> 
>>>>>> John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>>>>>> Hi everyone,
>>>>>>> 
>>>>>>> I extended the work I did here
>>>>>>> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/
>>>>>>> on copying formatted org-mode to other applications so it is
>>>>>>> approximately cross-platform now. There is one command
>>>>>>> `ox-clip-formatted-copy' that should copy a region in an org-file with
>>>>>>> formatting to paste into other applications on Windows, Mac and Linux.
>>>>>>> 
>>>>>>> https://github.com/jkitchin/scimax/blob/master/ox-clip.el
>>>>>>> 
>>>>>>> Try it out!
>>>>>>> 
>>>>>> 
>>>>>> Impressive. I'd love ox-clip to be released in MELPA. Is that already done?
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Professor John Kitchin
>>>>> Doherty Hall A207F
>>>>> Department of Chemical Engineering
>>>>> Carnegie Mellon University
>>>>> Pittsburgh, PA 15213
>>>>> 412-268-7803
>>>>> @johnkitchin
>>>>> http://kitchingroup.cheme.cmu.edu
>>>>> 
>>> 
>>> 
>>> -- 
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/> <http://kitchingroup.cheme.cmu.edu/ <http://kitchingroup.cheme.cmu.edu/>>
> 
> 
> -- 
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>

[-- Attachment #2: Type: text/html, Size: 33983 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-06-30 12:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-29  1:43 ox-clip.el John Kitchin
2016-06-29  5:09 ` ox-clip.el Jiege Chen
2016-06-29 13:16   ` ox-clip.el John Kitchin
2016-06-29 13:53     ` ox-clip.el Jiegec
2016-06-29 14:25       ` ox-clip.el John Kitchin
2016-06-30 10:19         ` ox-clip.el Jiegec
2016-06-30 12:13           ` ox-clip.el John Kitchin
2016-06-30 12:36             ` ox-clip.el Jiegec

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.