Function: rectangle-exchange-point-and-mark

rectangle-exchange-point-and-mark is an interactive and byte-compiled function defined in rect.el.gz.

Signature

(rectangle-exchange-point-and-mark &optional ARG)

Documentation

Like exchange-point-and-mark but cycles through the rectangle's corners.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/rect.el.gz
(defun rectangle-exchange-point-and-mark (&optional arg)
  "Like `exchange-point-and-mark' but cycles through the rectangle's corners."
  (interactive "P")
  (if arg
      (progn
        (setq this-command 'exchange-point-and-mark)
        (exchange-point-and-mark arg))
    (let* ((p (point))
           (repeat (eq this-command last-command))
	   (m (mark))
           (p<m (< p m))
           (cols (if p<m (rectangle--pos-cols p m) (rectangle--pos-cols m p)))
           (cp (if p<m (car cols) (cdr cols)))
           (cm (if p<m (cdr cols) (car cols))))
      (if repeat (setq this-command 'exchange-point-and-mark))
      (rectangle--reset-crutches)
      (goto-char p)
      (rectangle--col-pos (if repeat cm cp) 'mark)
      (set-mark (point))
      (goto-char m)
      (rectangle--col-pos (if repeat cp cm) 'point))))