Function: vip-prefix-arg-com
vip-prefix-arg-com is a byte-compiled function defined in vip.el.gz.
Signature
(vip-prefix-arg-com CHAR VALUE COM)
Documentation
Vi operator as prefix argument.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/vip.el.gz
(defun vip-prefix-arg-com (char value com)
"Vi operator as prefix argument."
(let ((cont t))
(while (and cont
(or (= char ?c) (= char ?d) (= char ?y)
(= char ?!) (= char ?<) (= char ?>) (= char ?=)
(= char ?#) (= char ?r) (= char ?R) (= char ?\")))
(if com
;; this means that we already have a command character, so we
;; construct a com list and exit while. however, if char is "
;; it is an error.
(progn
;; new com is (CHAR . OLDCOM)
(if (or (= char ?#) (= char ?\")) (error ""))
(setq com (cons char com))
(setq cont nil))
;; if com is nil we set com as char, and read more. again, if char
;; is ", we read the name of register and store it in vip-use-register.
;; if char is !, =, or #, a complete com is formed so we exit while.
(cond ((or (= char ?!) (= char ?=))
(setq com char)
(setq char (read-char))
(setq cont nil))
((= char ?#)
;; read a char and encode it as com
(setq com (+ 128 (read-char)))
(setq char (read-char))
(setq cont nil))
((or (= char ?<) (= char ?>))
(setq com char)
(setq char (read-char))
(if (= com char) (setq com (cons char com)))
(setq cont nil))
((= char ?\")
(let ((reg (read-char)))
(if (or (and (<= ?A reg) (<= reg ?z))
(and (<= ?1 reg) (<= reg ?9)))
(setq vip-use-register reg)
(error ""))
(setq char (read-char))))
(t
(setq com char)
(setq char (read-char)))))))
(if (atom com)
;; com is a single char, so we construct prefix-arg
;; and if char is ?, describe prefix arg, otherwise exit by
;; pushing the char back
(progn
(setq prefix-arg (cons value com))
(while (= char ?U)
(vip-describe-arg prefix-arg)
(setq char (read-char)))
(push char unread-command-events))
;; as com is non-nil, this means that we have a command to execute
(if (or (= (car com) ?r) (= (car com) ?R))
;; execute appropriate region command.
(let ((char (car com)) (com (cdr com)))
(setq prefix-arg (cons value com))
(if (= char ?r) (vip-region prefix-arg)
(vip-Region prefix-arg))
;; reset prefix-arg
(setq prefix-arg nil))
;; otherwise, reset prefix arg and call appropriate command
(setq value (if (null value) 1 value))
(setq prefix-arg nil)
(cond ((equal com '(?c . ?c)) (vip-line (cons value ?C)))
((equal com '(?d . ?d)) (vip-line (cons value ?D)))
((equal com '(?d . ?y)) (vip-yank-defun))
((equal com '(?y . ?y)) (vip-line (cons value ?Y)))
((equal com '(?< . ?<)) (vip-line (cons value ?<)))
((equal com '(?> . ?>)) (vip-line (cons value ?>)))
((equal com '(?! . ?!)) (vip-line (cons value ?!)))
((equal com '(?= . ?=)) (vip-line (cons value ?=)))
(t (error ""))))))