unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to paste under terminal emacs?
@ 2016-03-16  2:41 Shiyao Ma
  2016-03-16  4:45 ` Yuri Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Shiyao Ma @ 2016-03-16  2:41 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,


To be specific, I am under iTerm2 using ssh to a linux box.

I often paste stuff using command+v to terminal emacs.

However, looks like emacs takes the paste char by char, which significantly
makes the paste unnecessarily slow.

How to make emacs take the paste as a whole?

Like the way `:set paste' in vim.


Regards.

-- 

吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。


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

* Re: How to paste under terminal emacs?
  2016-03-16  2:41 How to paste under terminal emacs? Shiyao Ma
@ 2016-03-16  4:45 ` Yuri Khan
  2016-03-16 12:34   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Yuri Khan @ 2016-03-16  4:45 UTC (permalink / raw)
  To: Shiyao Ma; +Cc: help-gnu-emacs@gnu.org

On Wed, Mar 16, 2016 at 8:41 AM, Shiyao Ma <i@introo.me> wrote:

> To be specific, I am under iTerm2 using ssh to a linux box.
>
> I often paste stuff using command+v to terminal emacs.
>
> However, looks like emacs takes the paste char by char, which significantly
> makes the paste unnecessarily slow.
>
> How to make emacs take the paste as a whole?

Does iTerm2 implement xterm’s [bracketed paste][1] protocol?

[1]: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode

Emacs could watch for an ESC [ 2 0 0 ~ sequence and, when it sees one,
stop redrawing until ESC [ 2 0 1 ~ is seen.



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

* Re: How to paste under terminal emacs?
  2016-03-16  4:45 ` Yuri Khan
@ 2016-03-16 12:34   ` Stefan Monnier
  2016-03-17  9:35     ` Shiyao Ma
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2016-03-16 12:34 UTC (permalink / raw)
  To: help-gnu-emacs

> Emacs could watch for an ESC [ 2 0 0 ~ sequence and, when it sees one,
> stop redrawing until ESC [ 2 0 1 ~ is seen.

This is already implemented in recent-enough Emacs, BTW.


        Stefan




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

* Re: How to paste under terminal emacs?
  2016-03-16 12:34   ` Stefan Monnier
@ 2016-03-17  9:35     ` Shiyao Ma
  2016-03-17 13:06       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Shiyao Ma @ 2016-03-17  9:35 UTC (permalink / raw)
  Cc: help-gnu-emacs

I found a sample snippet here:
https://github.com/hchbaw/bracketed-paste.el/blob/master/bracketed-paste.el

Dunno what do you mean by "alredy implemented in Emacs".

This is more a terminal related stuff.


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

* Re: How to paste under terminal emacs?
  2016-03-17  9:35     ` Shiyao Ma
@ 2016-03-17 13:06       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2016-03-17 13:06 UTC (permalink / raw)
  To: help-gnu-emacs

> I found a sample snippet here:
> https://github.com/hchbaw/bracketed-paste.el/blob/master/bracketed-paste.el
> Dunno what do you mean by "alredy implemented in Emacs".

That recent Emacsen incorporate code akin to bracketed-paste.el, and they
use it without you even noticing it.

OK, I checked and I was partly lying: it's only supported in the
upcoming 25.1.  Excerpt from the NEWS file:

    * Editing Changes in Emacs 25.1
    [...]
    ** Emacs now uses "bracketed paste mode" on text terminals that support it.
    Bracketed paste mode causes text terminals to wrap pasted text in special
    escape sequences that allow Emacs to tell the difference between text
    you type and text you paste from other applications.  Emacs then
    avoids interpreting each character in the pasted text as it does with
    keyboard input, which results in a paste experience similar to that
    under a window system, and significant performance improvements when
    pasting large amounts of text.
    
    Bracketed paste mode is disabled by default, so Emacs automatically
    enables it at startup if the terminal supports it.


-- Stefan




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

end of thread, other threads:[~2016-03-17 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16  2:41 How to paste under terminal emacs? Shiyao Ma
2016-03-16  4:45 ` Yuri Khan
2016-03-16 12:34   ` Stefan Monnier
2016-03-17  9:35     ` Shiyao Ma
2016-03-17 13:06       ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).