Function: mpc-select-save

mpc-select-save is a macro defined in mpc.el.gz.

Signature

(mpc-select-save &rest BODY)

Documentation

Execute BODY and restore the selection afterwards.

Source Code

;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defmacro mpc-select-save (&rest body)
  "Execute BODY and restore the selection afterwards."
  (declare (indent 0) (debug t))
  `(let ((selection (mpc-select-get-selection))
         (position (cons (buffer-substring-no-properties
                          (line-beginning-position) (line-end-position))
                         (current-column))))
     ,@body
     (mpc-select-restore selection)
     (goto-char (point-min))
     (if (re-search-forward
          (concat "^" (regexp-quote (car position)) "$")
          (if (overlayp mpc-separator-ol)
              (overlay-end mpc-separator-ol))
          t)
         (move-to-column (cdr position)))
     (let ((win (get-buffer-window (current-buffer) 0)))
       (if win (set-window-point win (point))))))