Function: viper-goto-mark-subr

viper-goto-mark-subr is a byte-compiled function defined in viper-cmd.el.gz.

Signature

(viper-goto-mark-subr CHAR COM SKIP-WHITE)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
(defun viper-goto-mark-subr (char com skip-white)
  (if (eobp)
      (if (bobp)
	  (error "Empty buffer")
	(backward-char 1)))
  (cond ((viper-valid-register char '(letter))
	 (let* ((buff (current-buffer))
                (reg (1+ (- char ?a)))
                (text-marker (get-register reg)))
	   ;; If marker points to file that had markers set (and those markers
	   ;; were saved (as e.g., in session.el), then restore those markers
	   (if (and (consp text-marker)
                    (eq (car text-marker) 'file-query)
                    (or (find-buffer-visiting (nth 1 text-marker))
                        (y-or-n-p (format "Visit file %s again? "
                                          (nth 1 text-marker)))))
               (save-excursion
                 (find-file (nth 1 text-marker))
                 (when (and (<= (nth 2 text-marker) (point-max))
                            (<= (point-min) (nth 2 text-marker)))
                   (setq text-marker (copy-marker (nth 2 text-marker)))
                   (set-register reg text-marker))))
	   (if com (viper-move-marker-locally 'viper-com-point (point)))
	   (if (not (viper-valid-marker text-marker))
	       (error viper-EmptyTextmarker char))
	   (if (and (viper-same-line (point) viper-last-jump)
		    (= (point) viper-last-jump-ignore))
	       (push-mark viper-last-jump t)
	     (push-mark nil t)) ; no msg
	   (viper-register-to-point reg)
	   (setq viper-last-jump (point-marker))
	   (cond (skip-white
		  (back-to-indentation)
		  (setq viper-last-jump-ignore (point))))
	   (if com
	       (if (equal buff (current-buffer))
		   (viper-execute-com (if skip-white
					  'viper-goto-mark-and-skip-white
					'viper-goto-mark)
				    nil com)
		 (switch-to-buffer buff)
		 (goto-char viper-com-point)
		 (viper-change-state-to-vi)
		 (user-error viper-ViperBell)))))
	((and (not skip-white) (viper= char ?`))
	 (if com (viper-move-marker-locally 'viper-com-point (point)))
	 (if (and (viper-same-line (point) viper-last-jump)
		  (= (point) viper-last-jump-ignore))
	     (goto-char viper-last-jump))
	 (if (null (mark t)) (error "Mark is not set in this buffer"))
	 (if (= (point) (mark t)) (pop-mark))
	 (exchange-point-and-mark)
	 (setq viper-last-jump (point-marker)
	       viper-last-jump-ignore 0)
	 (if com (viper-execute-com 'viper-goto-mark nil com)))
	((and skip-white (viper= char ?'))
	 (if com (viper-move-marker-locally 'viper-com-point (point)))
	 (if (and (viper-same-line (point) viper-last-jump)
		  (= (point) viper-last-jump-ignore))
	     (goto-char viper-last-jump))
	 (if (= (point) (mark t)) (pop-mark))
	 (exchange-point-and-mark)
	 (setq viper-last-jump (point))
	 (back-to-indentation)
	 (setq viper-last-jump-ignore (point))
	 (if com (viper-execute-com 'viper-goto-mark-and-skip-white nil com)))
	(t (error viper-InvalidTextmarker char))))