help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs24/gtk3 - how to mark rectangle of to primary selection?


From: Andreas Röhler
Subject: Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
Date: Wed, 27 Jun 2012 20:41:45 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120601 Thunderbird/13.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]