Function: cua--cut-rectangle-to-global-mark

cua--cut-rectangle-to-global-mark is a byte-compiled function defined in cua-gmrk.el.gz.

Signature

(cua--cut-rectangle-to-global-mark AS-TEXT)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/cua-gmrk.el.gz
(defun cua--cut-rectangle-to-global-mark (as-text)
  ;; Move rectangle to global buffer/position.
  (if (cua--global-mark-active)
      (let ((src-buf (current-buffer)))
	(save-excursion
	  (if (equal (marker-buffer cua--global-mark-marker) src-buf)
	      (let ((olist (overlays-at (marker-position cua--global-mark-marker)))
		    in-rect)
		(while olist
		  (if (eq (overlay-get (car olist) 'face) 'cua-rectangle)
		      (setq in-rect t olist nil)
		    (setq olist (cdr olist))))
		(if in-rect
		    (message "Can't move rectangle into itself")
		  (let ((text (cua--extract-rectangle)))
		    (cua--delete-rectangle)
		    (goto-char (marker-position cua--global-mark-marker))
		    (if as-text
			(while text
			  (insert-for-yank (car text))
			  (if (setq text (cdr text))
			      (insert "\n")))
		      (cua--insert-rectangle text 'auto))
		    (cua--activate-global-mark))))
	    (let ((text (cua--extract-rectangle)))
	      (cua--delete-rectangle)
	      (set-buffer (marker-buffer cua--global-mark-marker))
	      (goto-char (marker-position cua--global-mark-marker))
	      (cua--insert-rectangle text 'auto))
	    (message "Moved rectangle to global mark in %s:%d"
		     (buffer-name (marker-buffer cua--global-mark-marker))
		     (marker-position cua--global-mark-marker))
	    (cua--activate-global-mark))))
    (cua--deactivate-global-mark)
    (message "No Global Mark")))