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: Aurélien Aptel
Subject: Re: emacs24/gtk3 - how to mark rectangle of to primary selection?
Date: Wed, 27 Jun 2012 19:15:20 +0200

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))))



reply via email to

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