Function: viper-cycle-through-mark-ring

viper-cycle-through-mark-ring is a byte-compiled function defined in viper-cmd.el.gz.

Signature

(viper-cycle-through-mark-ring)

Documentation

Visit previous locations on the mark ring.

One can use `` and '' to temporarily jump 1 step back.

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
;; Algorithm: If first invocation of this command save mark on ring, goto
;; mark, M0, and pop the most recent elt from the mark ring into mark,
;; making it into the new mark, M1.
;; Push this mark back and set mark to the original point position, p1.
;; So, if you hit '' or `` then you can return to p1.
;;
;; If repeated command, pop top elt from the ring into mark and
;; jump there.  This forgets the position, p1, and puts M1 back into mark.
;; Then we save the current pos, which is M0, jump to M1 and pop M2 from
;; the ring into mark.  Push M2 back on the ring and set mark to M0.
;; etc.
(defun viper-cycle-through-mark-ring ()
  "Visit previous locations on the mark ring.
One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back."
  (let* ((sv-pt (point)))
       ;; if repeated `m,' command, pop the previously saved mark.
       ;; Prev saved mark is actually prev saved point.  It is used if the
       ;; user types `` or '' and is discarded
       ;; from the mark ring by the next `m,' command.
       ;; In any case, go to the previous or previously saved mark.
       ;; Then push the current mark (popped off the ring) and set current
       ;; point to be the mark.  Current pt as mark is discarded by the next
       ;; m, command.
       (if (eq last-command 'viper-cycle-through-mark-ring)
	   ()
	 ;; save current mark if the first iteration
	 (setq mark-ring (delete (mark-marker) mark-ring))
	 (if (mark t)
	     (push-mark (mark t) t)) )
       (pop-mark)
       (set-mark-command 1)
       ;; don't duplicate mark on the ring
       (setq mark-ring (delete (mark-marker) mark-ring))
       (push-mark sv-pt t)
       (deactivate-mark)
       (setq this-command 'viper-cycle-through-mark-ring)
       ))