* emacs24/gtk3 - how to mark rectangle of to primary selection?
@ 2012-06-26 14:24 Paul K
2012-06-26 14:52 ` Peter Dyballa
2012-06-26 18:29 ` Jonathan Groll
0 siblings, 2 replies; 12+ messages in thread
From: Paul K @ 2012-06-26 14:24 UTC (permalink / raw)
To: help-gnu-emacs
Hallo.
I tried to do it with cua-mode, but no luck.
Have You got any ideas?
best regards,
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 14:24 emacs24/gtk3 - how to mark rectangle of to primary selection? Paul K
@ 2012-06-26 14:52 ` Peter Dyballa
2012-06-26 18:29 ` Jonathan Groll
1 sibling, 0 replies; 12+ messages in thread
From: Peter Dyballa @ 2012-06-26 14:52 UTC (permalink / raw)
To: Paul K; +Cc: help-gnu-emacs
Am 26.06.2012 um 16:24 schrieb Paul K:
> Have You got any ideas?
My idea is that this does not work in GNU Emacs. You can copy a rectangle of text into a "register" (and then yank or paste it) but not into the primary selection...
--
Greetings
Pete
Engineer: a mechanism for converting caffeine into designs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 14:24 emacs24/gtk3 - how to mark rectangle of to primary selection? Paul K
2012-06-26 14:52 ` Peter Dyballa
@ 2012-06-26 18:29 ` Jonathan Groll
2012-06-26 20:33 ` Paul K
[not found] ` <mailman.3529.1340742812.855.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 12+ messages in thread
From: Jonathan Groll @ 2012-06-26 18:29 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, 26 Jun 2012 16:24:12 +0200, Paul K <mafeuser@gmail.com> wrote:
> Hallo.
>
> I tried to do it with cua-mode, but no luck.
>
> Have You got any ideas?
You could do it step-wise:
Kill a rectangle. set-mark-command (c-SPC) at one corner, kill-rectangle (C-x
r k) at the opposite corner. Then undo (C-_) if you don't want the
text to be lost.
Then go to the scratch buffer and yank-rectangle (C-x r y). Then do
whatever you normally do to highlight with the mouse etc to get it
into the primary selection.
Cheers,
Jonathan
--
jjg: Jonathan J. Groll : groll co za
has_one { :blog => "http://bloggroll.com" }
"Men always want to be a woman's first love. Women have a more subtle
instinct: What they like is to be a man's last romance." ~ Oscar Wilde
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 18:29 ` Jonathan Groll
@ 2012-06-26 20:33 ` Paul K
2012-06-26 20:44 ` Peter Dyballa
[not found] ` <mailman.3529.1340742812.855.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 12+ messages in thread
From: Paul K @ 2012-06-26 20:33 UTC (permalink / raw)
To: help-gnu-emacs
Peter and Jonathan,
thank You for Your answer.
These solutions seem to be a bit compicated,
so how about sending marked/selected rectangle to clipboard selection
with or without cua-mode?
best regards,
Paul
On Tue, Jun 26, 2012 at 8:29 PM, Jonathan Groll <lists@groll.co.za> wrote:
> On Tue, 26 Jun 2012 16:24:12 +0200, Paul K <mafeuser@gmail.com> wrote:
>
>> Hallo.
>>
>> I tried to do it with cua-mode, but no luck.
>>
>> Have You got any ideas?
>
> You could do it step-wise:
> Kill a rectangle. set-mark-command (c-SPC) at one corner, kill-rectangle (C-x
> r k) at the opposite corner. Then undo (C-_) if you don't want the
> text to be lost.
>
> Then go to the scratch buffer and yank-rectangle (C-x r y). Then do
> whatever you normally do to highlight with the mouse etc to get it
> into the primary selection.
>
> Cheers,
> Jonathan
> --
> jjg: Jonathan J. Groll : groll co za
> has_one { :blog => "http://bloggroll.com" }
> "Men always want to be a woman's first love. Women have a more subtle
> instinct: What they like is to be a man's last romance." ~ Oscar Wilde
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 20:33 ` Paul K
@ 2012-06-26 20:44 ` Peter Dyballa
2012-06-26 20:58 ` Paul K
0 siblings, 1 reply; 12+ messages in thread
From: Peter Dyballa @ 2012-06-26 20:44 UTC (permalink / raw)
To: Paul K; +Cc: help-gnu-emacs
Am 26.06.2012 um 22:33 schrieb Paul K:
> These solutions seem to be a bit compicated,
> so how about sending marked/selected rectangle to clipboard selection
> with or without cua-mode?
I only know the complicated way.
Which other tool are you thinking of that can handle the rectangle like a rectangle?
--
Greetings
Pete
One-Shot Case Study, n.:
The scientific equivalent of the four-leaf clover, from which it is concluded all clovers possess four leaves and are sometimes green.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 20:44 ` Peter Dyballa
@ 2012-06-26 20:58 ` Paul K
2012-06-26 21:19 ` suvayu ali
0 siblings, 1 reply; 12+ messages in thread
From: Paul K @ 2012-06-26 20:58 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs
On Tue, Jun 26, 2012 at 10:44 PM, Peter Dyballa <Peter_Dyballa@web.de> wrote:
> Which other tool are you thinking of that can handle the rectangle like a rectangle?
My initial question was regarded to what is called in X11 a "primary selection",
but I also know that emacs is aware of difference between "primary
selection" and "clipboard selection", thus I just thought that maybe
emacs can put each kiiled text to that "clipboard selection".
I checked that it is true when You mark and remember text with for
example `M-w`, but it is not true for kill-rectangle command, ie. the
later one does not put text to "clipboard selection".
best regards,
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 20:58 ` Paul K
@ 2012-06-26 21:19 ` suvayu ali
2012-06-27 6:58 ` Yuri Khan
0 siblings, 1 reply; 12+ messages in thread
From: suvayu ali @ 2012-06-26 21:19 UTC (permalink / raw)
To: Paul K; +Cc: help-gnu-emacs
On Tue, Jun 26, 2012 at 10:58 PM, Paul K <mafeuser@gmail.com> wrote:
> I checked that it is true when You mark and remember text with for
> example `M-w`, but it is not true for kill-rectangle command, ie. the
> later one does not put text to "clipboard selection".
I think the limitation is in X; it is not rectangle aware. Maybe Emacs
can "fool" X into thinking a rectangle kill to appear as a normal kill
region.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-26 21:19 ` suvayu ali
@ 2012-06-27 6:58 ` Yuri Khan
0 siblings, 0 replies; 12+ messages in thread
From: Yuri Khan @ 2012-06-27 6:58 UTC (permalink / raw)
Cc: help-gnu-emacs
On Wed, Jun 27, 2012 at 4:19 AM, suvayu ali <fatkasuvayu+linux@gmail.com> wrote:
> I think the limitation is in X; it is not rectangle aware. Maybe Emacs
> can "fool" X into thinking a rectangle kill to appear as a normal kill
> region.
FAR Manager on Windows has rectangular selection and copy/paste.
The Windows clipboard is not inherently rectangle-aware. An
application that copies content to clipboard can provide a prioritized
list of formats, so that the receiving application can choose the
first one it supports. So, in FAR, when a rectangle is copied, the top
format is a custom format tag, followed by CF_UNICODETEXT, followed by
CF_TEXT (which stands for “text in the locale-specific legacy single-
or multibyte encoding”). This way, if the block is then pasted back in
FAR, it knows to paste it as a rectangle, while other applications
paste as a plain garden-variety Unicode text block.
As far as I understand, the corresponding concept in X is “Target
Atoms”, ICCCM chapter 2.6.2.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
[not found] ` <mailman.3529.1340742812.855.help-gnu-emacs@gnu.org>
@ 2012-06-27 11:47 ` Xah Lee
2012-06-27 17:15 ` Aurélien Aptel
[not found] ` <mailman.3573.1340817336.855.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: Xah Lee @ 2012-06-27 11:47 UTC (permalink / raw)
To: help-gnu-emacs
On Jun 26, 1:33 pm, Paul K <mafeu...@gmail.com> wrote:
> Peter and Jonathan,
> thank You for Your answer.
>
> These solutions seem to be a bit compicated,
> so how about sending marked/selected rectangle to clipboard selection
> with or without cua-mode?
>
> best regards,
> Paul
>
>
>
>
>
>
>
> On Tue, Jun 26, 2012 at 8:29 PM, Jonathan Groll <li...@groll.co.za> wrote:
> > On Tue, 26 Jun 2012 16:24:12 +0200, Paul K <mafeu...@gmail.com> wrote:
>
> >> Hallo.
>
> >> I tried to do it with cua-mode, but no luck.
>
> >> Have You got any ideas?
>
> > You could do it step-wise:
> > Kill a rectangle. set-mark-command (c-SPC) at one corner, kill-rectangle (C-x
> > r k) at the opposite corner. Then undo (C-_) if you don't want the
> > text to be lost.
>
> > Then go to the scratch buffer and yank-rectangle (C-x r y). Then do
> > whatever you normally do to highlight with the mouse etc to get it
> > into the primary selection.
>
> > Cheers,
> > Jonathan
> > --
> > jjg: Jonathan J. Groll : groll co za
> > has_one { :blog => "http://bloggroll.com" }
> > "Men always want to be a woman's first love. Women have a more subtle
> > instinct: What they like is to be a man's last romance." ~ Oscar Wilde
it's not difficult to write a elisp command to do this.
basically, the command use kill-rectangle to trim a text into a column
you want, then put it on clipboard. Probably a 15 min job...
you can make do with a key macro instead. It should work.
Xah
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-27 11:47 ` Xah Lee
@ 2012-06-27 17:15 ` Aurélien Aptel
2012-06-27 18:41 ` Andreas Röhler
[not found] ` <mailman.3573.1340817336.855.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 12+ messages in thread
From: Aurélien Aptel @ 2012-06-27 17:15 UTC (permalink / raw)
To: Xah Lee; +Cc: help-gnu-emacs
Well, it was longer than expected... Turns out if you don't deactive
the mark, emacs copies the regular active region. My guess is it
corresponds to mouse selection: once a region is selected it is copied
to the primary selection.
(defun my-copy-rect-to-primary ()
(interactive)
(when (region-active-p)
(let ((text (mapconcat 'identity
(extract-rectangle
(region-beginning)
(region-end)) "\n")))
(deactivate-mark) ;; lost 30mn because of this
(x-set-selection 'PRIMARY text)
(message "%s" text))))
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
2012-06-27 17:15 ` Aurélien Aptel
@ 2012-06-27 18:41 ` Andreas Röhler
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Röhler @ 2012-06-27 18:41 UTC (permalink / raw)
To: help-gnu-emacs
Am 27.06.2012 19:15, schrieb Aurélien Aptel:
> Well, it was longer than expected... Turns out if you don't deactive
> the mark, emacs copies the regular active region. My guess is it
> corresponds to mouse selection: once a region is selected it is copied
> to the primary selection.
>
> (defun my-copy-rect-to-primary ()
> (interactive)
> (when (region-active-p)
> (let ((text (mapconcat 'identity
> (extract-rectangle
> (region-beginning)
> (region-end)) "\n")))
> (deactivate-mark) ;; lost 30mn because of this
> (x-set-selection 'PRIMARY text)
> (message "%s" text))))
>
>
Thanks!
It might pay to name it "-rectangle-" instead of "-rect-", as the latter is also part of "directory" for example,
which might inflate the output of M-x apropos NAME
Cheers,
Andreas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
[not found] ` <mailman.3573.1340817336.855.help-gnu-emacs@gnu.org>
@ 2012-06-29 16:38 ` Xah Lee
0 siblings, 0 replies; 12+ messages in thread
From: Xah Lee @ 2012-06-29 16:38 UTC (permalink / raw)
To: help-gnu-emacs
On Jun 27, 10:15 am, Aurélien Aptel <aurelien.aptel+em...@gmail.com>
wrote:
> Well, it was longer than expected... Turns out if you don't deactive
> the mark, emacs copies the regular active region. My guess is it
> corresponds to mouse selection: once a region is selected it is copied
> to the primary selection.
>
> (defun my-copy-rect-to-primary ()
> (interactive)
> (when (region-active-p)
> (let ((text (mapconcat 'identity
> (extract-rectangle
> (region-beginning)
> (region-end)) "\n")))
> (deactivate-mark) ;; lost 30mn because of this
> (x-set-selection 'PRIMARY text)
> (message "%s" text))))
hi Aurélien, thank you for coding this.
i tried to use it and it didn't work on Windows.
here's a alt version i coded up for learning:
(defun copy-rectangle-to-clipboard (p1 p2)
"Copy region as column (rectangle) to operating system's clipboard.
This command will also put the text in register 0. (see: `copy-to-
register')"
(interactive "r")
(let ((x-select-enable-clipboard t))
(copy-rectangle-to-register ?0 p1 p2)
(kill-new
(with-temp-buffer
(insert-register ?0)
(buffer-string) )) ) )
it does over-ride register 0 content, but i think one can modify it so
it restores, or not using register all together.
Xah
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-06-29 16:38 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 14:24 emacs24/gtk3 - how to mark rectangle of to primary selection? Paul K
2012-06-26 14:52 ` Peter Dyballa
2012-06-26 18:29 ` Jonathan Groll
2012-06-26 20:33 ` Paul K
2012-06-26 20:44 ` Peter Dyballa
2012-06-26 20:58 ` Paul K
2012-06-26 21:19 ` suvayu ali
2012-06-27 6:58 ` Yuri Khan
[not found] ` <mailman.3529.1340742812.855.help-gnu-emacs@gnu.org>
2012-06-27 11:47 ` Xah Lee
2012-06-27 17:15 ` Aurélien Aptel
2012-06-27 18:41 ` Andreas Röhler
[not found] ` <mailman.3573.1340817336.855.help-gnu-emacs@gnu.org>
2012-06-29 16:38 ` Xah Lee
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).