Function: vip-ex
vip-ex is an interactive and byte-compiled function defined in
vip.el.gz.
Signature
(vip-ex &optional STRING)
Documentation
ex commands within VIP.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/vip.el.gz
(defun vip-ex (&optional string)
"ex commands within VIP."
(interactive)
(or string
(setq ex-g-flag nil
ex-g-variant nil))
(let ((com-str (or string (vip-read-string ":")))
(address nil) (cont t) (dot (point)))
(with-current-buffer (get-buffer-create " *ex-working-space*")
(delete-region (point-min) (point-max))
(insert com-str "\n")
(goto-char (point-min)))
(setq ex-token-type "")
(setq ex-addresses nil)
(while cont
(vip-get-ex-token)
(cond ((or (string= ex-token-type "command")
(string= ex-token-type "end-mark"))
(if address (setq ex-addresses (cons address ex-addresses)))
(cond ((string= ex-token "global")
(ex-global nil)
(setq cont nil))
((string= ex-token "v")
(ex-global t)
(setq cont nil))
(t
(vip-execute-ex-command)
(with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(cond ((looking-at "|")
(forward-char 1))
((looking-at "\n")
(setq cont nil))
(t (error "Extra character at end of a command")))))))
((string= ex-token-type "non-command")
(error "%s: Not an editor command" ex-token))
((string= ex-token-type "whole")
(setq ex-addresses
(cons (point-max) (cons (point-min) ex-addresses))))
((string= ex-token-type "comma")
(setq ex-addresses
(cons (if (null address) (point) address) ex-addresses)))
((string= ex-token-type "semi-colon")
(if address (setq dot address))
(setq ex-addresses
(cons (if (null address) (point) address) ex-addresses)))
(t (let ((ans (vip-get-ex-address-subr address dot)))
(if ans (setq address ans))))))))